From c610a76fd9eed3ff86762c44275cb089f85f950e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= <pep@bouah.net>
Date: Sun, 13 Oct 2019 13:31:43 +0200
Subject: omemo: use dedicated method to check if encryption is enabled
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
---
 poezio/plugin_e2ee.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/poezio/plugin_e2ee.py b/poezio/plugin_e2ee.py
index 90222313..da6aec9a 100644
--- a/poezio/plugin_e2ee.py
+++ b/poezio/plugin_e2ee.py
@@ -231,7 +231,7 @@ class E2EEPlugin(BasePlugin):
     def _toggle_tab(self, _input: str) -> None:
         jid = self.api.current_tab().jid  # type: JID
 
-        if self._enabled_tabs.get(jid) == self.encrypt:
+        if self._encryption_enabled(jid):
             del self._enabled_tabs[jid]
             config.remove_and_save('encryption', section=jid)
             self.api.information(
@@ -311,7 +311,7 @@ class E2EEPlugin(BasePlugin):
         self.store_trust(jid, state, fpr)
 
     def _encryption_enabled(self, jid: JID) -> bool:
-        return jid in self._enabled_tabs and self._enabled_tabs[jid] == self.encrypt
+        return self._enabled_tabs.get(jid) == self.encrypt
 
     async def _encrypt_wrapper(self, stanza: StanzaBase) -> Optional[StanzaBase]:
         """
-- 
cgit v1.2.3