mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Fix initial presence after roster subscription approval (EJAB-1384)
Send initial presence after the roster subscription workflow is complete.
This commit is contained in:
parent
3391c9cad7
commit
70a2200888
@ -226,7 +226,7 @@ broadcast(FsmRef, Type, From, Packet) ->
|
|||||||
get_state(FsmRef) ->
|
get_state(FsmRef) ->
|
||||||
?GEN_FSM:sync_send_all_state_event(FsmRef, get_state, 1000).
|
?GEN_FSM:sync_send_all_state_event(FsmRef, get_state, 1000).
|
||||||
|
|
||||||
add_rosteritem(FsmRef, IJID, ISubscription) ->
|
add_rosteritem(FsmRef, IJID, ISubscription) when is_binary(ISubscription) ->
|
||||||
?GEN_FSM:send_all_state_event(FsmRef, {add_rosteritem, IJID, ISubscription}).
|
?GEN_FSM:send_all_state_event(FsmRef, {add_rosteritem, IJID, ISubscription}).
|
||||||
|
|
||||||
del_rosteritem(FsmRef, IJID) ->
|
del_rosteritem(FsmRef, IJID) ->
|
||||||
@ -1146,7 +1146,7 @@ handle_event({add_rosteritem, IJID, ISubscription}, StateName, StateData) ->
|
|||||||
fsm_next_state(StateName, NewStateData);
|
fsm_next_state(StateName, NewStateData);
|
||||||
|
|
||||||
handle_event({del_rosteritem, IJID}, StateName, StateData) ->
|
handle_event({del_rosteritem, IJID}, StateName, StateData) ->
|
||||||
NewStateData = roster_change(IJID, none, StateData),
|
NewStateData = roster_change(IJID, <<"none">>, StateData),
|
||||||
fsm_next_state(StateName, NewStateData);
|
fsm_next_state(StateName, NewStateData);
|
||||||
|
|
||||||
handle_event(_Event, StateName, StateData) ->
|
handle_event(_Event, StateName, StateData) ->
|
||||||
@ -1956,8 +1956,8 @@ remove_element(E, Set) ->
|
|||||||
|
|
||||||
roster_change(IJID, ISubscription, StateData) ->
|
roster_change(IJID, ISubscription, StateData) ->
|
||||||
LIJID = jlib:short_prepd_jid(IJID),
|
LIJID = jlib:short_prepd_jid(IJID),
|
||||||
IsFrom = (ISubscription == both) or (ISubscription == from),
|
IsFrom = (ISubscription == <<"both">>) or (ISubscription == <<"from">>),
|
||||||
IsTo = (ISubscription == both) or (ISubscription == to),
|
IsTo = (ISubscription == <<"both">>) or (ISubscription == <<"to">>),
|
||||||
OldIsFrom = ?SETS:is_element(LIJID, StateData#state.pres_f),
|
OldIsFrom = ?SETS:is_element(LIJID, StateData#state.pres_f),
|
||||||
FSet = if
|
FSet = if
|
||||||
IsFrom ->
|
IsFrom ->
|
||||||
|
@ -627,7 +627,12 @@ process_item_els(Item, []) ->
|
|||||||
|
|
||||||
push_item(User, Server, From, Item)
|
push_item(User, Server, From, Item)
|
||||||
when is_binary(User), is_binary(Server), ?IS_JID(From) ->
|
when is_binary(User), is_binary(Server), ?IS_JID(From) ->
|
||||||
{U, S, R} = Item#roster.jid,
|
{U, S, R2} = Item#roster.jid,
|
||||||
|
%% the ?XMLATTR macro will convert 'undefined' to <<"undefined">> .. so here we use <<>> for bare jids.
|
||||||
|
R = case R2 of
|
||||||
|
undefined -> <<>>;
|
||||||
|
_ -> R2
|
||||||
|
end,
|
||||||
ejabberd_sm:route(exmpp_jid:make(),
|
ejabberd_sm:route(exmpp_jid:make(),
|
||||||
exmpp_jid:make(User, Server),
|
exmpp_jid:make(User, Server),
|
||||||
#xmlel{name = 'broadcast', ns = roster_item, attrs =
|
#xmlel{name = 'broadcast', ns = roster_item, attrs =
|
||||||
|
Loading…
Reference in New Issue
Block a user