Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
1259:6bd11bca9725 | 1260:04c1fae0eb03 |
---|---|
20 -- IQ to bare JID recieved | 20 -- IQ to bare JID recieved |
21 local origin, stanza = data.origin, data.stanza; | 21 local origin, stanza = data.origin, data.stanza; |
22 | 22 |
23 -- TODO if not user exists, return an error | 23 -- TODO if not user exists, return an error |
24 -- TODO fire post processing events | 24 -- TODO fire post processing events |
25 -- TODO fire event with the xmlns:tag of the child, or with the id of errors and results | 25 if #stanza.tags == 1 then |
26 return module:fire_event("iq/bare/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name); | |
27 else | |
28 return true; -- TODO do something with results and errors | |
29 end | |
26 end); | 30 end); |
27 | 31 |
28 module:hook("iq/host", function(data) | 32 module:hook("iq/host", function(data) |
29 -- IQ to a local host recieved | 33 -- IQ to a local host recieved |
30 local origin, stanza = data.origin, data.stanza; | 34 local origin, stanza = data.origin, data.stanza; |
31 | 35 |
32 -- TODO fire event with the xmlns:tag of the child, or with the id of errors and results | 36 if #stanza.tags == 1 then |
37 return module:fire_event("iq/host/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name); | |
38 else | |
39 return true; -- TODO do something with results and errors | |
40 end | |
33 end); | 41 end); |