Software /
code /
prosody
Changeset
12100:0b14b541fd27
mod_roster: pass correct username to roster-item-removed
The other invocations use it that way, and the only listener in trunk
which uses it (in mod_presence) expects it that way.
Passing the username of the JID from the removed entry causes incorrect
unavailable presence stanzas to be sent, allegedly kicking people off
MUCs.
Fixes #1121.
author | Jonas Schäfer <jonas@wielicki.name> |
---|---|
date | Wed, 22 Dec 2021 13:06:32 +0100 |
parents | 12099:b344edad61d3 |
children | 12101:7cd94469d15f |
files | plugins/mod_roster.lua spec/scansion/issue1121.scs |
diffstat | 2 files changed, 76 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_roster.lua Wed Dec 22 14:24:26 2021 +0100 +++ b/plugins/mod_roster.lua Wed Dec 22 13:06:32 2021 +0100 @@ -74,7 +74,7 @@ local r_item = roster[jid]; if r_item then module:fire_event("roster-item-removed", { - username = node, jid = jid, item = r_item, origin = session, roster = roster, + username = from_node, jid = jid, item = r_item, origin = session, roster = roster, }); local success, err_type, err_cond, err_msg = rm_remove_from_roster(session, jid); if success then
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spec/scansion/issue1121.scs Wed Dec 22 13:06:32 2021 +0100 @@ -0,0 +1,75 @@ +# When removing roster contact, Prosody should send directed "unavailable" presence but sends global unavailable presence + +[Client] Romeo + jid: romeo@localhost + password: password + +[Client] Juliet + jid: juliet@localhost + password: password + +----- + +Romeo connects + +Romeo sends + <presence/> + +Romeo receives + <presence from="${Romeo's full JID}"/> + +Juliet connects + +Juliet sends + <presence/> + +Juliet receives + <presence from="${Juliet's full JID}"/> + +Romeo sends + <presence to="juliet@localhost" type="subscribe"/> + +Romeo receives + <presence from="juliet@localhost" to="romeo@localhost"/> + +Juliet receives + <presence from="romeo@localhost" to="juliet@localhost" type="subscribe"/> + +Juliet sends + <presence to="romeo@localhost" type="subscribed"/> + +Romeo receives + <presence from="${Juliet's full JID}" to="romeo@localhost"/> + +Juliet sends + <presence to="romeo@localhost" type="subscribe"/> + +Juliet receives + <presence from="romeo@localhost" to="juliet@localhost"/> + +Romeo receives + <presence from="juliet@localhost" to="romeo@localhost" type="subscribe"/> + +Romeo sends + <presence to="juliet@localhost" type="subscribed"/> + +Juliet receives + <presence from="${Romeo's full JID}" to="juliet@localhost"/> + +Romeo receives + <presence from="${Juliet's full JID}" to="romeo@localhost"/> + +Juliet sends + <iq type="set" id="iq1"> + <query xmlns="jabber:iq:roster"> + <item jid="romeo@localhost" subscription="remove"/> + </query> + </iq> + +Juliet receives + <iq type="result" id="iq1"/> + +Romeo receives + <presence from="${Juliet's full JID}" to="romeo@localhost" type="unavailable"/> + +Romeo disconnects