Comparison

plugins/mod_iq.lua @ 3797:bd92e421728d

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 3788:588904a9fd8b
child 3678:ce04b8b144de
comparison
equal deleted inserted replaced
3796:405231b1cb88 3797:bd92e421728d
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);