Diff

plugins/mod_admin_telnet.lua @ 5011:83b4d3727b4f

mod_admin_telnet: Add xmpp:ping(from, to), useful for initiating s2s connections
author Kim Alvefur <zash@zash.se>
date Thu, 26 Jul 2012 02:27:24 +0200
parent 5007:76f957b44cf7
child 5013:ab693eea0869
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua	Wed Jul 25 20:33:20 2012 +0200
+++ b/plugins/mod_admin_telnet.lua	Thu Jul 26 02:27:24 2012 +0200
@@ -934,6 +934,20 @@
 	end
 end
 
+def_env.xmpp = {};
+
+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"}));
+		return true, "Sent ping";
+	else
+		return nil, "No such host";
+	end
+end
+
 -------------
 
 function printbanner(session)