Diff

plugins/muc/muc.lib.lua @ 6391:4d334d00c635

plugins/muc/muc.lib: Add instant room support
author daurnimator <quae@daurnimator.com>
date Fri, 05 Sep 2014 11:19:16 -0400
parent 6318:e5e7a789ef55
child 6392:8528d1da461f
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Fri Sep 05 09:04:37 2014 +0100
+++ b/plugins/muc/muc.lib.lua	Fri Sep 05 11:19:16 2014 -0400
@@ -614,10 +614,15 @@
 	if form.attr.type == "cancel" then
 		origin.send(st.reply(stanza));
 	elseif form.attr.type == "submit" then
-		local fields = self:get_form_layout(stanza.attr.from):data(form);
-		if fields.FORM_TYPE ~= "http://jabber.org/protocol/muc#roomconfig" then
-			origin.send(st.error_reply(stanza, "cancel", "bad-request", "Form is not of type room configuration"));
-			return true;
+		local fields;
+		if form.tags[1] == nil then -- Instant room
+			fields = {};
+		else
+			fields = self:get_form_layout(stanza.attr.from):data(form);
+			if fields.FORM_TYPE ~= "http://jabber.org/protocol/muc#roomconfig" then
+				origin.send(st.error_reply(stanza, "cancel", "bad-request", "Form is not of type room configuration"));
+				return true;
+			end
 		end
 
 		local event = {room = self; origin = origin; stanza = stanza; fields = fields; status_codes = {};};