# HG changeset patch # User Waqas Hussain # Date 1290893066 -18000 # Node ID 28d9fff67fed0f90ea790cced44c356cdfc14c88 # Parent 374a1a680065e50df5854483f3e2ebe9e35c0961 mod_iq: Extra IQ get and set sub-events are now fired: "iq-{get,set}/{host,self,bare}/xmlns:tag" (when "iq/{host,self,bare}/xmlns:tag" is unhandled). diff -r 374a1a680065 -r 28d9fff67fed plugins/mod_iq.lua --- a/plugins/mod_iq.lua Sat Nov 27 21:52:30 2010 +0000 +++ b/plugins/mod_iq.lua Sun Nov 28 02:24:26 2010 +0500 @@ -35,7 +35,9 @@ -- TODO fire post processing events if stanza.attr.type == "get" or stanza.attr.type == "set" then - return module:fire_event("iq/bare/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); + local ret = module:fire_event("iq/bare/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); + if ret ~= nil then return ret; end + return module:fire_event("iq-"..stanza.attr.type.."/bare/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); else module:fire_event("iq-"..stanza.attr.type.."/bare/"..stanza.attr.id, data); return true; @@ -43,11 +45,13 @@ end); module:hook("iq/self", function(data) - -- IQ to bare JID recieved + -- IQ to self JID recieved local origin, stanza = data.origin, data.stanza; if stanza.attr.type == "get" or stanza.attr.type == "set" then - return module:fire_event("iq/self/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); + local ret = module:fire_event("iq/self/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); + if ret ~= nil then return ret; end + return module:fire_event("iq-"..stanza.attr.type.."/self/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); else module:fire_event("iq-"..stanza.attr.type.."/self/"..stanza.attr.id, data); return true; @@ -59,7 +63,9 @@ local origin, stanza = data.origin, data.stanza; if stanza.attr.type == "get" or stanza.attr.type == "set" then - return module:fire_event("iq/host/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); + local ret = module:fire_event("iq/host/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); + if ret ~= nil then return ret; end + return module:fire_event("iq-"..stanza.attr.type.."/host/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); else module:fire_event("iq-"..stanza.attr.type.."/host/"..stanza.attr.id, data); return true;