Software /
code /
prosody
Comparison
plugins/muc/muc.lib.lua @ 3262:330010ef078f
MUC: Updated code to use :set_hidden() and :is_hidden().
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sun, 13 Jun 2010 21:58:46 +0500 |
parent | 3261:fe1c93296abd |
child | 3263:4973b737d4c7 |
comparison
equal
deleted
inserted
replaced
3261:fe1c93296abd | 3262:330010ef078f |
---|---|
494 :tag("field", {type='hidden', var='FORM_TYPE'}):tag("value"):text("http://jabber.org/protocol/muc#roomconfig"):up():up() | 494 :tag("field", {type='hidden', var='FORM_TYPE'}):tag("value"):text("http://jabber.org/protocol/muc#roomconfig"):up():up() |
495 :tag("field", {type='boolean', label='Make Room Persistent?', var='muc#roomconfig_persistentroom'}) | 495 :tag("field", {type='boolean', label='Make Room Persistent?', var='muc#roomconfig_persistentroom'}) |
496 :tag("value"):text(self:is_persistent() and "1" or "0"):up() | 496 :tag("value"):text(self:is_persistent() and "1" or "0"):up() |
497 :up() | 497 :up() |
498 :tag("field", {type='boolean', label='Make Room Publicly Searchable?', var='muc#roomconfig_publicroom'}) | 498 :tag("field", {type='boolean', label='Make Room Publicly Searchable?', var='muc#roomconfig_publicroom'}) |
499 :tag("value"):text(self._data.hidden and "0" or "1"):up() | 499 :tag("value"):text(self:is_hidden() and "0" or "1"):up() |
500 :up() | 500 :up() |
501 :tag("field", {type='list-single', label='Who May Discover Real JIDs?', var='muc#roomconfig_whois'}) | 501 :tag("field", {type='list-single', label='Who May Discover Real JIDs?', var='muc#roomconfig_whois'}) |
502 :tag("value"):text(self._data.whois or 'moderators'):up() | 502 :tag("value"):text(self._data.whois or 'moderators'):up() |
503 :tag("option", {label = 'Moderators Only'}) | 503 :tag("option", {label = 'Moderators Only'}) |
504 :tag("value"):text('moderators'):up() | 504 :tag("value"):text('moderators'):up() |
560 module:log("debug", "membersonly=%s", tostring(membersonly)); | 560 module:log("debug", "membersonly=%s", tostring(membersonly)); |
561 | 561 |
562 local public = fields['muc#roomconfig_publicroom']; | 562 local public = fields['muc#roomconfig_publicroom']; |
563 if public == "0" or public == "false" then public = nil; elseif public == "1" or public == "true" then public = true; | 563 if public == "0" or public == "false" then public = nil; elseif public == "1" or public == "true" then public = true; |
564 else origin.send(st.error_reply(stanza, "cancel", "bad-request")); return; end | 564 else origin.send(st.error_reply(stanza, "cancel", "bad-request")); return; end |
565 dirty = dirty or (self._data.hidden ~= (not public and true or nil)) | 565 dirty = dirty or (self:is_hidden() ~= (not public and true or nil)) |
566 self._data.hidden = not public and true or nil; | |
567 | 566 |
568 local whois = fields['muc#roomconfig_whois']; | 567 local whois = fields['muc#roomconfig_whois']; |
569 if not valid_whois[whois] then | 568 if not valid_whois[whois] then |
570 origin.send(st.error_reply(stanza, 'cancel', 'bad-request')); | 569 origin.send(st.error_reply(stanza, 'cancel', 'bad-request')); |
571 return; | 570 return; |
579 self:set_password(password); | 578 self:set_password(password); |
580 end | 579 end |
581 self:set_moderated(moderated); | 580 self:set_moderated(moderated); |
582 self:set_members_only(membersonly); | 581 self:set_members_only(membersonly); |
583 self:set_persistent(persistent); | 582 self:set_persistent(persistent); |
583 self:set_hidden(not public); | |
584 | 584 |
585 if self.save then self:save(true); end | 585 if self.save then self:save(true); end |
586 origin.send(st.reply(stanza)); | 586 origin.send(st.reply(stanza)); |
587 | 587 |
588 if dirty or whois_changed then | 588 if dirty or whois_changed then |