Changeset

2007:b89d61db74d1

mod_console: Add missing hosts:list() command
author Matthew Wild <mwild1@gmail.com>
date Sun, 18 Oct 2009 12:26:53 +0100
parents 2006:0c62bed9d338
children 2008:6b6b924ee558
files plugins/mod_console.lua
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_console.lua	Sun Oct 18 15:53:08 2009 +0500
+++ b/plugins/mod_console.lua	Sun Oct 18 12:26:53 2009 +0100
@@ -600,6 +600,16 @@
 	return true, "Host "..tostring(hostname).." deactivated";
 end
 
+function def_env.host:list()
+	local print = self.session.print;
+	local i = 0;
+	for host in values(array.collect(keys(prosody.hosts)):sort()) do
+		i = i + 1;
+		print(host);
+	end
+	return true, i.." hosts";
+end
+
 -------------
 
 function printbanner(session)