MUC: Restore modern version of public create_room() function removed in dfaacf042cfe
authorKim Alvefur <zash@zash.se>
Tue, 30 Aug 2016 17:54:24 +0200
changeset 7644 5eef792bb2e1
parent 7643 279f348e9a92
child 7650 e9d7a409e236
MUC: Restore modern version of public create_room() function removed in dfaacf042cfe
plugins/muc/mod_muc.lua
--- 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();