mod_proxy65: Cleaned up stanza processing a little.
authorWaqas Hussain <waqas20@gmail.com>
Thu, 2 Dec 2010 19:22:11 +0000 (00:22 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Thu, 2 Dec 2010 19:22:11 +0000 (00:22 +0500)
plugins/mod_proxy65.lua

index 565cb38f54bebb66334b803356ef568fe3f1443a..6fc125544aa8ca56a7faedf09544309d350646ba 100644 (file)
@@ -192,15 +192,12 @@ module.unload = function()
 end
 
 local function set_activation(stanza)
-       local from, to, sid, reply = nil;
-       from = stanza.attr.from;
-       if stanza.tags[1] ~= nil and tostring(stanza.tags[1].name) == "query" then
-               if stanza.tags[1].attr ~= nil then
-                       sid = stanza.tags[1].attr.sid;
-               end
-               if stanza.tags[1].tags[1] ~= nil and tostring(stanza.tags[1].tags[1].name) == "activate" then
-                       to = stanza.tags[1].tags[1][1];
-               end
+       local to, reply;
+       local from = stanza.attr.from;
+       local query = stanza.tags[1];
+       local sid = query.attr.sid;
+       if query.tags[1] and query.tags[1].name == "activate" then
+               to = query.tags[1][1];
        end
        if from ~= nil and to ~= nil and sid ~= nil then
                reply = st.iq({type="result", from=host, to=from});