aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_iq.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-11-28 02:24:26 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-11-28 02:24:26 +0500
commit813e686db6deed135b4e1e92d51b34a549e65019 (patch)
treeee6992019d7bdfa55febaac16dcafc2fe4b52e9d /plugins/mod_iq.lua
parent8e6d82e5f8e623c7776a19e28c70e7959a295d47 (diff)
downloadprosody-813e686db6deed135b4e1e92d51b34a549e65019.tar.gz
prosody-813e686db6deed135b4e1e92d51b34a549e65019.zip
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).
Diffstat (limited to 'plugins/mod_iq.lua')
-rw-r--r--plugins/mod_iq.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/mod_iq.lua b/plugins/mod_iq.lua
index e077e23d..bc203993 100644
--- a/plugins/mod_iq.lua
+++ b/plugins/mod_iq.lua
@@ -35,7 +35,9 @@ module:hook("iq/bare", function(data)
-- 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 @@ module:hook("iq/bare", function(data)
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 @@ module:hook("iq/host", function(data)
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;