diff options
author | Philipp Hörist <forenjunkie@chello.at> | 2017-06-08 19:55:05 +0300 |
---|---|---|
committer | Philipp Hörist <forenjunkie@chello.at> | 2017-06-08 20:09:22 +0300 |
commit | 92b0a15521fd973bec9020ff9840d2032a54558b (patch) | |
tree | 12cbc21641cb3f81a0454bf65dc36ab259782d72 /src | |
parent | b5e9b07a07508689bf9b8509a0049aa55a1feef7 (diff) |
Pass use_agent to GPG init instead of overwrite
Diffstat (limited to 'src')
-rw-r--r-- | src/common/connection.py | 13 | ||||
-rw-r--r-- | src/common/gpg.py | 6 |
2 files changed, 8 insertions, 11 deletions
diff --git a/src/common/connection.py b/src/common/connection.py index 2c56277f6..f498116ff 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -132,7 +132,7 @@ class CommonConnection: self.USE_GPG = False if gajim.HAVE_GPG: self.USE_GPG = True - self.gpg = gpg.GnuPG(gajim.config.get('use_gpg_agent')) + self.gpg = gpg.GnuPG() self.status = '' self.old_show = '' self.priority = gajim.get_priority(name, 'offline') @@ -234,8 +234,7 @@ class CommonConnection: signed = '' keyID = gajim.config.get_per('accounts', self.name, 'keyid') if keyID and self.USE_GPG: - use_gpg_agent = gajim.config.get('use_gpg_agent') - if self.gpg.passphrase is None and not use_gpg_agent: + if self.gpg.passphrase is None and not self.gpg.use_agent: # We didn't set a passphrase return None signed = self.gpg.sign(msg, keyID) @@ -566,8 +565,7 @@ class CommonConnection: def gpg_passphrase(self, passphrase): if self.gpg: - use_gpg_agent = gajim.config.get('use_gpg_agent') - if use_gpg_agent: + if self.gpg.use_agent: self.gpg.passphrase = None else: self.gpg.passphrase = passphrase @@ -614,7 +612,7 @@ class CommonConnection: self.server_resource = self._compute_resource() if gajim.HAVE_GPG: self.USE_GPG = True - self.gpg = gpg.GnuPG(gajim.config.get('use_gpg_agent')) + self.gpg = gpg.GnuPG() gajim.nec.push_incoming_event(BeforeChangeShowEvent(None, conn=self, show=show, message=msg)) self.connect_and_init(show, msg, sign_msg) @@ -892,8 +890,7 @@ class Connection(CommonConnection, ConnectionHandlers): return if gajim.HAVE_GPG: self.USE_GPG = True - self.gpg = gpg.GnuPG(gajim.config.get( - 'use_gpg_agent')) + self.gpg = gpg.GnuPG() gajim.nec.push_incoming_event( AccountCreatedEvent(None, conn=self, account_info = self.new_account_info)) diff --git a/src/common/gpg.py b/src/common/gpg.py index 4cc2b966c..a2df1c67c 100644 --- a/src/common/gpg.py +++ b/src/common/gpg.py @@ -32,14 +32,14 @@ if HAVE_GPG: gnupg.logger = logging.getLogger('gajim.c.gnupg') class GnuPG(gnupg.GPG): - def __init__(self, use_agent=False): - gnupg.GPG.__init__(self, gpgbinary=GPG_BINARY) + def __init__(self): + use_agent = gajim.config.get('use_gpg_agent') + gnupg.GPG.__init__(self, gpgbinary=GPG_BINARY, use_agent=use_agent) encoding = gajim.config.get('pgp_encoding') if encoding: self.encoding = encoding self.decode_errors = 'replace' self.passphrase = None - self.use_agent = use_agent self.always_trust = [] # list of keyID to always trust def _setup_my_options(self): |