Comparison

plugins/mod_iq.lua @ 1266:605a73234230

mod_iq: Include event data in sub-events
author Waqas Hussain <waqas20@gmail.com>
date Mon, 01 Jun 2009 10:27:47 +0500
parent 1265:3f3c62e45eeb
child 1267:1bf897de6c24
comparison
equal deleted inserted replaced
1265:3f3c62e45eeb 1266:605a73234230
25 local origin, stanza = data.origin, data.stanza; 25 local origin, stanza = data.origin, data.stanza;
26 26
27 -- TODO if not user exists, return an error 27 -- TODO if not user exists, return an error
28 -- TODO fire post processing events 28 -- TODO fire post processing events
29 if #stanza.tags == 1 then 29 if #stanza.tags == 1 then
30 return module:fire_event("iq/bare/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name); 30 return module:fire_event("iq/bare/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data);
31 else 31 else
32 return true; -- TODO do something with results and errors 32 return true; -- TODO do something with results and errors
33 end 33 end
34 end); 34 end);
35 35
36 module:hook("iq/host", function(data) 36 module:hook("iq/host", function(data)
37 -- IQ to a local host recieved 37 -- IQ to a local host recieved
38 local origin, stanza = data.origin, data.stanza; 38 local origin, stanza = data.origin, data.stanza;
39 39
40 if #stanza.tags == 1 then 40 if #stanza.tags == 1 then
41 return module:fire_event("iq/host/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name); 41 return module:fire_event("iq/host/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data);
42 else 42 else
43 return true; -- TODO do something with results and errors 43 return true; -- TODO do something with results and errors
44 end 44 end
45 end); 45 end);