Comparison

core/modulemanager.lua @ 300:0ebf2ef5124e

If iq child element has no xmlns, use parent's
author Matthew Wild <mwild1@gmail.com>
date Sat, 15 Nov 2008 23:10:41 +0000
parent 229:01bd24ea488d
child 385:c064117c9357
comparison
equal deleted inserted replaced
299:300b5a201ad3 300:0ebf2ef5124e
8 local type = type; 8 local type = type;
9 9
10 local tostring, print = tostring, print; 10 local tostring, print = tostring, print;
11 11
12 local _G = _G; 12 local _G = _G;
13 local debug = debug;
13 14
14 module "modulemanager" 15 module "modulemanager"
15 16
16 local handler_info = {}; 17 local handler_info = {};
17 local handlers = {}; 18 local handlers = {};
87 88
88 if name == "iq" and xmlns == "jabber:client" and handlers[origin_type] then 89 if name == "iq" and xmlns == "jabber:client" and handlers[origin_type] then
89 log("debug", "Stanza is an <iq/>"); 90 log("debug", "Stanza is an <iq/>");
90 local child = stanza.tags[1]; 91 local child = stanza.tags[1];
91 if child then 92 if child then
92 local xmlns = child.attr.xmlns; 93 local xmlns = child.attr.xmlns or xmlns;
93 log("debug", "Stanza has xmlns: %s", xmlns); 94 log("debug", "Stanza of type %s from %s has xmlns: %s", name, origin_type, xmlns);
94 local handler = handlers[origin_type][name][xmlns]; 95 local handler = handlers[origin_type][name][xmlns];
95 if handler then 96 if handler then
96 log("debug", "Passing stanza to mod_%s", handler_info[handler].name); 97 log("debug", "Passing stanza to mod_%s", handler_info[handler].name);
97 return handler(origin, stanza) or true; 98 return handler(origin, stanza) or true;
98 end 99 end
99
100 end 100 end
101 elseif handlers[origin_type] then 101 elseif handlers[origin_type] then
102 local handler = handlers[origin_type][name]; 102 local handler = handlers[origin_type][name];
103 if handler then 103 if handler then
104 handler = handler[xmlns]; 104 handler = handler[xmlns];