Changeset

6260:6986ca575568

mod_admin_telnet: Add command to list MUC rooms
author Matthew Wild <mwild1@gmail.com>
date Wed, 28 May 2014 12:43:34 +0100
parents 6259:36f611624987
children 6261:be8eab694d6c 6281:8dc01fa767e0
files plugins/mod_admin_telnet.lua
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua	Sat May 24 11:17:26 2014 +0200
+++ b/plugins/mod_admin_telnet.lua	Wed May 28 12:43:34 2014 +0100
@@ -964,6 +964,19 @@
 	return setmetatable({ room = room_obj }, console_room_mt);
 end
 
+function def_env.muc:list(host)
+	local host_session = hosts[host];
+	if not host_session or not host_session.modules.muc then
+		return nil, "Please supply the address of a local MUC component";
+	end
+	local c = 0;
+	for name in keys(host_session.modules.muc.rooms) do
+		print(name);
+		c = c + 1;
+	end
+	return true, c.." rooms";
+end
+
 local um = require"core.usermanager";
 
 def_env.user = {};