Changeset

5520:75230be5be58

mod_admin_telnet: Add muc:create(room) (thanks SkyBlue)
author Matthew Wild <mwild1@gmail.com>
date Thu, 25 Apr 2013 20:37:20 +0100
parents 5519:06e188268df1
children 5521:076534a0384a 5522:3912c9264ef0
files plugins/mod_admin_telnet.lua
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua	Thu Apr 25 20:36:55 2013 +0100
+++ b/plugins/mod_admin_telnet.lua	Thu Apr 25 20:37:20 2013 +0100
@@ -903,13 +903,23 @@
 	end;
 };
 
-function def_env.muc:room(room_jid)
-	local room_name, host = jid_split(room_jid);
+local function check_muc(jid)
+	local room_name, host = jid_split(jid);
 	if not hosts[host] then
 		return nil, "No such host: "..host;
 	elseif not hosts[host].modules.muc then
 		return nil, "Host '"..host.."' is not a MUC service";
 	end
+	return room_name, host;
+end
+
+function def_env.muc:create(room_jid)
+	local room, host = check_muc(room_jid);
+	return hosts[host].modules.muc.create_room(room_jid);
+end
+
+function def_env.muc:room(room_jid)
+	local room_name, host = check_muc(room_jid);
 	local room_obj = hosts[host].modules.muc.rooms[room_jid];
 	if not room_obj then
 		return nil, "No such room: "..room_jid;