# HG changeset patch # User Matthew Wild # Date 1261405544 0 # Node ID 0ccd523e110a20e6f8c8a23b67d51d6b5e212392 # Parent fc2cd2f36cdd6672a932e95bf010666ecddcdb82 verse.client: Don't hook the stanza event every time a stanza comes in :) diff -r fc2cd2f36cdd -r 0ccd523e110a client.lua --- a/client.lua Sun Dec 20 22:07:20 2009 +0000 +++ b/client.lua Mon Dec 21 14:25:44 2009 +0000 @@ -33,23 +33,6 @@ elseif stanza.attr.xmlns then return stream:event("stream/"..stanza.attr.xmlns, stanza); end - - stream:hook("stanza", function (stanza) - if stanza.attr.xmlns == nil or stanza.attr.xmlns == "jabber:client" then - if stanza.name == "iq" and (stanza.attr.type == "get" or stanza.attr.type == "set") then - local xmlns = stanza.tags[1] and stanza.tags[1].attr.xmlns; - if xmlns then - ret = stream:event("iq/"..xmlns, stanza); - if not ret then - ret = stream:event("iq", stanza); - end - end - else - ret = stream:event(stanza.name, stanza); - end - end - return ret; - end, -1); return stream:event("stanza", stanza); end @@ -89,6 +72,23 @@ end end); + self:hook("stanza", function (stanza) + if stanza.attr.xmlns == nil or stanza.attr.xmlns == "jabber:client" then + if stanza.name == "iq" and (stanza.attr.type == "get" or stanza.attr.type == "set") then + local xmlns = stanza.tags[1] and stanza.tags[1].attr.xmlns; + if xmlns then + ret = self:event("iq/"..xmlns, stanza); + if not ret then + ret = self:event("iq", stanza); + end + end + else + ret = self:event(stanza.name, stanza); + end + end + return ret; + end, -1); + -- Initialise connection self:connect(self.connect_host or self.host, self.connect_port or 5222); --reset_stream(self);