chattab: add e2e_encryption property

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2022-03-18 19:42:09 +01:00
parent cb50120d87
commit 5caf2587f6
2 changed files with 5 additions and 1 deletions

View file

@ -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}',

View file

@ -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)