Diff

plugins/mod_admin_telnet.lua @ 6175:50ddaec11f2a

mod_admin_telnet: Show which hosts are components and what type of component in host:list()
author Kim Alvefur <zash@zash.se>
date Mon, 12 May 2014 01:07:40 +0200
parent 6174:513ea94761b2
child 6176:02d366be7c2f
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua	Sun May 11 19:13:36 2014 +0200
+++ b/plugins/mod_admin_telnet.lua	Mon May 12 01:07:40 2014 +0200
@@ -872,9 +872,19 @@
 function def_env.host:list()
 	local print = self.session.print;
 	local i = 0;
+	local type;
 	for host in values(array.collect(keys(prosody.hosts)):sort()) do
 		i = i + 1;
-		print(host);
+		type = hosts[host].type;
+		if type == "local" then
+			print(host);
+		else
+			type = module:context(host):get_option_string("component_module", type);
+			if type ~= "component" then
+				type = type .. " component";
+			end
+			print(("%s (%s)"):format(host, type));
+		end
 	end
 	return true, i.." hosts";
 end