Changeset

7641:5eef792bb2e1

MUC: Restore modern version of public create_room() function removed in dfaacf042cfe
author Kim Alvefur <zash@zash.se>
date Tue, 30 Aug 2016 17:54:24 +0200
parents 7640:279f348e9a92
children 7647:e9d7a409e236
files plugins/muc/mod_muc.lua
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua	Tue Aug 30 17:53:57 2016 +0200
+++ b/plugins/muc/mod_muc.lua	Tue Aug 30 17:54:24 2016 +0200
@@ -173,6 +173,18 @@
 	return restore_room(room_jid);
 end
 
+function create_room(room_jid)
+	local exists = get_room_from_jid(room_jid);
+	if exists then
+		return nil, "room-exists";
+	end
+	local room = muclib.new_room(room_jid);
+	module:fire_event("muc-room-created", {
+		room = room;
+	});
+	return room;
+end
+
 function each_room(local_only)
 	if local_only then
 		return rooms:values();