aboutsummaryrefslogtreecommitdiffstats
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
commit2f3a3c656759980dd3be17dfc2f41819a347f3ac (patch)
treefa1bc5f5fc19234e6102d969a99d7f5b78df7ac6
parente127b423f948077553635a21050abc4f109aa564 (diff)
downloadprosody-2f3a3c656759980dd3be17dfc2f41819a347f3ac.tar.gz
prosody-2f3a3c656759980dd3be17dfc2f41819a347f3ac.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).
-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;