diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-06-01 05:35:32 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-06-01 05:35:32 +0500 |
commit | a406492eac0743ee7c842defe9622b143992d3da (patch) | |
tree | 07e00aafdf10643e679e348360f79aabf21d47af | |
parent | 27593d477fe24b3fa7863f7c051393be4f33cb5b (diff) | |
download | prosody-a406492eac0743ee7c842defe9622b143992d3da.tar.gz prosody-a406492eac0743ee7c842defe9622b143992d3da.zip |
mod_iq: Fire sub-events for IQs directed at bare JIDs and hosts
-rw-r--r-- | plugins/mod_iq.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/mod_iq.lua b/plugins/mod_iq.lua index e0c9813d..fc79e92c 100644 --- a/plugins/mod_iq.lua +++ b/plugins/mod_iq.lua @@ -22,12 +22,20 @@ module:hook("iq/bare", function(data) -- TODO if not user exists, return an error -- TODO fire post processing events - -- TODO fire event with the xmlns:tag of the child, or with the id of errors and results + if #stanza.tags == 1 then + return module:fire_event("iq/bare/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name); + else + return true; -- TODO do something with results and errors + end end); module:hook("iq/host", function(data) -- IQ to a local host recieved local origin, stanza = data.origin, data.stanza; - -- TODO fire event with the xmlns:tag of the child, or with the id of errors and results + if #stanza.tags == 1 then + return module:fire_event("iq/host/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name); + else + return true; -- TODO do something with results and errors + end end); |