Comparison

plugins/mod_iq.lua @ 3673:43b854062206

mod_iq: Don't stop event dispatch for unhandled IQ errors and results (this lets negative priority handlers intercept the events).
author Waqas Hussain <waqas20@gmail.com>
date Thu, 02 Dec 2010 16:04:42 +0500
parent 3658:13600f0d56b5
child 3678:ce04b8b144de
comparison
equal deleted inserted replaced
3672:b24db47995ac 3673:43b854062206
39 local child = stanza.tags[1]; 39 local child = stanza.tags[1];
40 local ret = module:fire_event("iq/bare/"..child.attr.xmlns..":"..child.name, data); 40 local ret = module:fire_event("iq/bare/"..child.attr.xmlns..":"..child.name, data);
41 if ret ~= nil then return ret; end 41 if ret ~= nil then return ret; end
42 return module:fire_event("iq-"..type.."/bare/"..child.attr.xmlns..":"..child.name, data); 42 return module:fire_event("iq-"..type.."/bare/"..child.attr.xmlns..":"..child.name, data);
43 else 43 else
44 module:fire_event("iq-"..type.."/bare/"..stanza.attr.id, data); 44 return module:fire_event("iq-"..type.."/bare/"..stanza.attr.id, data);
45 return true;
46 end 45 end
47 end); 46 end);
48 47
49 module:hook("iq/self", function(data) 48 module:hook("iq/self", function(data)
50 -- IQ to self JID recieved 49 -- IQ to self JID recieved
55 local child = stanza.tags[1]; 54 local child = stanza.tags[1];
56 local ret = module:fire_event("iq/self/"..child.attr.xmlns..":"..child.name, data); 55 local ret = module:fire_event("iq/self/"..child.attr.xmlns..":"..child.name, data);
57 if ret ~= nil then return ret; end 56 if ret ~= nil then return ret; end
58 return module:fire_event("iq-"..type.."/self/"..child.attr.xmlns..":"..child.name, data); 57 return module:fire_event("iq-"..type.."/self/"..child.attr.xmlns..":"..child.name, data);
59 else 58 else
60 module:fire_event("iq-"..type.."/self/"..stanza.attr.id, data); 59 return module:fire_event("iq-"..type.."/self/"..stanza.attr.id, data);
61 return true;
62 end 60 end
63 end); 61 end);
64 62
65 module:hook("iq/host", function(data) 63 module:hook("iq/host", function(data)
66 -- IQ to a local host recieved 64 -- IQ to a local host recieved
71 local child = stanza.tags[1]; 69 local child = stanza.tags[1];
72 local ret = module:fire_event("iq/host/"..child.attr.xmlns..":"..child.name, data); 70 local ret = module:fire_event("iq/host/"..child.attr.xmlns..":"..child.name, data);
73 if ret ~= nil then return ret; end 71 if ret ~= nil then return ret; end
74 return module:fire_event("iq-"..type.."/host/"..child.attr.xmlns..":"..child.name, data); 72 return module:fire_event("iq-"..type.."/host/"..child.attr.xmlns..":"..child.name, data);
75 else 73 else
76 module:fire_event("iq-"..type.."/host/"..stanza.attr.id, data); 74 return module:fire_event("iq-"..type.."/host/"..stanza.attr.id, data);
77 return true;
78 end 75 end
79 end); 76 end);