Comparison

core/stanza_router.lua @ 9527:ced174f29d9a

stanza_router: Remove deprecation warning for core routing functions from global scope (deprecated in 0.9)
author Kim Alvefur <zash@zash.se>
date Sun, 21 Oct 2018 14:45:22 +0200
parent 9070:21730a3642fe
child 10104:3965081809ba
comparison
equal deleted inserted replaced
9526:9cc1d7efaa80 9527:ced174f29d9a
16 16
17 local full_sessions = _G.prosody.full_sessions; 17 local full_sessions = _G.prosody.full_sessions;
18 local bare_sessions = _G.prosody.bare_sessions; 18 local bare_sessions = _G.prosody.bare_sessions;
19 19
20 local core_post_stanza, core_process_stanza, core_route_stanza; 20 local core_post_stanza, core_process_stanza, core_route_stanza;
21
22 local function deprecated_warning(f)
23 _G[f] = function(...)
24 log("warn", "Using the global %s() is deprecated, use module:send() or prosody.%s(). %s", f, f, debug.traceback());
25 return prosody[f](...);
26 end
27 end
28 deprecated_warning"core_post_stanza";
29 deprecated_warning"core_process_stanza";
30 deprecated_warning"core_route_stanza";
31 21
32 local valid_stanzas = { message = true, presence = true, iq = true }; 22 local valid_stanzas = { message = true, presence = true, iq = true };
33 local function handle_unhandled_stanza(host, origin, stanza) --luacheck: ignore 212/host 23 local function handle_unhandled_stanza(host, origin, stanza) --luacheck: ignore 212/host
34 local name, xmlns, origin_type = stanza.name, stanza.attr.xmlns or "jabber:client", origin.type; 24 local name, xmlns, origin_type = stanza.name, stanza.attr.xmlns or "jabber:client", origin.type;
35 if xmlns == "jabber:client" and valid_stanzas[name] then 25 if xmlns == "jabber:client" and valid_stanzas[name] then