Comparison

core/stanza_router.lua @ 5012:d59c842fe38e

stanza_router: Warn if the global core_*_stanza() functions are called
author Kim Alvefur <zash@zash.se>
date Thu, 26 Jul 2012 04:30:30 +0200
parent 4919:6cbc35cdefaf
child 5776:bd0ff8ae98a8
child 6401:e3de64f7c44d
comparison
equal deleted inserted replaced
5011:83b4d3727b4f 5012:d59c842fe38e
14 local jid_split = require "util.jid".split; 14 local jid_split = require "util.jid".split;
15 local jid_prepped_split = require "util.jid".prepped_split; 15 local jid_prepped_split = require "util.jid".prepped_split;
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
20 local core_post_stanza, core_process_stanza, core_route_stanza;
21
22 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";
19 31
20 local function handle_unhandled_stanza(host, origin, stanza) 32 local function handle_unhandled_stanza(host, origin, stanza)
21 local name, xmlns, origin_type = stanza.name, stanza.attr.xmlns or "jabber:client", origin.type; 33 local name, xmlns, origin_type = stanza.name, stanza.attr.xmlns or "jabber:client", origin.type;
22 if name == "iq" and xmlns == "jabber:client" then 34 if name == "iq" and xmlns == "jabber:client" then
23 if stanza.attr.type == "get" or stanza.attr.type == "set" then 35 if stanza.attr.type == "get" or stanza.attr.type == "set" then