Comparison

plugins/muc/muc.lib.lua @ 7383:69827ee1f951

MUC: Accept missing form as "instant room" request (fixes #377)
author Kim Alvefur <zash@zash.se>
date Tue, 19 Apr 2016 17:20:39 +0200
parent 7011:2d5751b2f21c
child 7385:17929cdacec2
child 8465:0ec72e67f797
comparison
equal deleted inserted replaced
7328:de76ded98b84 7383:69827ee1f951
665 local form; 665 local form;
666 for _, tag in ipairs(query.tags) do if tag.name == "x" and tag.attr.xmlns == "jabber:x:data" then form = tag; break; end end 666 for _, tag in ipairs(query.tags) do if tag.name == "x" and tag.attr.xmlns == "jabber:x:data" then form = tag; break; end end
667 if not form then origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); return; end 667 if not form then origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); return; end
668 if form.attr.type == "cancel" then origin.send(st.reply(stanza)); return; end 668 if form.attr.type == "cancel" then origin.send(st.reply(stanza)); return; end
669 if form.attr.type ~= "submit" then origin.send(st.error_reply(stanza, "cancel", "bad-request", "Not a submitted form")); return; end 669 if form.attr.type ~= "submit" then origin.send(st.error_reply(stanza, "cancel", "bad-request", "Not a submitted form")); return; end
670
671 if form.tags[1] == nil then
672 -- instant room
673 if self.save then self:save(true); end
674 origin.send(st.reply(stanza));
675 return true;
676 end
677
670 678
671 local fields = self:get_form_layout():data(form); 679 local fields = self:get_form_layout():data(form);
672 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; end 680 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; end
673 681
674 local dirty = false 682 local dirty = false