aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2021-09-22 13:31:13 +0100
committerMatthew Wild <mwild1@gmail.com>2021-09-22 13:31:13 +0100
commit584285332d6b87650ae5e5456b823f35debd3834 (patch)
tree11b7e0d3b9c1738ab9750c9394f65822a3e4c8c8 /plugins
parentd22a31530a94f4809d49ff51b2c3e984de7a087b (diff)
downloadprosody-584285332d6b87650ae5e5456b823f35debd3834.tar.gz
prosody-584285332d6b87650ae5e5456b823f35debd3834.zip
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.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_message.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/mod_message.lua b/plugins/mod_message.lua
index 09aefc08..9c07e796 100644
--- a/plugins/mod_message.lua
+++ b/plugins/mod_message.lua
@@ -22,6 +22,15 @@ local function process_to_bare(bare, origin, stanza)
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