Software /
code /
prosody
Diff
plugins/mod_iq.lua @ 1260:04c1fae0eb03
mod_iq: Fire sub-events for IQs directed at bare JIDs and hosts
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 01 Jun 2009 05:35:32 +0500 |
parent | 1234:0ff02499f05c |
child | 1265:3f3c62e45eeb |
line wrap: on
line diff
--- 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);