From fb19adb4d1f87b2a416e1c6937b634639a2dadfc Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Tue, 21 Feb 2012 23:53:49 +0100
Subject: [PATCH] don't override assigned GPG key. Fixes #7111

---
 src/common/connection_handlers.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py
index bad67bdc8..4c65f66bc 100644
--- a/src/common/connection_handlers.py
+++ b/src/common/connection_handlers.py
@@ -893,7 +893,13 @@ class ConnectionHandlersBase:
         obj.contact.show = obj.show
         obj.contact.status = obj.status
         obj.contact.priority = obj.prio
-        obj.contact.keyID = obj.keyID
+        attached_keys = gajim.config.get_per('accounts', account,
+            'attached_gpg_keys').split()
+        if jid in attached_keys:
+            obj.contact.keyID = attached_keys[attached_keys.index(jid) + 1]
+        else:
+            # Do not override assigned key
+            obj.contact.keyID = obj.keyID
         if obj.timestamp:
             obj.contact.last_status_time = obj.timestamp
         elif not gajim.block_signed_in_notifications[account]:
-- 
GitLab