ability to remember for which JID we allow to not store logs. Fixes #6987

This commit is contained in:
Yann Leboulanger 2011-09-28 17:43:59 +02:00
parent 0c2807ce99
commit 7216c7b058
2 changed files with 30 additions and 12 deletions

View File

@ -333,7 +333,8 @@ class Config:
'custom_port': [ opt_int, 5222, '', True ],
'custom_host': [ opt_str, '', '', True ],
'sync_with_global_status': [ opt_bool, False, ],
'no_log_for': [ opt_str, '' ],
'no_log_for': [ opt_str, '', _('Space separated list of JIDs for which you do not want to store logs. You can also add account name to log nothing for this account.')],
'allow_no_log_for': [ opt_str, '', _('Space separated list of JIDs for which you accept to not log conversations if he does not want to.')],
'minimized_gc': [ opt_str, '' ],
'attached_gpg_keys': [ opt_str, '' ],
'keep_alives_enabled': [ opt_bool, True, _('Whitespace sent after inactivity')],

View File

@ -404,13 +404,11 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
not_acceptable)
self.dialog = dialogs.YesNoDialog(_('Confirm these '
'session options'), _('''The remote client wants '
'to negotiate an session with these features:
%s
Are these options acceptable?''') % (negotiation.describe_features(
ask_user)),
'session options'),
_('The remote client wants to negotiate a session '
'with these features:\n\n%s\n\nAre these options '
'acceptable?''') % (
negotiation.describe_features(ask_user)),
on_response_yes=accept_nondefault_options,
on_response_no=reject_nondefault_options)
else:
@ -434,7 +432,18 @@ Are these options acceptable?''') % (negotiation.describe_features(
if ask_user:
def accept_nondefault_options(is_checked):
dialog.destroy()
if dialog:
dialog.destroy()
if is_checked:
allow_no_log_for = gajim.config.get_per(
'accounts', self.conn.name,
'allow_no_log_for').split()
jid = str(self.jid)
if jid not in allow_no_log_for:
allow_no_log_for.append(jid)
gajim.config.set_per('accounts', self.conn.name,
'allow_no_log_for', ' '.join(allow_no_log_for))
negotiated.update(ask_user)
@ -447,10 +456,18 @@ Are these options acceptable?''') % (negotiation.describe_features(
self.reject_negotiation()
dialog.destroy()
dialog = dialogs.YesNoDialog(_('Confirm these session options'),
_('The remote client selected these options:\n\n%s\n\n'
'Continue with the session?') % (
allow_no_log_for = gajim.config.get_per('accounts',
self.conn.name, 'allow_no_log_for').split()
if str(self.jid) in allow_no_log_for:
dialog = None
accept_nondefault_options(False)
else:
dialog = dialogs.YesNoDialog(_('Confirm these session '
'options'),
_('The remote client selected these options:\n\n%s'
'\n\nContinue with the session?') % (
negotiation.describe_features(ask_user)),
_('Always accept for this contact'),
on_response_yes = accept_nondefault_options,
on_response_no = reject_nondefault_options)
else: