From 5caf2587f6a7654b05c1a9a848ea0c3e4cdd9780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Fri, 18 Mar 2022 19:42:09 +0100 Subject: chattab: add e2e_encryption property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- poezio/plugin_e2ee.py | 5 ++++- poezio/tabs/basetabs.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/poezio/plugin_e2ee.py b/poezio/plugin_e2ee.py index 6e0bbc0c..b66a8173 100644 --- a/poezio/plugin_e2ee.py +++ b/poezio/plugin_e2ee.py @@ -257,10 +257,12 @@ class E2EEPlugin(BasePlugin): return "" def _toggle_tab(self, _input: str) -> None: - jid: JID = self.api.current_tab().jid + tab = self.api.current_tab() + jid: JID = tab.jid if self._encryption_enabled(jid): del self._enabled_tabs[jid] + tab.e2e_encryption = None config.remove_and_save('encryption', section=jid) self.api.information( f'{self.encryption_name} encryption disabled for {jid}', @@ -268,6 +270,7 @@ class E2EEPlugin(BasePlugin): ) elif self.encryption_short_name: self._enabled_tabs[jid] = self.encrypt + tab.e2e_encryption = self.encryption_name config.set_and_save('encryption', self.encryption_short_name, section=jid) self.api.information( f'{self.encryption_name} encryption enabled for {jid}', diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py index 44330782..37dea9c3 100644 --- a/poezio/tabs/basetabs.py +++ b/poezio/tabs/basetabs.py @@ -514,6 +514,7 @@ class ChatTab(Tab): timed_event_paused: Optional[DelayedEvent] timed_event_not_paused: Optional[DelayedEvent] mam_filler: Optional[MAMFiller] + e2e_encryption: Optional[str] = None def __init__(self, core, jid: Union[JID, str]): Tab.__init__(self, core) -- cgit v1.2.3