diff options
Diffstat (limited to 'plugins/mod_message.lua')
-rw-r--r-- | plugins/mod_message.lua | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/plugins/mod_message.lua b/plugins/mod_message.lua index e85da613..0d370ec1 100644 --- a/plugins/mod_message.lua +++ b/plugins/mod_message.lua @@ -1,7 +1,7 @@ -- Prosody IM -- Copyright (C) 2008-2010 Matthew Wild -- Copyright (C) 2008-2010 Waqas Hussain --- +-- -- This project is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. -- @@ -17,10 +17,10 @@ local user_exists = require "core.usermanager".user_exists; local function process_to_bare(bare, origin, stanza) local user = bare_sessions[bare]; - + local t = stanza.attr.type; if t == "error" then - -- discard + return true; -- discard elseif t == "groupchat" then origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); elseif t == "headline" then @@ -48,11 +48,10 @@ local function process_to_bare(bare, origin, stanza) local node, host = jid_split(bare); local ok if user_exists(node, host) then - -- TODO apply the default privacy list - ok = module:fire_event('message/offline/handle', { - origin = origin, - stanza = stanza, + username = node; + origin = origin, + stanza = stanza, }); end @@ -66,20 +65,20 @@ end module:hook("message/full", function(data) -- message to full JID recieved local origin, stanza = data.origin, data.stanza; - + local session = full_sessions[stanza.attr.to]; if session and session.send(stanza) then return true; else -- resource not online return process_to_bare(jid_bare(stanza.attr.to), origin, stanza); end -end); +end, -1); module:hook("message/bare", function(data) -- message to bare JID recieved local origin, stanza = data.origin, data.stanza; return process_to_bare(stanza.attr.to or (origin.username..'@'..origin.host), origin, stanza); -end); +end, -1); module:add_feature("msgoffline"); |