MUC: Remove support for GC 1.0 during room creation
authorKim Alvefur <zash@zash.se>
Fri, 09 Mar 2018 19:02:10 +0100
changeset 8916 560419b759c8
parent 8915 43806beda970
child 8917 e9acb928c637
MUC: Remove support for GC 1.0 during room creation
plugins/muc/muc.lib.lua
--- a/plugins/muc/muc.lib.lua	Fri Mar 09 18:23:03 2018 +0100
+++ b/plugins/muc/muc.lib.lua	Fri Mar 09 19:02:10 2018 +0100
@@ -378,16 +378,6 @@
 	return true;
 end
 
-if not module:get_option_boolean("muc_compat_create", true) then
-	module:hook("muc-room-pre-create", function(event)
-		local origin, stanza = event.origin, event.stanza;
-		if not stanza:get_child("x", "http://jabber.org/protocol/muc") then
-			origin.send(st.error_reply(stanza, "cancel", "item-not-found"));
-			return true;
-		end
-	end, -1);
-end
-
 -- Give the room creator owner affiliation
 module:hook("muc-room-pre-create", function(event)
 	event.room:set_affiliation(true, jid_bare(event.stanza.attr.from), "owner");
@@ -406,6 +396,13 @@
 end, -10);
 
 function room_mt:handle_first_presence(origin, stanza)
+	if not stanza:get_child("x", "http://jabber.org/protocol/muc") then
+		module:log("debug", "Room creation without <x>, possibly desynced");
+
+		origin.send(st.error_reply(stanza, "cancel", "item-not-found"));
+		return true;
+	end
+
 	local real_jid = stanza.attr.from;
 	local dest_jid = stanza.attr.to;
 	local bare_jid = jid_bare(real_jid);
@@ -417,11 +414,6 @@
 	local is_first_dest_session = true;
 	local dest_occupant = self:new_occupant(bare_jid, dest_jid);
 
-	-- TODO Handle this case sensibly
-	if not stanza:get_child("x", "http://jabber.org/protocol/muc") then
-		module:log("debug", "Room creation without <x>, possibly desynced");
-	end
-
 	local orig_nick = dest_occupant.nick;
 	if module:fire_event("muc-occupant-pre-join", {
 		room = self;