Diff

plugins/muc/mod_muc.lua @ 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
parent 7536:3f8520b59677
child 7650:4c2407422f71
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();