# HG changeset patch # User Waqas Hussain # Date 1243816532 -18000 # Node ID 04c1fae0eb0327943fe54aec16ea96dbd60766ae # Parent 6bd11bca972584e134452719851c75851498928c mod_iq: Fire sub-events for IQs directed at bare JIDs and hosts diff -r 6bd11bca9725 -r 04c1fae0eb03 plugins/mod_iq.lua --- a/plugins/mod_iq.lua Sun May 31 13:31:20 2009 +0500 +++ b/plugins/mod_iq.lua Mon Jun 01 05:35:32 2009 +0500 @@ -22,12 +22,20 @@ -- 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);