Software /
code /
prosody
Comparison
plugins/mod_iq.lua @ 1288:d2dc0954ebfd
mod_iq: Limit sub-events to get and set IQs
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Tue, 02 Jun 2009 20:18:02 +0500 |
parent | 1268:dc1f95b37024 |
child | 1403:a1762cfd4d83 |
comparison
equal
deleted
inserted
replaced
1287:ac82c7b9c76b | 1288:d2dc0954ebfd |
---|---|
35 end | 35 end |
36 return true; | 36 return true; |
37 end | 37 end |
38 end | 38 end |
39 -- TODO fire post processing events | 39 -- TODO fire post processing events |
40 if #stanza.tags == 1 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 return true; -- TODO do something with results and errors | 43 return true; -- TODO do something with results and errors |
44 end | 44 end |
45 end); | 45 end); |
46 | 46 |
47 module:hook("iq/host", function(data) | 47 module:hook("iq/host", function(data) |
48 -- IQ to a local host recieved | 48 -- IQ to a local host recieved |
49 local origin, stanza = data.origin, data.stanza; | 49 local origin, stanza = data.origin, data.stanza; |
50 | 50 |
51 if #stanza.tags == 1 then | 51 if stanza.attr.type == "get" or stanza.attr.type == "set" then |
52 return module:fire_event("iq/host/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); | 52 return module:fire_event("iq/host/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data); |
53 else | 53 else |
54 return true; -- TODO do something with results and errors | 54 return true; -- TODO do something with results and errors |
55 end | 55 end |
56 end); | 56 end); |