Merge branch 'master' of dev.gajim.org:gajim/gajim
This commit is contained in:
commit
c48f0419f2
4 changed files with 13 additions and 8 deletions
|
@ -684,8 +684,10 @@ class CommonConnection:
|
||||||
else:
|
else:
|
||||||
self.gpg.passphrase = passphrase
|
self.gpg.passphrase = passphrase
|
||||||
|
|
||||||
def ask_gpg_keys(self):
|
def ask_gpg_keys(self, keyID=None):
|
||||||
if self.gpg:
|
if self.gpg:
|
||||||
|
if keyID:
|
||||||
|
return self.gpg.get_key(keyID)
|
||||||
return self.gpg.get_keys()
|
return self.gpg.get_keys()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ except ImportError:
|
||||||
HAVE_GPG = True
|
HAVE_GPG = True
|
||||||
GPG_BINARY = 'gpg'
|
GPG_BINARY = 'gpg'
|
||||||
try:
|
try:
|
||||||
__import__('gnupg', globals(), locals(), [], 0)
|
__import__('gnupg')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAVE_GPG = False
|
HAVE_GPG = False
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -89,7 +89,7 @@ if HAVE_GPG:
|
||||||
|
|
||||||
if result.fingerprint:
|
if result.fingerprint:
|
||||||
return self._stripHeaderFooter(str(result))
|
return self._stripHeaderFooter(str(result))
|
||||||
if result.status == 'key expired':
|
if hasattr(result, 'status') and result.status == 'key expired':
|
||||||
return 'KEYEXPIRED'
|
return 'KEYEXPIRED'
|
||||||
return 'BAD_PASSPHRASE'
|
return 'BAD_PASSPHRASE'
|
||||||
|
|
||||||
|
@ -113,6 +113,9 @@ if HAVE_GPG:
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
def get_key(self, keyID):
|
||||||
|
return super(GnuPG, self).list_keys(keys=[keyID])
|
||||||
|
|
||||||
def get_keys(self, secret=False):
|
def get_keys(self, secret=False):
|
||||||
keys = {}
|
keys = {}
|
||||||
result = super(GnuPG, self).list_keys(secret=secret)
|
result = super(GnuPG, self).list_keys(secret=secret)
|
||||||
|
|
|
@ -1285,9 +1285,9 @@ def prepare_and_validate_gpg_keyID(account, jid, keyID):
|
||||||
# An unsigned presence, just use the assigned key
|
# An unsigned presence, just use the assigned key
|
||||||
keyID = attached_keys[attached_keys.index(jid) + 1]
|
keyID = attached_keys[attached_keys.index(jid) + 1]
|
||||||
elif keyID:
|
elif keyID:
|
||||||
public_keys = gajim.connections[account].ask_gpg_keys()
|
full_key = gajim.connections[account].ask_gpg_keys(keyID=keyID)
|
||||||
# Assign the corresponding key, if we have it in our keyring
|
# Assign the corresponding key, if we have it in our keyring
|
||||||
if keyID in public_keys:
|
if full_key:
|
||||||
for u in gajim.contacts.get_contacts(account, jid):
|
for u in gajim.contacts.get_contacts(account, jid):
|
||||||
u.keyID = keyID
|
u.keyID = keyID
|
||||||
keys_str = gajim.config.get_per('accounts', account,
|
keys_str = gajim.config.get_per('accounts', account,
|
||||||
|
|
Loading…
Add table
Reference in a new issue