MUC: Return error if unable to keep track of room due to storage failure
authorKim Alvefur <zash@zash.se>
Wed, 07 Mar 2018 17:53:52 +0100
changeset 8663 3b54f8472b51
parent 8662 4006755c1097
child 8664 7fc0784491ef
MUC: Return error if unable to keep track of room due to storage failure
plugins/muc/mod_muc.lua
--- a/plugins/muc/mod_muc.lua	Fri Mar 16 21:59:41 2018 +0100
+++ b/plugins/muc/mod_muc.lua	Wed Mar 07 17:53:52 2018 +0100
@@ -253,8 +253,12 @@
 	end
 end);
 
-module:hook("muc-room-created", function(event)
-	track_room(event.room);
+module:hook("muc-room-pre-create", function(event)
+	local origin, stanza = event.origin, event.stanza;
+	if not track_room(event.room) then
+		origin.send(st.error_reply(stanza, "wait", "resource-constraint"));
+		return true;
+	end
 end, -1000);
 
 module:hook("muc-room-destroyed",function(event)