From e6ee9308ba9da8c2c7ab9e58bf2cb121b71e62af Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 21 Feb 2010 17:43:39 +0500 Subject: mod_iq: Fire sub-events for iq/self events. --- plugins/mod_iq.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'plugins/mod_iq.lua') diff --git a/plugins/mod_iq.lua b/plugins/mod_iq.lua index 5be04533..0e1dadfc 100644 --- a/plugins/mod_iq.lua +++ b/plugins/mod_iq.lua @@ -53,6 +53,18 @@ module:hook("iq/bare", function(data) end end); +module:hook("iq/self", function(data) + -- IQ to bare 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); + else + module:fire_event("iq/self/"..stanza.attr.id, data); + return true; + end +end); + module:hook("iq/host", function(data) -- IQ to a local host recieved local origin, stanza = data.origin, data.stanza; -- cgit v1.2.3