From 5968bc9318bec80aef1c31d46d247c13bdbc4c0e Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Wed, 13 Dec 2017 18:59:06 +0100 Subject: [PATCH] Send last PEP items to owner on initial presence Closes #2112. --- src/mod_caps.erl | 4 +++- src/mod_pubsub.erl | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod_caps.erl b/src/mod_caps.erl index edc93bbf1..6021da252 100644 --- a/src/mod_caps.erl +++ b/src/mod_caps.erl @@ -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), diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index efa22305c..bedbd3495 100644 --- a/src/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -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