Software /
code /
prosody
Changeset
11815:df1d3df2204a
mod_message: Fire event for groupchat messages sent to bare JID
This is becoming more common in XMPP as people experiment with a MIX-like
model where the bare JID joins a group chat instead of a full JID.
Specifically right now this is being added to help with processing
notifications from mod_muc_offline_delivery.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 22 Sep 2021 13:31:13 +0100 |
parents | 11814:f27b9319e0da |
children | 11816:eff0eeece24d |
files | plugins/mod_message.lua |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_message.lua Wed Sep 22 13:29:47 2021 +0200 +++ b/plugins/mod_message.lua Wed Sep 22 13:31:13 2021 +0100 @@ -22,6 +22,15 @@ if t == "error" then return true; -- discard elseif t == "groupchat" then + local node, host = jid_split(bare); + if user_exists(node, host) then + if module:fire_event("message/bare/groupchat", { + origin = origin, stanza = stanza; + }) then + return true; + end + end + origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); elseif t == "headline" then if user and stanza.attr.to == bare then