Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
6390:6bd67fba6139 | 6391:4d334d00c635 |
---|---|
612 function room_mt:process_form(origin, stanza) | 612 function room_mt:process_form(origin, stanza) |
613 local form = stanza.tags[1]:get_child("x", "jabber:x:data"); | 613 local form = stanza.tags[1]:get_child("x", "jabber:x:data"); |
614 if form.attr.type == "cancel" then | 614 if form.attr.type == "cancel" then |
615 origin.send(st.reply(stanza)); | 615 origin.send(st.reply(stanza)); |
616 elseif form.attr.type == "submit" then | 616 elseif form.attr.type == "submit" then |
617 local fields = self:get_form_layout(stanza.attr.from):data(form); | 617 local fields; |
618 if fields.FORM_TYPE ~= "http://jabber.org/protocol/muc#roomconfig" then | 618 if form.tags[1] == nil then -- Instant room |
619 origin.send(st.error_reply(stanza, "cancel", "bad-request", "Form is not of type room configuration")); | 619 fields = {}; |
620 return true; | 620 else |
621 fields = self:get_form_layout(stanza.attr.from):data(form); | |
622 if fields.FORM_TYPE ~= "http://jabber.org/protocol/muc#roomconfig" then | |
623 origin.send(st.error_reply(stanza, "cancel", "bad-request", "Form is not of type room configuration")); | |
624 return true; | |
625 end | |
621 end | 626 end |
622 | 627 |
623 local event = {room = self; origin = origin; stanza = stanza; fields = fields; status_codes = {};}; | 628 local event = {room = self; origin = origin; stanza = stanza; fields = fields; status_codes = {};}; |
624 function event.update_option(name, field, allowed) | 629 function event.update_option(name, field, allowed) |
625 local new = fields[field]; | 630 local new = fields[field]; |