Comparison

plugins/mod_iq.lua @ 1421:7dafb3bae02b

mod_iq: Change sub-event names for IQ errors and results to use stanza IDs
author Waqas Hussain <waqas20@gmail.com>
date Fri, 26 Jun 2009 10:02:46 +0500
parent 1403:a1762cfd4d83
child 1522:569d58d21612
comparison
equal deleted inserted replaced
1420:1576a5aa52f8 1421:7dafb3bae02b
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 module:fire_event("iq/bare/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); 43 module:fire_event("iq/bare/"..stanza.attr.id, data);
44 return true; 44 return true;
45 end 45 end
46 end); 46 end);
47 47
48 module:hook("iq/host", function(data) 48 module:hook("iq/host", function(data)
50 local origin, stanza = data.origin, data.stanza; 50 local origin, stanza = data.origin, data.stanza;
51 51
52 if stanza.attr.type == "get" or stanza.attr.type == "set" then 52 if stanza.attr.type == "get" or stanza.attr.type == "set" then
53 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);
54 else 54 else
55 module:fire_event("iq/host/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); 55 module:fire_event("iq/host/"..stanza.attr.id, data);
56 return true; 56 return true;
57 end 57 end
58 end); 58 end);