From c4e7f3baaa207d56ecc563e8b30bcb96c65d68ba Mon Sep 17 00:00:00 2001
From: lovetox <philipp@hoerist.com>
Date: Sat, 4 Apr 2020 11:31:26 +0200
Subject: [PATCH] [openpgp] Adapt updating caps

---
 openpgp/pgpplugin.py | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/openpgp/pgpplugin.py b/openpgp/pgpplugin.py
index f12c46c2..ad7843ee 100644
--- a/openpgp/pgpplugin.py
+++ b/openpgp/pgpplugin.py
@@ -115,11 +115,8 @@ class OpenPGPPlugin(GajimPlugin):
 
     def activate(self):
         for account in app.connections:
-            if app.caps_hash[account] != '':
-                # Gajim has already a caps hash calculated, update it
-                helpers.update_optional_features(account)
-
             con = app.connections[account]
+            con.get_module('Caps').update_caps()
             if app.account_is_connected(account):
                 if con.get_module('OpenPGP').secret_key_available:
                     log.info('%s => Publish keylist and public key '
@@ -131,10 +128,8 @@ class OpenPGPPlugin(GajimPlugin):
         pass
 
     @staticmethod
-    def _update_caps(account):
-        namespace = nbxmpp.NS_OPENPGP_PK + '+notify'
-        if namespace not in app.gajim_optional_features[account]:
-            app.gajim_optional_features[account].append(namespace)
+    def _update_caps(_account, features):
+        features.append('%s+notify' % nbxmpp.NS_OPENPGP_PK)
 
     def activate_encryption(self, chat_control):
         account = chat_control.account
-- 
GitLab