changeset 339:63cdabdd032e

chat: show encryption button with group chats: If the group chat use real jids, an encryption button is shown, displaying only non directed encryption plugins (as directed encryption plugins can't be used with MUCs).
author Goffi <goffi@goffi.org>
date Mon, 30 Dec 2019 21:03:21 +0100
parents d4883f9576db
children 9688e5e9881e
files cagou/plugins/plugin_wid_chat.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/plugins/plugin_wid_chat.py	Sun Dec 29 17:36:50 2019 +0100
+++ b/cagou/plugins/plugin_wid_chat.py	Mon Dec 30 21:03:21 2019 +0100
@@ -289,6 +289,9 @@
         )
         self.add_widget(btn)
         for plugin in G.host.encryption_plugins:
+            if chat.type == C.CHAT_GROUP and plugin["directed"]:
+                # directed plugins can't work with group chat
+                continue
             btn = EncryptionButton(
                 text=plugin['name'],
                 trust_button=True,
@@ -426,7 +429,7 @@
         cagou_widget.CagouWidget.__init__(self)
         transfer_btn = TransferButton(chat=self)
         self.headerInputAddExtra(transfer_btn)
-        if type_ == C.CHAT_ONE2ONE:
+        if (type_ == C.CHAT_ONE2ONE or "REALJID_PUBLIC" in statuses):
             self.encryption_btn = EncryptionMainButton(self)
             self.headerInputAddExtra(self.encryption_btn)
         self.extra_menu = ExtraMenu(chat=self)