diff options
author | Waqas Hussain <waqas20@gmail.com> | 2010-06-13 20:52:37 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2010-06-13 20:52:37 +0500 |
commit | 90093c2b5523c36009abf00a45e4365359b3a7c1 (patch) | |
tree | 30f58467ed706527febe6f639c51452106e784ea /plugins/muc | |
parent | 5d7f3a03ff16f1daeb4b2fe96475d9e5c1cbbcc9 (diff) | |
download | prosody-90093c2b5523c36009abf00a45e4365359b3a7c1.tar.gz prosody-90093c2b5523c36009abf00a45e4365359b3a7c1.zip |
MUC: Added a 'Make Room Members-Only?' field to the room config dialog.
Diffstat (limited to 'plugins/muc')
-rw-r--r-- | plugins/muc/muc.lib.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index cf8946eb..2f7800b4 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -491,6 +491,9 @@ function room_mt:send_form(origin, stanza) :tag("field", {type='boolean', label='Make Room Moderated?', var='muc#roomconfig_moderatedroom'}) :tag("value"):text(self:is_moderated() and "1" or "0"):up() :up() + :tag("field", {type='boolean', label='Make Room Members-Only?', var='muc#roomconfig_membersonly'}) + :tag("value"):text(self:is_members_only() and "1" or "0"):up() + :up() ); end @@ -529,6 +532,12 @@ function room_mt:process_form(origin, stanza) dirty = dirty or (self:is_moderated() ~= moderated) module:log("debug", "moderated=%s", tostring(moderated)); + local membersonly = fields['muc#roomconfig_membersonly']; + if membersonly == "0" or membersonly == "false" then membersonly = nil; elseif membersonly == "1" or membersonly == "true" then membersonly = true; + else origin.send(st.error_reply(stanza, "cancel", "bad-request")); return; end + dirty = dirty or (self:is_members_only() ~= membersonly) + module:log("debug", "membersonly=%s", tostring(membersonly)); + local public = fields['muc#roomconfig_publicroom']; if public == "0" or public == "false" then public = nil; elseif public == "1" or public == "true" then public = true; else origin.send(st.error_reply(stanza, "cancel", "bad-request")); return; end @@ -549,6 +558,7 @@ function room_mt:process_form(origin, stanza) self:set_password(password); end self:set_moderated(moderated); + self:set_members_only(membersonly); if self.save then self:save(true); end origin.send(st.reply(stanza)); |