25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Simplified code.(thanks to Michael Remond)

SVN Revision: 2315
This commit is contained in:
Badlop 2009-06-16 18:27:24 +00:00
parent 5854edafdd
commit c19cc61c48

View File

@ -4,7 +4,7 @@
%%% Purpose : Implements XMPP over BOSH (XEP-0205) (formerly known as %%% Purpose : Implements XMPP over BOSH (XEP-0205) (formerly known as
%%% HTTP Binding) %%% HTTP Binding)
%%% Created : 21 Sep 2005 by Stefan Strigler <steve@zeank.in-berlin.de> %%% Created : 21 Sep 2005 by Stefan Strigler <steve@zeank.in-berlin.de>
%%% Id : $Id: ejabberd_http_bind.erl 949 2009-05-04 01:16:36Z mremond $ %%% Id : $Id: ejabberd_http_bind.erl 950 2009-05-04 01:23:55Z mremond $
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
-module(ejabberd_http_bind). -module(ejabberd_http_bind).
@ -424,15 +424,11 @@ handle_sync_event({http_get, Rid, Wait, Hold}, From, StateName, StateData) ->
(StateData#state.rid == Rid) and (StateData#state.rid == Rid) and
(StateData#state.input /= "cancel") and (StateData#state.input /= "cancel") and
(StateData#state.pause == 0) -> (StateData#state.pause == 0) ->
Output = StateData#state.output,
ReqList = StateData#state.req_list,
WaitTimer = erlang:start_timer(Wait * 1000, self(), []), WaitTimer = erlang:start_timer(Wait * 1000, self(), []),
{next_state, StateName, StateData#state{ {next_state, StateName, StateData#state{
output = Output,
http_receiver = From, http_receiver = From,
wait_timer = WaitTimer, wait_timer = WaitTimer,
timer = undefined, timer = undefined}};
req_list = ReqList}};
(StateData#state.input == "cancel") -> (StateData#state.input == "cancel") ->
if if
StateData#state.timer /= undefined -> StateData#state.timer /= undefined ->
@ -448,16 +444,12 @@ handle_sync_event({http_get, Rid, Wait, Hold}, From, StateName, StateData) ->
erlang:start_timer( erlang:start_timer(
StateData#state.max_inactivity, self(), []) StateData#state.max_inactivity, self(), [])
end, end,
Output = StateData#state.output,
ReqList = StateData#state.req_list,
Reply = {ok, cancel}, Reply = {ok, cancel},
{reply, Reply, StateName, StateData#state{ {reply, Reply, StateName, StateData#state{
input = "", input = "",
output = Output,
http_receiver = undefined, http_receiver = undefined,
wait_timer = undefined, wait_timer = undefined,
timer = Timer, timer = Timer}};
req_list = ReqList}};
true -> true ->
if if
StateData#state.timer /= undefined -> StateData#state.timer /= undefined ->
@ -488,10 +480,9 @@ handle_sync_event({http_get, Rid, Wait, Hold}, From, StateName, StateData) ->
[El || El <- StateData#state.req_list, [El || El <- StateData#state.req_list,
El#hbr.rid /= Rid ] El#hbr.rid /= Rid ]
], ],
Output = "",
{reply, Reply, StateName, StateData#state{ {reply, Reply, StateName, StateData#state{
input = "", input = "",
output = Output, output = "",
http_receiver = undefined, http_receiver = undefined,
wait_timer = undefined, wait_timer = undefined,
timer = Timer, timer = Timer,