# HG changeset patch # User Matthew Wild # Date 1223084447 -3600 # Node ID 33ed4c6ac24916cb1dc3e39111c66a82cadd8a09 # Parent d6b3f9dbb624e2a54194daaa6dcb539f19a66d56 Fix stanza handlers to use xmlns also for matching diff -r d6b3f9dbb624 -r 33ed4c6ac249 core/modulemanager.lua --- a/core/modulemanager.lua Sat Oct 04 02:15:13 2008 +0100 +++ b/core/modulemanager.lua Sat Oct 04 02:40:47 2008 +0100 @@ -35,14 +35,15 @@ if not (origin_type and tag and xmlns and handler) then return false; end handlers[origin_type] = handlers[origin_type] or {}; if not handlers[origin_type][tag] then - handlers[origin_type][tag]= handler; + handlers[origin_type][tag] = handlers[origin_type][tag] or {}; + handlers[origin_type][tag][xmlns]= handler; handler_info[handler] = getfenv(2).module; log("debug", "mod_%s now handles tag '%s'", getfenv(2).module.name, tag); elseif handler_info[handlers[origin_type][tag]] then log("warning", "mod_%s wants to handle tag '%s' but mod_%s already handles that", getfenv(2).module.name, tag, handler_info[handlers[origin_type][tag]].module.name); end end - + function loadall() load("saslauth"); load("legacyauth"); @@ -85,11 +86,14 @@ elseif handlers[origin_type] then local handler = handlers[origin_type][name]; if handler then - log("debug", "Passing stanza to mod_%s", handler_info[handler].name); - return handler(origin, stanza) or true; + handler = handler[xmlns]; + if handler then + log("debug", "Passing stanza to mod_%s", handler_info[handler].name); + return handler(origin, stanza) or true; + end end end - log("debug", "Stanza unhandled by any modules"); + log("debug", "Stanza unhandled by any modules, xmlns: %s", stanza.attr.xmlns); return false; -- we didn't handle it end