Skip to content

Commit

Permalink
mod_pubsub: Don't blindly echo PEP notification
Browse files Browse the repository at this point in the history
Since commit 514c25c, whenever a PEP
item was published, a notification was blindly sent back to the owner.
However, this should only be done subject to +notify filtering, as per
XEP-0163:

| the PEP service shall send notifications to all of the account owner's
| available resources (subject to notification filtering).

The motivation for the mentioned commit was that +notify subscriptions
initially didn't work for PEP node owners (#2108).  However, that issue
was fixed by commit 5968bc9 (#2112).
As a result, the owner's client was actually notified twice if the
client was subscribed to the node (e.g., via +notify).

Therefore, just omit the additional, blind notification.

Thanks to W. Martin Borgert and Daniel Gultsch for reporting the issue.
  • Loading branch information
weiss committed Sep 13, 2024
1 parent d4b3095 commit 3469a51
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/mod_pubsub.erl
Original file line number Diff line number Diff line change
Expand Up @@ -3052,9 +3052,7 @@ broadcast_stanza({LUser, LServer, LResource}, Publisher, Node, Nidx, Type, NodeO
extended_headers([Publisher])),
Pred = fun(To) -> delivery_permitted(Owner, To, NodeOptions) end,
ejabberd_sm:route(jid:make(LUser, LServer, SenderResource),
{pep_message, <<((Node))/binary, "+notify">>, Stanza, Pred}),
ejabberd_router:route(xmpp:set_to(xmpp:put_meta(Stanza, ignore_sm_bounce, true),
jid:make(LUser, LServer)));
{pep_message, <<((Node))/binary, "+notify">>, Stanza, Pred});
broadcast_stanza(Host, _Publisher, Node, Nidx, Type, NodeOptions, SubsByDepth, NotifyType, BaseStanza, SHIM) ->
broadcast_stanza(Host, Node, Nidx, Type, NodeOptions, SubsByDepth, NotifyType, BaseStanza, SHIM).

Expand Down

0 comments on commit 3469a51

Please sign in to comment.