aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_message.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mod_message.lua')
-rw-r--r--plugins/mod_message.lua15
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/mod_message.lua b/plugins/mod_message.lua
index 4b8154e0..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
@@ -49,8 +58,8 @@ local function process_to_bare(bare, origin, stanza)
local ok
if user_exists(node, host) then
ok = module:fire_event('message/offline/handle', {
- username = node;
- origin = origin,
+ username = node, -- username of the recipient of the offline message
+ origin = origin, -- the sender
stanza = stanza,
});
end
@@ -80,5 +89,3 @@ module:hook("message/bare", function(data)
return process_to_bare(stanza.attr.to or (origin.username..'@'..origin.host), origin, stanza);
end, -1);
-
-module:add_feature("msgoffline");