Comparison

plugins/mod_proxy65.lua @ 3693:519f5eadf4b9

mod_proxy65: Cleaned up stanza processing a little.
author Waqas Hussain <waqas20@gmail.com>
date Fri, 03 Dec 2010 00:22:11 +0500
parent 3692:117778c5a7fe
child 3694:a7d88f58abbb
comparison
equal deleted inserted replaced
3692:117778c5a7fe 3693:519f5eadf4b9
190 module.unload = function() 190 module.unload = function()
191 connlisteners.deregister(module.host .. ':proxy65'); 191 connlisteners.deregister(module.host .. ':proxy65');
192 end 192 end
193 193
194 local function set_activation(stanza) 194 local function set_activation(stanza)
195 local from, to, sid, reply = nil; 195 local to, reply;
196 from = stanza.attr.from; 196 local from = stanza.attr.from;
197 if stanza.tags[1] ~= nil and tostring(stanza.tags[1].name) == "query" then 197 local query = stanza.tags[1];
198 if stanza.tags[1].attr ~= nil then 198 local sid = query.attr.sid;
199 sid = stanza.tags[1].attr.sid; 199 if query.tags[1] and query.tags[1].name == "activate" then
200 end 200 to = query.tags[1][1];
201 if stanza.tags[1].tags[1] ~= nil and tostring(stanza.tags[1].tags[1].name) == "activate" then
202 to = stanza.tags[1].tags[1][1];
203 end
204 end 201 end
205 if from ~= nil and to ~= nil and sid ~= nil then 202 if from ~= nil and to ~= nil and sid ~= nil then
206 reply = st.iq({type="result", from=host, to=from}); 203 reply = st.iq({type="result", from=host, to=from});
207 reply.attr.id = stanza.attr.id; 204 reply.attr.id = stanza.attr.id;
208 end 205 end