Skip to content

Commit

Permalink
Send last PEP items to owner on initial presence
Browse files Browse the repository at this point in the history
Closes #2112.
  • Loading branch information
weiss committed Dec 13, 2017
1 parent a65a78e commit 5968bc9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/mod_caps.erl
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,10 @@ c2s_presence_in(C2SState,
{Subscription, _} = ejabberd_hooks:run_fold(
roster_get_jid_info, To#jid.lserver,
{none, []}, [To#jid.luser, To#jid.lserver, From]),
ToSelf = (From#jid.luser == To#jid.luser)
and (From#jid.lserver == To#jid.lserver),
Insert = (Type == available)
and ((Subscription == both) or (Subscription == to)),
and ((Subscription == both) or (Subscription == to) or ToSelf),
Delete = (Type == unavailable) or (Type == error),
if Insert or Delete ->
LFrom = jid:tolower(From),
Expand Down
3 changes: 3 additions & 0 deletions src/mod_pubsub.erl
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,9 @@ disco_items(Host, Node, From) ->
%%

-spec caps_add(jid(), jid(), [binary()]) -> ok.
caps_add(JID, JID, _Features) ->
%% Send the owner his last PEP items.
send_last_pep(JID, JID);
caps_add(#jid{lserver = S1} = From, #jid{lserver = S2} = To, _Features)
when S1 =/= S2 ->
%% When a remote contact goes online while the local user is offline, the
Expand Down

0 comments on commit 5968bc9

Please sign in to comment.