Software / code / prosody
Annotate
plugins/mod_iq.lua @ 1257:8c9f20d3a17f
componentmanager: Add events object to registered components if they don't already have one
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 31 May 2009 21:36:12 +0100 |
| parent | 1234:0ff02499f05c |
| child | 1260:04c1fae0eb03 |
| rev | line source |
|---|---|
|
1234
0ff02499f05c
mod_message, mod_iq: A little cleanup
Waqas Hussain <waqas20@gmail.com>
parents:
1233
diff
changeset
|
1 |
|
0ff02499f05c
mod_message, mod_iq: A little cleanup
Waqas Hussain <waqas20@gmail.com>
parents:
1233
diff
changeset
|
2 local full_sessions = full_sessions; |
|
0ff02499f05c
mod_message, mod_iq: A little cleanup
Waqas Hussain <waqas20@gmail.com>
parents:
1233
diff
changeset
|
3 local bare_sessions = bare_sessions; |
| 1233 | 4 |
| 5 module:hook("iq/full", function(data) | |
| 6 -- IQ to full JID recieved | |
| 7 local origin, stanza = data.origin, data.stanza; | |
| 8 | |
| 9 local session = full_sessions[stanza.attr.to]; | |
| 10 if session then | |
| 11 -- TODO fire post processing event | |
| 12 session.send(stanza); | |
| 13 return true; | |
| 14 else -- resource not online | |
| 15 -- TODO error reply | |
| 16 end | |
| 17 end); | |
| 18 | |
| 19 module:hook("iq/bare", function(data) | |
| 20 -- IQ to bare JID recieved | |
| 21 local origin, stanza = data.origin, data.stanza; | |
| 22 | |
| 23 -- TODO if not user exists, return an error | |
| 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 | |
| 26 end); | |
| 27 | |
| 28 module:hook("iq/host", function(data) | |
| 29 -- IQ to a local host recieved | |
| 30 local origin, stanza = data.origin, data.stanza; | |
| 31 | |
| 32 -- TODO fire event with the xmlns:tag of the child, or with the id of errors and results | |
| 33 end); |