aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-06-01 17:52:02 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-06-01 17:52:02 +0500
commit7b020e95d56db5759049e723e0392f38c6c7d59b (patch)
tree214aec48c7e8d4f10e6351283dca1e7adf348234 /plugins
parentc3c97029d5a95b98f4f8505eee6abb86cfd220e3 (diff)
downloadprosody-7b020e95d56db5759049e723e0392f38c6c7d59b.tar.gz
prosody-7b020e95d56db5759049e723e0392f38c6c7d59b.zip
mod_message: Added code to handle error groupchat and headline messages to bare JID
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_message.lua36
1 files changed, 27 insertions, 9 deletions
diff --git a/plugins/mod_message.lua b/plugins/mod_message.lua
index 9179f36b..03e2081d 100644
--- a/plugins/mod_message.lua
+++ b/plugins/mod_message.lua
@@ -7,20 +7,38 @@ local user_exists = require "core.usermanager".user_exists;
local function process_to_bare(bare, origin, stanza)
local sessions = bare_sessions[bare];
- if sessions then sessions = sessions.sessions; end
+ local t = stanza.attr.type;
+ if t == "error" then return true; end
+ if t == "groupchat" then
+ origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
+ return true;
+ end
+
if sessions then
- -- some resources are online
+ -- some resources are connected
+ sessions = sessions.sessions;
+
+ if t == "headline" then
+ for _, session in pairs(sessions) do
+ if session.presence and session.priority >= 0 then
+ session.send(stanza);
+ end
+ end
+ return true;
+ end
-- TODO find top resources willing to accept this message
-- TODO then send them each the stanza
- else
- -- no resources are online
- -- TODO check if the user exists
- -- TODO if it doesn't, return an error reply
- -- TODO otherwise, apply the default privacy list
- -- TODO and store into offline storage
- -- TODO or maybe the offline store can apply privacy lists
+ return;
end
+ -- no resources are online
+ if t == "headline" then return true; end -- current policy is to discard headlines
+ -- chat or normal message
+ -- TODO check if the user exists
+ -- TODO if it doesn't, return an error reply
+ -- TODO otherwise, apply the default privacy list
+ -- TODO and store into offline storage
+ -- TODO or maybe the offline store can apply privacy lists
end
module:hook("message/full", function(data)