diff --git a/src/common/config.py b/src/common/config.py index 441d43b993881a54a54383ec92c62d017eebed6a..3c403f460f61ad24e4640c03fd5460c5f89a0097 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -157,7 +157,6 @@ class Config: 'lastfm_username': [ opt_str, '', _('The username used to identify the Last.fm account.')], 'notify_on_new_gmail_email': [ opt_bool, True ], 'notify_on_new_gmail_email_extra': [ opt_bool, False ], - 'usegpg': [ opt_bool, False, '', True ], 'use_gpg_agent': [ opt_bool, False ], 'change_roster_title': [ opt_bool, True, _('Add * and [n] in roster title?')], 'restore_lines': [opt_int, 4, _('How many lines to remember from previous conversation when a chat tab/window is reopened.')], diff --git a/src/common/connection.py b/src/common/connection.py index d568143643da6a77ddb1c913cb6153c5256966e3..55d6d6627c1d8cad809c38550a3c96d5e71c73fd 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -107,6 +107,8 @@ class Connection(ConnectionHandlers): self.last_connection = None # last ClientCommon instance self.is_zeroconf = False self.gpg = None + if USE_GPG: + self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) self.status = '' self.priority = gajim.get_priority(name, 'offline') self.old_show = '' @@ -767,9 +769,6 @@ class Connection(ConnectionHandlers): }) if USE_GPG and not self.gpg: self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) - gajim.config.set('usegpg', True) - else: - gajim.config.set('usegpg', False) self.connect_and_init(show, msg, sign_msg) elif show == 'offline': @@ -1036,9 +1035,6 @@ class Connection(ConnectionHandlers): return if USE_GPG: self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) - gajim.config.set('usegpg', True) - else: - gajim.config.set('usegpg', False) gajim.connections[self.name] = self self.dispatch('ACC_OK', (self.new_account_info)) self.new_account_info = None diff --git a/src/common/zeroconf/connection_zeroconf.py b/src/common/zeroconf/connection_zeroconf.py index 235bada1a308f1498279f95a42359182d9b1e4b4..36f56a34764e3f63b9be962f172ed84b354ef099 100644 --- a/src/common/zeroconf/connection_zeroconf.py +++ b/src/common/zeroconf/connection_zeroconf.py @@ -62,6 +62,8 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf): self.connected = 0 # offline self.connection = None self.gpg = None + if USE_GPG: + self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) self.is_zeroconf = True self.privacy_rules_supported = False self.blocked_contacts = [] @@ -87,10 +89,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf): # Do we continue connection when we get roster (send presence,get vcard...) self.continue_connect_info = None if USE_GPG: - self.gpg = GnuPG.GnuPG() - gajim.config.set('usegpg', True) - else: - gajim.config.set('usegpg', False) + self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) self.get_config_values_or_default() diff --git a/src/config.py b/src/config.py index 20540364e6deffb40b789ffaeaacc5cdd14b957a..20f09dd1618916bc8104e283a7f9714309c07d2a 100644 --- a/src/config.py +++ b/src/config.py @@ -1514,7 +1514,7 @@ class AccountsWindow: # Personal tab gpg_key_label = self.xml.get_widget('gpg_key_label2') - if gajim.config.get('usegpg'): + if rajim.connections[gajim.ZEROCONF_ACC_NAME].gpg: self.xml.get_widget('gpg_choose_button2').set_sensitive(True) self.init_account_gpg() else: @@ -1542,7 +1542,7 @@ class AccountsWindow: use_gpg_agent_checkbutton = self.xml.get_widget( 'use_gpg_agent_checkbutton' + widget_name_add) - if not keyid or not gajim.config.get('usegpg'): + if not keyid or not gajim.connections[account].gpg: use_gpg_agent_checkbutton.set_sensitive(False) gpg_key_label.set_text(_('No key selected')) gpg_name_label.set_text('') @@ -1605,7 +1605,7 @@ class AccountsWindow: # Personal tab gpg_key_label = self.xml.get_widget('gpg_key_label1') - if gajim.config.get('usegpg'): + if gajim.connections[account].gpg: self.xml.get_widget('gpg_choose_button1').set_sensitive(True) self.init_account_gpg() else: