12 |
12 |
13 local st = require "util.stanza"; |
13 local st = require "util.stanza"; |
14 local jid_bare = require "util.jid".bare; |
14 local jid_bare = require "util.jid".bare; |
15 local jid_split = require "util.jid".split; |
15 local jid_split = require "util.jid".split; |
16 local user_exists = require "core.usermanager".user_exists; |
16 local user_exists = require "core.usermanager".user_exists; |
17 local offlinemanager = require "core.offlinemanager"; |
|
18 local t_insert = table.insert; |
17 local t_insert = table.insert; |
19 |
18 |
20 local function process_to_bare(bare, origin, stanza) |
19 local function process_to_bare(bare, origin, stanza) |
21 local user = bare_sessions[bare]; |
20 local user = bare_sessions[bare]; |
22 |
21 |
45 end |
44 end |
46 -- no resources are online |
45 -- no resources are online |
47 local node, host = jid_split(bare); |
46 local node, host = jid_split(bare); |
48 if user_exists(node, host) then |
47 if user_exists(node, host) then |
49 -- TODO apply the default privacy list |
48 -- TODO apply the default privacy list |
50 offlinemanager.store(node, host, stanza); |
49 |
|
50 module:fire_event('message/offline/store', { |
|
51 origin = origin, |
|
52 stanza = stanza, |
|
53 }); |
51 else |
54 else |
52 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
55 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
53 end |
56 end |
54 end |
57 end |
55 return true; |
58 return true; |