25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-24 17:29:28 +01:00

Add functions to get/set some c2s state elements

This commit is contained in:
Holger Weiss 2016-08-15 20:24:43 +02:00
parent 5b4f347da8
commit e7217e6320

View File

@ -52,6 +52,11 @@
set_aux_field/3, set_aux_field/3,
del_aux_field/2, del_aux_field/2,
get_subscription/2, get_subscription/2,
get_queued_stanzas/1,
get_csi_state/1,
set_csi_state/2,
get_resume_timeout/1,
set_resume_timeout/2,
send_filtered/5, send_filtered/5,
broadcast/4, broadcast/4,
get_subscribed/1, get_subscribed/1,
@ -244,6 +249,27 @@ get_subscription(LFrom, StateData) ->
true -> none true -> none
end. end.
get_queued_stanzas(#state{mgmt_queue = Queue} = StateData) ->
lists:map(fun({_N, Time, El}) ->
add_resent_delay_info(StateData, El, Time)
end, queue:to_list(Queue)).
get_csi_state(#state{csi_state = CsiState}) ->
CsiState.
set_csi_state(#state{} = StateData, CsiState) ->
StateData#state{csi_state = CsiState};
set_csi_state(FsmRef, CsiState) ->
FsmRef ! {set_csi_state, CsiState}.
get_resume_timeout(#state{mgmt_timeout = Timeout}) ->
Timeout.
set_resume_timeout(#state{} = StateData, Timeout) ->
StateData#state{mgmt_timeout = Timeout};
set_resume_timeout(FsmRef, Timeout) ->
FsmRef ! {set_resume_timeout, Timeout}.
send_filtered(FsmRef, Feature, From, To, Packet) -> send_filtered(FsmRef, Feature, From, To, Packet) ->
FsmRef ! {send_filtered, Feature, From, To, Packet}. FsmRef ! {send_filtered, Feature, From, To, Packet}.
@ -1743,6 +1769,10 @@ handle_info({broadcast, Type, From, Packet}, StateName, StateData) ->
From, jid:make(USR), Packet) From, jid:make(USR), Packet)
end, lists:usort(Recipients)), end, lists:usort(Recipients)),
fsm_next_state(StateName, StateData); fsm_next_state(StateName, StateData);
handle_info({set_csi_state, CsiState}, StateName, StateData) ->
fsm_next_state(StateName, StateData#state{csi_state = CsiState});
handle_info({set_resume_timeout, Timeout}, StateName, StateData) ->
fsm_next_state(StateName, StateData#state{mgmt_timeout = Timeout});
handle_info(dont_ask_offline, StateName, StateData) -> handle_info(dont_ask_offline, StateName, StateData) ->
fsm_next_state(StateName, StateData#state{ask_offline = false}); fsm_next_state(StateName, StateData#state{ask_offline = false});
handle_info({_Ref, {resume, OldStateData}}, StateName, StateData) -> handle_info({_Ref, {resume, OldStateData}}, StateName, StateData) ->