Changeset

6171:c69fca37f338

mod_admin_telnet: Move extraction of c2s presence info into session_flags()
author Kim Alvefur <zash@zash.se>
date Sun, 11 May 2014 19:03:23 +0200
parents 6170:1dff425ffe84
children 6172:0205b97bb355
files plugins/mod_admin_telnet.lua
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua	Sun May 11 18:28:00 2014 +0200
+++ b/plugins/mod_admin_telnet.lua	Sun May 11 19:03:23 2014 +0200
@@ -492,6 +492,13 @@
 
 local function session_flags(session, line)
 	line = line or {};
+	if session.type == "c2s" then
+		local status, priority = "unavailable", tostring(session.priority or "-");
+		if session.presence then
+			status = session.presence:get_child_text("show") or "available";
+		end
+		line[#line+1] = status.."("..priority..")";
+	end
 	if session.cert_identity_status == "valid" then
 		line[#line+1] = "(authenticated)";
 	end
@@ -543,11 +550,7 @@
 		end
 		if (not match_jid) or jid:match(match_jid) then
 			count = count + 1;
-			local status, priority = "unavailable", tostring(session.priority or "-");
-			if session.presence then
-				status = session.presence:get_child_text("show") or "available";
-			end
-			print(session_flags(session, { "   "..jid.." - "..status.."("..priority..")" }));
+			print(session_flags(session, { "  ", jid }));
 		end
 	end);
 	return true, "Total: "..count.." clients";