Software / code / prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
| 6174:513ea94761b2 | 6175:50ddaec11f2a |
|---|---|
| 870 end | 870 end |
| 871 | 871 |
| 872 function def_env.host:list() | 872 function def_env.host:list() |
| 873 local print = self.session.print; | 873 local print = self.session.print; |
| 874 local i = 0; | 874 local i = 0; |
| 875 local type; | |
| 875 for host in values(array.collect(keys(prosody.hosts)):sort()) do | 876 for host in values(array.collect(keys(prosody.hosts)):sort()) do |
| 876 i = i + 1; | 877 i = i + 1; |
| 877 print(host); | 878 type = hosts[host].type; |
| 879 if type == "local" then | |
| 880 print(host); | |
| 881 else | |
| 882 type = module:context(host):get_option_string("component_module", type); | |
| 883 if type ~= "component" then | |
| 884 type = type .. " component"; | |
| 885 end | |
| 886 print(("%s (%s)"):format(host, type)); | |
| 887 end | |
| 878 end | 888 end |
| 879 return true, i.." hosts"; | 889 return true, i.." hosts"; |
| 880 end | 890 end |
| 881 | 891 |
| 882 def_env.port = {}; | 892 def_env.port = {}; |