Comparison

plugins/mod_iq.lua @ 2686:d0d38fcaade0

mod_iq: Fire sub-events for iq/self events.
author Waqas Hussain <waqas20@gmail.com>
date Sun, 21 Feb 2010 17:43:39 +0500
parent 1522:569d58d21612
child 2925:692b3c6c5bd2
comparison
equal deleted inserted replaced
2685:f9bc95aadc26 2686:d0d38fcaade0
51 module:fire_event("iq/bare/"..stanza.attr.id, data); 51 module:fire_event("iq/bare/"..stanza.attr.id, data);
52 return true; 52 return true;
53 end 53 end
54 end); 54 end);
55 55
56 module:hook("iq/self", function(data)
57 -- IQ to bare JID recieved
58 local origin, stanza = data.origin, data.stanza;
59
60 if stanza.attr.type == "get" or stanza.attr.type == "set" then
61 return module:fire_event("iq/self/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data);
62 else
63 module:fire_event("iq/self/"..stanza.attr.id, data);
64 return true;
65 end
66 end);
67
56 module:hook("iq/host", function(data) 68 module:hook("iq/host", function(data)
57 -- IQ to a local host recieved 69 -- IQ to a local host recieved
58 local origin, stanza = data.origin, data.stanza; 70 local origin, stanza = data.origin, data.stanza;
59 71
60 if stanza.attr.type == "get" or stanza.attr.type == "set" then 72 if stanza.attr.type == "get" or stanza.attr.type == "set" then