Changeset

4518:f2d695d2e31e

Merge 0.9->trunk
author Matthew Wild <mwild1@gmail.com>
date Fri, 09 Mar 2012 18:46:19 +0000
parents 4512:eb97612bf42b (current diff) 4517:2e274e088ddc (diff)
children 4519:510f4ba7080f
files core/s2smanager.lua
diffstat 2 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/core/s2smanager.lua	Sat Feb 25 17:21:15 2012 +0000
+++ b/core/s2smanager.lua	Fri Mar 09 18:46:19 2012 +0000
@@ -549,7 +549,7 @@
 		session.from_host = attr.from and nameprep(attr.from);
 	
 		session.streamid = uuid_gen();
-		(session.log or log)("debug", "Incoming s2s received <stream:stream>");
+		(session.log or log)("debug", "Incoming s2s received %s", st.stanza("stream:stream", attr):top_tag());
 		if session.to_host then
 			if not hosts[session.to_host] then
 				-- Attempting to connect to a host we don't serve
--- a/plugins/mod_admin_telnet.lua	Sat Feb 25 17:21:15 2012 +0000
+++ b/plugins/mod_admin_telnet.lua	Fri Mar 09 18:46:19 2012 +0000
@@ -487,6 +487,24 @@
 	return true, "Total: "..count.." sessions closed";
 end
 
+local function session_flags(session, line)
+	if session.cert_identity_status == "valid" then
+		line[#line+1] = "(secure)";
+	elseif session.secure then
+		line[#line+1] = "(encrypted)";
+	end
+	if session.compressed then
+		line[#line+1] = "(compressed)";
+	end
+	if session.smacks then
+		line[#line+1] = "(sm)";
+	end
+	if session.conn and session.conn:ip():match(":") then
+		line[#line+1] = "(IPv6)";
+	end
+	return table.concat(line, " ");
+end
+
 def_env.s2s = {};
 function def_env.s2s:show(match_jid)
 	local _print = self.session.print;
@@ -499,7 +517,7 @@
 		for remotehost, session in pairs(host_session.s2sout) do
 			if (not match_jid) or remotehost:match(match_jid) or host:match(match_jid) then
 				count_out = count_out + 1;
-				print("    "..host.." -> "..remotehost..(session.cert_identity_status == "valid" and " (secure)" or "")..(session.secure and " (encrypted)" or "")..(session.compressed and " (compressed)" or ""));
+				print(session_flags(session, {"   ", host, "->", remotehost}));
 				if session.sendq then
 					print("        There are "..#session.sendq.." queued outgoing stanzas for this connection");
 				end
@@ -536,7 +554,7 @@
 				-- Pft! is what I say to list comprehensions
 				or (session.hosts and #array.collect(keys(session.hosts)):filter(subhost_filter)>0)) then
 				count_in = count_in + 1;
-				print("    "..host.." <- "..(session.from_host or "(unknown)")..(session.cert_identity_status == "valid" and " (secure)" or "")..(session.secure and " (encrypted)" or "")..(session.compressed and " (compressed)" or ""));
+				print(session_flags(session, {"   ", host, "<-", session.from_host or "(unknown)"}));
 				if session.type == "s2sin_unauthed" then
 						print("        Connection not yet authenticated");
 				end