2 local full_sessions = full_sessions;
3 local bare_sessions = bare_sessions;
5 local jid_bare = require "util.jid".bare;
6 local user_exists = require "core.usermanager".user_exists;
8 module:hook("message/full", function(data)
9 -- message to full JID recieved
10 local origin, stanza = data.origin, data.stanza;
12 local session = full_sessions[stanza.attr.to];
14 -- TODO fire post processing event
17 else -- resource not online
18 -- TODO fire event to send to bare JID
22 module:hook("message/bare", function(data)
23 -- message to bare JID recieved
24 local origin, stanza = data.origin, data.stanza;
26 local sessions = bare_sessions[stanza.attr.to];
27 if sessions then sessions = sessions.sessions; end
30 -- some resources are online
31 -- TODO find top resources willing to accept this message
32 -- TODO then send them each the stanza
34 -- no resources are online
35 -- TODO check if the user exists
36 -- TODO if it doesn't, return an error reply
37 -- TODO otherwise, apply the default privacy list
38 -- TODO and store into offline storage
39 -- TODO or maybe the offline store can apply privacy lists