processone/ejabberd — pull request #345 by weiss (2014-11-14 11:15:43+00:00)
Title: Fix sending of last published PEP items to newly-available resources

The PEP service [must][1] send the last published PEP items to subscribers when they become available, subject to [notification filtering][2]. This PR fixes the following issues:

* `mod_pubsub_odbc` [didn't apply][3] notification filtering.
* `mod_pubsub` _did_ apply notification filtering, but thereby sent the last published PEP items of all peers of a client _[to all his other peers][4]_, instead of only to that client.
* When a remote subscriber became available, he [didn't receive][5] the last publish item at all (as [reported in EJAB-1456][6]). This is only partially fixed, as the implementation still depends on the publisher being online while the remote subscriber becomes available. So, for remote subscribers, the behavior is now always like it is for local subscribers when `ignore_pep_from_offline` is set to `true`. To fix that properly, we would have to refactor PEP to no longer query the `#state` of a running `ejabberd_c2s` process.

[1]: http://xmpp.org/extensions/xep-0163.html#notify-last
[2]: http://xmpp.org/extensions/xep-0163.html#approach-filter
[3]: https://github.com/processone/ejabberd/blob/de3e1c350843c01e5c865b4f5136b7bbed74ddb8/src/mod_pubsub_odbc.erl#L3014
[4]: https://github.com/processone/ejabberd/blob/de3e1c350843c01e5c865b4f5136b7bbed74ddb8/src/mod_pubsub.erl#L3335
[5]: https://github.com/processone/ejabberd/blob/de3e1c350843c01e5c865b4f5136b7bbed74ddb8/src/mod_pubsub.erl#L3340
[6]: https://support.process-one.net/browse/EJAB-1456?focusedCommentId=52604&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-52604