add 2 advanced options: confirm_close_muc_rooms and noconfirm_close_muc_rooms. Fixes #1622
This commit is contained in:
parent
bc7d9a2943
commit
e6200b599a
|
@ -143,6 +143,8 @@ class Config:
|
|||
'autodetect_browser_mailer': [opt_bool, False, '', True],
|
||||
'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_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],
|
||||
'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.')],
|
||||
|
|
|
@ -1040,23 +1040,26 @@ class GroupchatControl(ChatControlBase):
|
|||
|
||||
def allow_shutdown(self):
|
||||
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
|
||||
if gajim.config.get('confirm_close_muc'):
|
||||
if gajim.gc_connected[self.account][self.room_jid]:
|
||||
pritext = _('Are you sure you want to leave room "%s"?') % self.name
|
||||
sectext = _('If you close this window, you will be disconnected '
|
||||
'from this room.')
|
||||
if (gajim.config.get('confirm_close_muc') or self.room_jid in inclides) \
|
||||
and gajim.gc_connected[self.account][self.room_jid] and self.room_jid not\
|
||||
in excludes:
|
||||
pritext = _('Are you sure you want to leave room "%s"?') % self.name
|
||||
sectext = _('If you close this window, you will be disconnected '
|
||||
'from this room.')
|
||||
|
||||
dialog = dialogs.ConfirmationDialogCheck(pritext, sectext,
|
||||
_('Do _not ask me again'))
|
||||
dialog = dialogs.ConfirmationDialogCheck(pritext, sectext,
|
||||
_('Do _not ask me again'))
|
||||
|
||||
if dialog.get_response() != gtk.RESPONSE_OK:
|
||||
retval = False
|
||||
if dialog.get_response() != gtk.RESPONSE_OK:
|
||||
retval = False
|
||||
|
||||
if dialog.is_checked(): # user does not want to be asked again
|
||||
gajim.config.set('confirm_close_muc', False)
|
||||
if dialog.is_checked(): # user does not want to be asked again
|
||||
gajim.config.set('confirm_close_muc', False)
|
||||
|
||||
dialog.destroy()
|
||||
dialog.destroy()
|
||||
|
||||
return retval
|
||||
|
||||
|
|
Loading…
Reference in New Issue