Diff

plugins/mod_admin_telnet.lua @ 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
parent 6176:02d366be7c2f
child 6270:ee2d5b2a263d
child 6312:1940a014aeca
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 = {};