Software /
code /
prosody
Comparison
core/modulemanager.lua @ 3539:8bbd965267b2
modulemanager, stanza_router: Moved modulemanager.handle_stanza to stanza_router, as a local function handle_unhandled_stanza. modulemanager is no longer a dependency of stanza_router.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sat, 16 Oct 2010 08:34:32 +0500 |
parent | 3538:3ea38f44420c |
child | 3587:d94aacb2771a |
comparison
equal
deleted
inserted
replaced
3538:3ea38f44420c | 3539:8bbd965267b2 |
---|---|
247 return true; | 247 return true; |
248 end | 248 end |
249 return ok, err; | 249 return ok, err; |
250 end | 250 end |
251 | 251 |
252 function handle_stanza(host, origin, stanza) | |
253 local name, xmlns, origin_type = stanza.name, stanza.attr.xmlns or "jabber:client", origin.type; | |
254 if name == "iq" and xmlns == "jabber:client" then | |
255 if stanza.attr.type == "get" or stanza.attr.type == "set" then | |
256 xmlns = stanza.tags[1].attr.xmlns or "jabber:client"; | |
257 log("debug", "Stanza of type %s from %s has xmlns: %s", name, origin_type, xmlns); | |
258 else | |
259 log("debug", "Discarding %s from %s of type: %s", name, origin_type, stanza.attr.type); | |
260 return true; | |
261 end | |
262 end | |
263 if stanza.attr.xmlns == nil then | |
264 log("debug", "Unhandled %s stanza: %s; xmlns=%s", origin.type, stanza.name, xmlns); -- we didn't handle it | |
265 if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then | |
266 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); | |
267 end | |
268 elseif not((name == "features" or name == "error") and xmlns == "http://etherx.jabber.org/streams") then -- FIXME remove check once we handle S2S features | |
269 log("warn", "Unhandled %s stream element: %s; xmlns=%s: %s", origin.type, stanza.name, xmlns, tostring(stanza)); -- we didn't handle it | |
270 origin:close("unsupported-stanza-type"); | |
271 end | |
272 end | |
273 | |
274 function module_has_method(module, method) | 252 function module_has_method(module, method) |
275 return type(module.module[method]) == "function"; | 253 return type(module.module[method]) == "function"; |
276 end | 254 end |
277 | 255 |
278 function call_module_method(module, method, ...) | 256 function call_module_method(module, method, ...) |