Comparison

plugins/mod_iq.lua @ 3647:140ce81778ca

mod_iq: IQ error and result sub-events are now "iq-{error,result}/{host,self,bare}/id" (previously "iq/{host,self,bare}/id").
author Waqas Hussain <waqas20@gmail.com>
date Sun, 28 Nov 2010 02:03:59 +0500
parent 3131:5c116a10ff0b
child 3656:71fd1582f01b
comparison
equal deleted inserted replaced
3646:66c5fb109e64 3647:140ce81778ca
35 35
36 -- TODO fire post processing events 36 -- TODO fire post processing events
37 if stanza.attr.type == "get" or stanza.attr.type == "set" then 37 if stanza.attr.type == "get" or stanza.attr.type == "set" then
38 return module:fire_event("iq/bare/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); 38 return module:fire_event("iq/bare/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data);
39 else 39 else
40 module:fire_event("iq/bare/"..stanza.attr.id, data); 40 module:fire_event("iq-"..stanza.attr.type.."/bare/"..stanza.attr.id, data);
41 return true; 41 return true;
42 end 42 end
43 end); 43 end);
44 44
45 module:hook("iq/self", function(data) 45 module:hook("iq/self", function(data)
47 local origin, stanza = data.origin, data.stanza; 47 local origin, stanza = data.origin, data.stanza;
48 48
49 if stanza.attr.type == "get" or stanza.attr.type == "set" then 49 if stanza.attr.type == "get" or stanza.attr.type == "set" then
50 return module:fire_event("iq/self/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); 50 return module:fire_event("iq/self/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data);
51 else 51 else
52 module:fire_event("iq/self/"..stanza.attr.id, data); 52 module:fire_event("iq-"..stanza.attr.type.."/self/"..stanza.attr.id, data);
53 return true; 53 return true;
54 end 54 end
55 end); 55 end);
56 56
57 module:hook("iq/host", function(data) 57 module:hook("iq/host", function(data)
59 local origin, stanza = data.origin, data.stanza; 59 local origin, stanza = data.origin, data.stanza;
60 60
61 if stanza.attr.type == "get" or stanza.attr.type == "set" then 61 if stanza.attr.type == "get" or stanza.attr.type == "set" then
62 return module:fire_event("iq/host/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); 62 return module:fire_event("iq/host/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data);
63 else 63 else
64 module:fire_event("iq/host/"..stanza.attr.id, data); 64 module:fire_event("iq-"..stanza.attr.type.."/host/"..stanza.attr.id, data);
65 return true; 65 return true;
66 end 66 end
67 end); 67 end);