Changeset

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
parents 5010:2f8f388de516
children 5012:d59c842fe38e
files plugins/mod_admin_telnet.lua
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
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)