allow ignore_unknown_contacts, send_os_info and log_encrypted_sessions to be set per_account in ACE. Fixes #4730

This commit is contained in:
Yann Leboulanger 2009-01-27 08:48:17 +00:00
parent 8603712990
commit f11c1b226a
4 changed files with 62 additions and 14 deletions

View File

@ -1,5 +1,5 @@
AC_INIT([Gajim - A Jabber Instant Messager],
[0.12.1.1-svn],[http://trac.gajim.org/],[gajim])
[0.12.1.2-svn],[http://trac.gajim.org/],[gajim])
AC_PREREQ([2.59])
AC_CONFIG_HEADER(config.h)

View File

@ -80,7 +80,6 @@ class Config:
'notify_on_new_message': [ opt_bool, True ],
'autopopupaway': [ opt_bool, False ],
'use_notif_daemon': [ opt_bool, True , _('Use D-Bus and Notification-Daemon to show notifications') ],
'ignore_unknown_contacts': [ opt_bool, False ],
'showoffline': [ opt_bool, False ],
'show_transports_group': [ opt_bool, True ],
'autoaway': [ opt_bool, True ],
@ -166,7 +165,6 @@ class Config:
'time_stamp': [ opt_str, '[%X] ', _('This option let you customize timestamp that is printed in conversation. For exemple "[%H:%M] " will show "[hour:minute] ". See python doc on strftime for full documentation: http://docs.python.org/lib/module-time.html') ],
'before_nickname': [ opt_str, '', _('Characters that are printed before the nickname in conversations') ],
'after_nickname': [ opt_str, ':', _('Characters that are printed after the nickname in conversations') ],
'send_os_info': [ opt_bool, True ],
'notify_on_new_gmail_email': [ opt_bool, True ],
'notify_on_new_gmail_email_extra': [ opt_bool, False ],
'use_gpg_agent': [ opt_bool, False ],
@ -205,7 +203,6 @@ class Config:
'tabs_always_visible': [opt_bool, False, _('Show tab when only one conversation?')],
'tabs_border': [opt_bool, False, _('Show tabbed notebook border in chat windows?')],
'tabs_close_button': [opt_bool, True, _('Show close button in tab?')],
'log_encrypted_sessions': [opt_bool, True, _('When negotiating an encrypted session, should Gajim assume you want your messages to be logged?')],
'esession_modp': [opt_str, '5,14', _('A list of modp groups to use in a Diffie-Hellman, highest preference first, separated by commas. Valid groups are 1, 2, 5, 14, 15, 16, 17 and 18. Higher numbers are more secure, but take longer to calculate when you start a session.')],
'chat_avatar_width': [opt_int, 52],
'chat_avatar_height': [opt_int, 52],
@ -343,6 +340,9 @@ class Config:
'subscribe_activity': [opt_bool, True],
'subscribe_tune': [opt_bool, True],
'subscribe_nick': [opt_bool, True],
'ignore_unknown_contacts': [ opt_bool, False ],
'send_os_info': [ opt_bool, True ],
'log_encrypted_sessions': [opt_bool, True, _('When negotiating an encrypted session, should Gajim assume you want your messages to be logged?')],
}, {}),
'statusmsg': ({
'message': [ opt_str, '' ],

View File

@ -189,6 +189,8 @@ class OptionsParser:
self.update_config_to_01201()
if old < [0, 12, 1, 1] and new >= [0, 12, 1, 1]:
self.update_config_to_01211()
if old < [0, 12, 1, 2] and new >= [0, 12, 1, 2]:
self.update_config_to_01212()
gajim.logger.init_vars()
gajim.config.set('version', new_version)
@ -618,4 +620,13 @@ class OptionsParser:
gajim.config.set('trayicon', 'always')
gajim.config.set('version', '0.12.1.1')
def update_config_to_01212(self):
for opt in ('ignore_unknown_contacts', 'send_os_info',
'log_encrypted_sessions'):
if opt in self.old_values:
val = self.old_values[opt]
for account in gajim.config.get_per('accounts'):
gajim.config.set_per('accounts', account, opt, val)
gajim.config.set('version', '0.12.1.2')
# vim: se ts=3:

View File

@ -468,20 +468,32 @@ class PreferencesWindow:
self.xml.get_widget('log_show_changes_checkbutton').set_active(st)
# log encrypted chat sessions
st = gajim.config.get('log_encrypted_sessions')
self.xml.get_widget('log_encrypted_chats_checkbutton').set_active(st)
w = self.xml.get_widget('log_encrypted_chats_checkbutton')
st = self.get_per_account_option('log_encrypted_sessions')
if st == 'mixed':
w.set_inconsistent(True)
else:
w.set_active(st)
# send os info
st = gajim.config.get('send_os_info')
self.xml.get_widget('send_os_info_checkbutton').set_active(st)
w = self.xml.get_widget('send_os_info_checkbutton')
st = self.get_per_account_option('send_os_info')
if st == 'mixed':
w.set_inconsistent(True)
else:
w.set_active(st)
# check if gajm is default
st = gajim.config.get('check_if_gajim_is_default')
self.xml.get_widget('check_default_client_checkbutton').set_active(st)
# Ignore messages from unknown contacts
self.xml.get_widget('ignore_events_from_unknown_contacts_checkbutton').\
set_active(gajim.config.get('ignore_unknown_contacts'))
w = self.xml.get_widget('ignore_events_from_unknown_contacts_checkbutton')
st = self.get_per_account_option('ignore_unknown_contacts')
if st == 'mixed':
w.set_inconsistent(True)
else:
w.set_active(st)
self.xml.signal_autoconnect(self)
@ -504,14 +516,36 @@ class PreferencesWindow:
if event.keyval == gtk.keysyms.Escape:
self.window.hide()
def get_per_account_option(self, opt):
'''Return the value of the option opt if it's the same in all accoutns
else returns "mixed"'''
val = None
for account in gajim.connections:
v = gajim.config.get_per('accounts', account, opt)
if val is None:
val = v
elif val != v:
return 'mixed'
return val
def on_checkbutton_toggled(self, widget, config_name,
change_sensitivity_widgets = None):
change_sensitivity_widgets=None):
gajim.config.set(config_name, widget.get_active())
if change_sensitivity_widgets:
for w in change_sensitivity_widgets:
w.set_sensitive(widget.get_active())
gajim.interface.save_config()
def on_per_account_checkbutton_toggled(self, widget, config_name,
change_sensitivity_widgets=None):
for account in gajim.connections:
gajim.config.set_per('accounts', account, config_name,
widget.get_active())
if change_sensitivity_widgets:
for w in change_sensitivity_widgets:
w.set_sensitive(widget.get_active())
gajim.interface.save_config()
def on_sort_by_show_in_roster_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'sort_by_show_in_roster')
gajim.interface.roster.setup_and_draw_roster()
@ -706,7 +740,8 @@ class PreferencesWindow:
gajim.config.set('displayed_chat_state_notifications', 'disabled')
def on_ignore_events_from_unknown_contacts_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'ignore_unknown_contacts')
widget.set_inconsistent(False)
self.on_per_account_checkbutton_toggled(widget, 'ignore_unknown_contacts')
def on_on_event_combobox_changed(self, widget):
active = widget.get_active()
@ -953,10 +988,12 @@ class PreferencesWindow:
self.on_checkbutton_toggled(widget, 'log_contact_status_changes')
def on_log_encrypted_chats_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'log_encrypted_sessions')
widget.set_inconsistent(False)
self.on_per_account_checkbutton_toggled(widget, 'log_encrypted_sessions')
def on_send_os_info_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'send_os_info')
widget.set_inconsistent(False)
self.on_per_account_checkbutton_toggled(widget, 'send_os_info')
def on_check_default_client_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'check_if_gajim_is_default')