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_port': [ opt_int, 5222, '', True ],
'custom_host': [ opt_str, '', '', True ], 'custom_host': [ opt_str, '', '', True ],
'sync_with_global_status': [ opt_bool, False, ], '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, '' ], 'minimized_gc': [ opt_str, '' ],
'attached_gpg_keys': [ opt_str, '' ], 'attached_gpg_keys': [ opt_str, '' ],
'keep_alives_enabled': [ opt_bool, True, _('Whitespace sent after inactivity')], 'keep_alives_enabled': [ opt_bool, True, _('Whitespace sent after inactivity')],

View File

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