[moparisthebest] Encrypt GPG message to recipient and to our own key so that we can decrypt it later and use carbon. Fixes #7616

This commit is contained in:
Yann Leboulanger 2015-07-13 21:39:12 +02:00
parent 731cea3b66
commit 70e8b130ac
1 changed files with 3 additions and 3 deletions

View File

@ -313,9 +313,11 @@ class CommonConnection:
error = _('The contact\'s key (%s) does not match the key assigned ' error = _('The contact\'s key (%s) does not match the key assigned '
'in Gajim.' % keyID[:8]) 'in Gajim.' % keyID[:8])
else: else:
myKeyID = gajim.config.get_per('accounts', self.name, 'keyid')
def encrypt_thread(msg, keyID, always_trust=False): def encrypt_thread(msg, keyID, always_trust=False):
# encrypt message. This function returns (msgenc, error) # encrypt message. This function returns (msgenc, error)
return self.gpg.encrypt(msg, [keyID], always_trust) return self.gpg.encrypt(msg, [keyID, myKeyID],
always_trust)
def _on_encrypted(output): def _on_encrypted(output):
msgenc, error = output msgenc, error = output
if error == 'NOT_TRUSTED': if error == 'NOT_TRUSTED':
@ -423,8 +425,6 @@ class CommonConnection:
if msgenc: if msgenc:
msg_iq.setTag(nbxmpp.NS_ENCRYPTED + ' x').setData(msgenc) msg_iq.setTag(nbxmpp.NS_ENCRYPTED + ' x').setData(msgenc)
if self.carbons_enabled:
msg_iq.addChild(name='private', namespace=nbxmpp.NS_CARBONS)
msg_iq.addChild(name='no-permanent-storage', msg_iq.addChild(name='no-permanent-storage',
namespace=nbxmpp.NS_MSG_HINTS) namespace=nbxmpp.NS_MSG_HINTS)