Software /
code /
prosody
Changeset
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 |
parents | 1259:6bd11bca9725 |
children | 1261:497178e0ddbe |
files | plugins/mod_iq.lua |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
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);