mod_welcome: Use module:hook instead of module:add_event_hook
[prosody.git] / plugins / mod_iq.lua
1
2 local full_sessions = full_sessions;
3 local bare_sessions = bare_sessions;
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);