Commit c610a76f authored by Maxime Buquet's avatar Maxime Buquet

omemo: use dedicated method to check if encryption is enabled

Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <pep@bouah.net>
parent 3697e308
...@@ -231,7 +231,7 @@ class E2EEPlugin(BasePlugin): ...@@ -231,7 +231,7 @@ class E2EEPlugin(BasePlugin):
def _toggle_tab(self, _input: str) -> None: def _toggle_tab(self, _input: str) -> None:
jid = self.api.current_tab().jid # type: JID 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] del self._enabled_tabs[jid]
config.remove_and_save('encryption', section=jid) config.remove_and_save('encryption', section=jid)
self.api.information( self.api.information(
...@@ -311,7 +311,7 @@ class E2EEPlugin(BasePlugin): ...@@ -311,7 +311,7 @@ class E2EEPlugin(BasePlugin):
self.store_trust(jid, state, fpr) self.store_trust(jid, state, fpr)
def _encryption_enabled(self, jid: JID) -> bool: 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]: async def _encrypt_wrapper(self, stanza: StanzaBase) -> Optional[StanzaBase]:
""" """
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment