Comparison

plugins/mod_iq.lua @ 1403:a1762cfd4d83

mod_iq: Fire sub-events for IQ results and errors
author Waqas Hussain <waqas20@gmail.com>
date Wed, 24 Jun 2009 20:05:17 +0500
parent 1288:d2dc0954ebfd
child 1421:7dafb3bae02b
comparison
equal deleted inserted replaced
1402:34723bbd5acb 1403:a1762cfd4d83
38 end 38 end
39 -- TODO fire post processing events 39 -- TODO fire post processing events
40 if stanza.attr.type == "get" or stanza.attr.type == "set" then 40 if stanza.attr.type == "get" or stanza.attr.type == "set" then
41 return module:fire_event("iq/bare/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); 41 return module:fire_event("iq/bare/"..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 module:fire_event("iq/bare/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data);
44 return true;
44 end 45 end
45 end); 46 end);
46 47
47 module:hook("iq/host", function(data) 48 module:hook("iq/host", function(data)
48 -- IQ to a local host recieved 49 -- IQ to a local host recieved
49 local origin, stanza = data.origin, data.stanza; 50 local origin, stanza = data.origin, data.stanza;
50 51
51 if stanza.attr.type == "get" or stanza.attr.type == "set" then 52 if stanza.attr.type == "get" or stanza.attr.type == "set" then
52 return module:fire_event("iq/host/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); 53 return module:fire_event("iq/host/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data);
53 else 54 else
54 return true; -- TODO do something with results and errors 55 module:fire_event("iq/host/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data);
56 return true;
55 end 57 end
56 end); 58 end);