Mercurial > prosody-modules
changeset 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 | 0e7f9ce4768f |
| children | 00735045109d |
| files | mod_unsubscriber/README.md mod_unsubscriber/mod_unsubscriber.lua |
| diffstat | 2 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_unsubscriber/README.md Sun Feb 01 14:10:14 2026 +0100 +++ b/mod_unsubscriber/README.md Sat Feb 07 12:25:52 2026 +0100 @@ -1,10 +1,14 @@ -Over the years, some servers stop working for various reasons, and leave -behind broken roster subscriptions that trigger failing s2s connections. +Over the years, some servers stop working for various reasons, and leave behind broken roster subscriptions and dysfunctional group chat bookmarks +that trigger failing s2s connections. Sometimes users make mistakes when adding a contact or group chat, causing your server to make repeated attempts +to connect to a domain with a typo in it. + This module allows cleaning up such cases by unsubscribing local users -from their contacts on those servers. Also works for typos and the like. +from their contacts on those servers. Use with care. -```lua +To use, simply add as a `Component` for each domain you want to stop seeing failed connection logs about. + +``` lua Component "gmail.com" "unsubscriber" modules_disabled = { "s2s" } ```
--- a/mod_unsubscriber/mod_unsubscriber.lua Sun Feb 01 14:10:14 2026 +0100 +++ b/mod_unsubscriber/mod_unsubscriber.lua Sat Feb 07 12:25:52 2026 +0100 @@ -12,6 +12,13 @@ origin.send(reply); return true; elseif stanza.attr.type == nil then + if stanza:get_child("x", "http://jabber.org/protocol/muc") then + -- attempting to join a MUC + -- tell them it's gone + local reply = st.error_reply(stanza, "cancel", "gone"); + origin.send(reply); + return true; + end -- they think we are subscribed and sent their current presence -- tell them we unsubscribe local reply = st.reply(stanza)
