Comparison

plugins/muc/muc.lib.lua @ 3248:f8d14ea3ad0e

MUC: Added a password field to the room config dialog.
author Waqas Hussain <waqas20@gmail.com>
date Sun, 13 Jun 2010 19:19:03 +0500
parent 3247:ee8aaca3226c
child 3249:95daf6398dbb
comparison
equal deleted inserted replaced
3247:ee8aaca3226c 3248:f8d14ea3ad0e
456 :up() 456 :up()
457 :tag("option", {label = 'Anyone'}) 457 :tag("option", {label = 'Anyone'})
458 :tag("value"):text('anyone'):up() 458 :tag("value"):text('anyone'):up()
459 :up() 459 :up()
460 :up() 460 :up()
461 :tag("field", {type='text-private', label='Password', var='muc#roomconfig_roomsecret'})
462 :tag("value"):text(self:get_password() or ""):up()
463 :up()
461 ); 464 );
462 end 465 end
463 466
464 local valid_whois = { 467 local valid_whois = {
465 moderators = true, 468 moderators = true,
502 return; 505 return;
503 end 506 end
504 local whois_changed = self._data.whois ~= whois 507 local whois_changed = self._data.whois ~= whois
505 self._data.whois = whois 508 self._data.whois = whois
506 module:log('debug', 'whois=%s', tostring(whois)) 509 module:log('debug', 'whois=%s', tostring(whois))
510
511 local password = fields['muc#roomconfig_roomsecret'];
512 if password then
513 self:set_password(password);
514 end
507 515
508 if self.save then self:save(true); end 516 if self.save then self:save(true); end
509 origin.send(st.reply(stanza)); 517 origin.send(st.reply(stanza));
510 518
511 if dirty or whois_changed then 519 if dirty or whois_changed then