plugins/mod_iq.lua

changeset 3802
530a74b60e45
parent 3797
bd92e421728d
child 3679
afdce92d07be
equal deleted inserted replaced
3801:ecb7f06c940c 3802:530a74b60e45
11 local jid_split = require "util.jid".split; 11 local jid_split = require "util.jid".split;
12 12
13 local full_sessions = full_sessions; 13 local full_sessions = full_sessions;
14 local bare_sessions = bare_sessions; 14 local bare_sessions = bare_sessions;
15 15
16 module:hook("iq/full", function(data) 16 if module::get_host_type() == "local" then
17 -- IQ to full JID recieved 17 module:hook("iq/full", function(data)
18 local origin, stanza = data.origin, data.stanza; 18 -- IQ to full JID recieved
19 local origin, stanza = data.origin, data.stanza;
19 20
20 local session = full_sessions[stanza.attr.to]; 21 local session = full_sessions[stanza.attr.to];
21 if session then 22 if session then
22 -- TODO fire post processing event 23 -- TODO fire post processing event
23 session.send(stanza); 24 session.send(stanza);
24 else -- resource not online 25 else -- resource not online
25 if stanza.attr.type == "get" or stanza.attr.type == "set" then 26 if stanza.attr.type == "get" or stanza.attr.type == "set" then
26 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); 27 origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
28 end
27 end 29 end
28 end 30 return true;
29 return true; 31 end);
30 end); 32 end
31 33
32 module:hook("iq/bare", function(data) 34 module:hook("iq/bare", function(data)
33 -- IQ to bare JID recieved 35 -- IQ to bare JID recieved
34 local origin, stanza = data.origin, data.stanza; 36 local origin, stanza = data.origin, data.stanza;
35 local type = stanza.attr.type; 37 local type = stanza.attr.type;

mercurial