Software /
code /
prosody
Diff
plugins/muc/muc.lib.lua @ 3256:d96172f78ec2
MUC: Added a 'Make Room Members-Only?' field to the room config dialog.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sun, 13 Jun 2010 20:52:37 +0500 |
parent | 3255:6bffb5c63131 |
child | 3257:fae054e15e03 |
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua Sun Jun 13 20:44:38 2010 +0500 +++ b/plugins/muc/muc.lib.lua Sun Jun 13 20:52:37 2010 +0500 @@ -491,6 +491,9 @@ :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 @@ 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 @@ 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));