Mercurial > prosody-modules
comparison mod_unsubscriber/mod_unsubscriber.lua @ 6398:9c9889ad4302
mod_unsubscriber: Add MUC support
This catches XEP-0045 Join stanzas and replies with an error telling the
prospective participant that the supposed MUC is gone. The user or their
client can then take action to remove any bookmark or at least disable
autojoin.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 07 Feb 2026 12:25:52 +0100 |
| parents | e00dc913d965 |
| children |
comparison
equal
deleted
inserted
replaced
| 6397:0e7f9ce4768f | 6398:9c9889ad4302 |
|---|---|
| 10 local reply = st.reply(stanza) | 10 local reply = st.reply(stanza) |
| 11 reply.attr.type = "unsubcribed"; | 11 reply.attr.type = "unsubcribed"; |
| 12 origin.send(reply); | 12 origin.send(reply); |
| 13 return true; | 13 return true; |
| 14 elseif stanza.attr.type == nil then | 14 elseif stanza.attr.type == nil then |
| 15 if stanza:get_child("x", "http://jabber.org/protocol/muc") then | |
| 16 -- attempting to join a MUC | |
| 17 -- tell them it's gone | |
| 18 local reply = st.error_reply(stanza, "cancel", "gone"); | |
| 19 origin.send(reply); | |
| 20 return true; | |
| 21 end | |
| 15 -- they think we are subscribed and sent their current presence | 22 -- they think we are subscribed and sent their current presence |
| 16 -- tell them we unsubscribe | 23 -- tell them we unsubscribe |
| 17 local reply = st.reply(stanza) | 24 local reply = st.reply(stanza) |
| 18 reply.attr.type = "unsubcribe"; | 25 reply.attr.type = "unsubcribe"; |
| 19 origin.send(reply); | 26 origin.send(reply); |
