add 2 advanced options: confirm_close_muc_rooms and noconfirm_close_muc_rooms. Fixes #1622

This commit is contained in:
Yann Leboulanger 2006-03-07 13:13:36 +00:00
parent bc7d9a2943
commit e6200b599a
2 changed files with 17 additions and 12 deletions

View File

@ -143,6 +143,8 @@ class Config:
'autodetect_browser_mailer': [opt_bool, False, '', True], 'autodetect_browser_mailer': [opt_bool, False, '', True],
'print_ichat_every_foo_minutes': [opt_int, 5], 'print_ichat_every_foo_minutes': [opt_int, 5],
'confirm_close_muc': [opt_bool, True, _('Ask before closing a group chat tab/window.')], 'confirm_close_muc': [opt_bool, True, _('Ask before closing a group chat tab/window.')],
'confirm_close_muc_rooms': [opt_str, True, _('Always ask before closing group chat tab/window in this space separated list of room jids.')],
'noconfirm_close_muc_rooms': [opt_str, True, _('Never ask before closing group chat tab/window in this space separated list of room jids.')],
'notify_on_file_complete': [opt_bool, True], 'notify_on_file_complete': [opt_bool, True],
'file_transfers_port': [opt_int, 28011], 'file_transfers_port': [opt_int, 28011],
'ft_override_host_to_send': [opt_str, '', _('Overrides the host we send for File Transfer in case of address translation/port forwarding.')], 'ft_override_host_to_send': [opt_str, '', _('Overrides the host we send for File Transfer in case of address translation/port forwarding.')],

View File

@ -1040,23 +1040,26 @@ class GroupchatControl(ChatControlBase):
def allow_shutdown(self): def allow_shutdown(self):
retval = True retval = True
includes = gajim.config.get('confirm_close_muc_rooms').split(' ')
excludes = gajim.config.get('noconfirm_close_muc_rooms').split(' ')
# whether to ask for comfirmation before closing muc # whether to ask for comfirmation before closing muc
if gajim.config.get('confirm_close_muc'): if (gajim.config.get('confirm_close_muc') or self.room_jid in inclides) \
if gajim.gc_connected[self.account][self.room_jid]: and gajim.gc_connected[self.account][self.room_jid] and self.room_jid not\
pritext = _('Are you sure you want to leave room "%s"?') % self.name in excludes:
sectext = _('If you close this window, you will be disconnected ' pritext = _('Are you sure you want to leave room "%s"?') % self.name
'from this room.') sectext = _('If you close this window, you will be disconnected '
'from this room.')
dialog = dialogs.ConfirmationDialogCheck(pritext, sectext, dialog = dialogs.ConfirmationDialogCheck(pritext, sectext,
_('Do _not ask me again')) _('Do _not ask me again'))
if dialog.get_response() != gtk.RESPONSE_OK: if dialog.get_response() != gtk.RESPONSE_OK:
retval = False retval = False
if dialog.is_checked(): # user does not want to be asked again if dialog.is_checked(): # user does not want to be asked again
gajim.config.set('confirm_close_muc', False) gajim.config.set('confirm_close_muc', False)
dialog.destroy() dialog.destroy()
return retval return retval