mod_admin_telnet: Use the module:send() API for xmpp:ping command
authorKim Alvefur <zash@zash.se>
Fri, 18 Nov 2016 14:08:38 +0100
changeset 7725 82333dfdfaff
parent 7724 92f771147de8
child 7726 488fddf88ffd
child 7729 29c20eefa306
mod_admin_telnet: Use the module:send() API for xmpp:ping command
plugins/mod_admin_telnet.lua
--- a/plugins/mod_admin_telnet.lua	Fri Nov 18 10:21:02 2016 +0100
+++ b/plugins/mod_admin_telnet.lua	Fri Nov 18 14:08:38 2016 +0100
@@ -32,7 +32,6 @@
 local commands = module:shared("commands")
 local def_env = module:shared("env");
 local default_env_mt = { __index = def_env };
-local core_post_stanza = prosody.core_post_stanza;
 
 local function redirect_output(_G, session)
 	local env = setmetatable({ print = session.print }, { __index = function (t, k) return rawget(_G, k); end });
@@ -1062,9 +1061,8 @@
 local st = require "util.stanza";
 function def_env.xmpp:ping(localhost, remotehost)
 	if hosts[localhost] then
-		core_post_stanza(hosts[localhost],
-			st.iq{ from=localhost, to=remotehost, type="get", id="ping" }
-				:tag("ping", {xmlns="urn:xmpp:ping"}));
+		module:send(st.iq{ from=localhost, to=remotehost, type="get", id="ping" }
+				:tag("ping", {xmlns="urn:xmpp:ping"}), hosts[localhost]);
 		return true, "Sent ping";
 	else
 		return nil, "No such host";