Software /
code /
prosody
Comparison
plugins/mod_iq.lua @ 4870:ca39f9b4cc8e
mod_iq: Use "jabber:client" when the stanza payload namespace is nil.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sat, 12 May 2012 21:39:30 +0500 |
parent | 4760:55501fc4394b |
child | 4966:073eff2853a1 |
comparison
equal
deleted
inserted
replaced
4869:1fac86aab90b | 4870:ca39f9b4cc8e |
---|---|
35 local type = stanza.attr.type; | 35 local type = stanza.attr.type; |
36 | 36 |
37 -- TODO fire post processing events | 37 -- TODO fire post processing events |
38 if type == "get" or type == "set" then | 38 if type == "get" or type == "set" then |
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 xmlns = child.attr.xmlns or "jabber:client"; |
41 local ret = module:fire_event("iq/bare/"..xmlns..":"..child.name, data); | |
41 if ret ~= nil then return ret; end | 42 if ret ~= nil then return ret; end |
42 return module:fire_event("iq-"..type.."/bare/"..child.attr.xmlns..":"..child.name, data); | 43 return module:fire_event("iq-"..type.."/bare/"..xmlns..":"..child.name, data); |
43 else | 44 else |
44 return module:fire_event("iq-"..type.."/bare/"..stanza.attr.id, data); | 45 return module:fire_event("iq-"..type.."/bare/"..stanza.attr.id, data); |
45 end | 46 end |
46 end); | 47 end); |
47 | 48 |
50 local stanza = data.stanza; | 51 local stanza = data.stanza; |
51 local type = stanza.attr.type; | 52 local type = stanza.attr.type; |
52 | 53 |
53 if type == "get" or type == "set" then | 54 if type == "get" or type == "set" then |
54 local child = stanza.tags[1]; | 55 local child = stanza.tags[1]; |
55 local ret = module:fire_event("iq/self/"..child.attr.xmlns..":"..child.name, data); | 56 local xmlns = child.attr.xmlns or "jabber:client"; |
57 local ret = module:fire_event("iq/self/"..xmlns..":"..child.name, data); | |
56 if ret ~= nil then return ret; end | 58 if ret ~= nil then return ret; end |
57 return module:fire_event("iq-"..type.."/self/"..child.attr.xmlns..":"..child.name, data); | 59 return module:fire_event("iq-"..type.."/self/"..xmlns..":"..child.name, data); |
58 else | 60 else |
59 return module:fire_event("iq-"..type.."/self/"..stanza.attr.id, data); | 61 return module:fire_event("iq-"..type.."/self/"..stanza.attr.id, data); |
60 end | 62 end |
61 end); | 63 end); |
62 | 64 |
65 local stanza = data.stanza; | 67 local stanza = data.stanza; |
66 local type = stanza.attr.type; | 68 local type = stanza.attr.type; |
67 | 69 |
68 if type == "get" or type == "set" then | 70 if type == "get" or type == "set" then |
69 local child = stanza.tags[1]; | 71 local child = stanza.tags[1]; |
70 local ret = module:fire_event("iq/host/"..child.attr.xmlns..":"..child.name, data); | 72 local xmlns = child.attr.xmlns or "jabber:client"; |
73 local ret = module:fire_event("iq/host/"..xmlns..":"..child.name, data); | |
71 if ret ~= nil then return ret; end | 74 if ret ~= nil then return ret; end |
72 return module:fire_event("iq-"..type.."/host/"..child.attr.xmlns..":"..child.name, data); | 75 return module:fire_event("iq-"..type.."/host/"..xmlns..":"..child.name, data); |
73 else | 76 else |
74 return module:fire_event("iq-"..type.."/host/"..stanza.attr.id, data); | 77 return module:fire_event("iq-"..type.."/host/"..stanza.attr.id, data); |
75 end | 78 end |
76 end); | 79 end); |