Fix initial presence after roster subscription approval (EJAB-1384)

Send initial presence after the roster subscription workflow
is complete.
This commit is contained in:
Pablo Polvorin 2011-01-27 11:05:16 -03:00
parent 3391c9cad7
commit 70a2200888
2 changed files with 10 additions and 5 deletions

View File

@ -226,7 +226,7 @@ broadcast(FsmRef, Type, From, Packet) ->
get_state(FsmRef) ->
?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}).
del_rosteritem(FsmRef, IJID) ->
@ -1146,7 +1146,7 @@ handle_event({add_rosteritem, IJID, ISubscription}, StateName, StateData) ->
fsm_next_state(StateName, NewStateData);
handle_event({del_rosteritem, IJID}, StateName, StateData) ->
NewStateData = roster_change(IJID, none, StateData),
NewStateData = roster_change(IJID, <<"none">>, StateData),
fsm_next_state(StateName, NewStateData);
handle_event(_Event, StateName, StateData) ->
@ -1956,8 +1956,8 @@ remove_element(E, Set) ->
roster_change(IJID, ISubscription, StateData) ->
LIJID = jlib:short_prepd_jid(IJID),
IsFrom = (ISubscription == both) or (ISubscription == from),
IsTo = (ISubscription == both) or (ISubscription == to),
IsFrom = (ISubscription == <<"both">>) or (ISubscription == <<"from">>),
IsTo = (ISubscription == <<"both">>) or (ISubscription == <<"to">>),
OldIsFrom = ?SETS:is_element(LIJID, StateData#state.pres_f),
FSet = if
IsFrom ->

View File

@ -627,7 +627,12 @@ process_item_els(Item, []) ->
push_item(User, Server, From, Item)
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(),
exmpp_jid:make(User, Server),
#xmlel{name = 'broadcast', ns = roster_item, attrs =