From edb18deb8fdc10bf440ed94ee0459ded9358e75d Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 6 Jul 2015 23:45:25 +0200 Subject: [PATCH] mod_pubsub: Explain caps_update usage in a comment The reason to use the caps_update hook for sending last items to remote contacts is probably not obvious. --- src/mod_pubsub.erl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index f572c33d1..ee6407793 100644 --- a/src/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -685,6 +685,15 @@ disco_items(Host, Node, From) -> caps_update(#jid{luser = U, lserver = S, lresource = R}, #jid{lserver = Host} = JID, _Features) when Host =/= S -> + %% When a remote contact goes online while the local user is offline, the + %% remote contact won't receive last items from the local user even if + %% ignore_pep_from_offline is set to false. To work around this issue a bit, + %% we'll also send the last items to remote contacts when the local user + %% connects. That's the reason to use the caps_update hook instead of the + %% presence_probe_hook for remote contacts: The latter is only called when a + %% contact becomes available; the former also is also executed when the + %% local user goes online (because that triggers the contact to send a + %% presence packet with CAPS). presence(Host, {presence, U, S, [R], JID}); caps_update(_From, _To, _Feature) -> ok.