Comparison

plugins/mod_iq.lua @ 4966:073eff2853a1

mod_iq: Don't treat an iq as handled if session.send() returns false
author Matthew Wild <mwild1@gmail.com>
date Sun, 22 Jul 2012 17:01:52 +0100
parent 4870:ca39f9b4cc8e
child 5370:7838acadb0fa
comparison
equal deleted inserted replaced
4965:c1685f0441b7 4966:073eff2853a1
15 module:hook("iq/full", function(data) 15 module:hook("iq/full", function(data)
16 -- IQ to full JID recieved 16 -- IQ to full JID recieved
17 local origin, stanza = data.origin, data.stanza; 17 local origin, stanza = data.origin, data.stanza;
18 18
19 local session = full_sessions[stanza.attr.to]; 19 local session = full_sessions[stanza.attr.to];
20 if session then 20 if not (session and session.send(stanza)) then
21 -- TODO fire post processing event
22 session.send(stanza);
23 else -- resource not online
24 if stanza.attr.type == "get" or stanza.attr.type == "set" then 21 if stanza.attr.type == "get" or stanza.attr.type == "set" then
25 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); 22 origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
26 end 23 end
27 end 24 end
28 return true; 25 return true;