diff options
Diffstat (limited to 'plugins/b64.py')
-rw-r--r-- | plugins/b64.py | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/plugins/b64.py b/plugins/b64.py index 1fec6123..82300a0f 100644 --- a/plugins/b64.py +++ b/plugins/b64.py @@ -4,7 +4,7 @@ # # Copyright © 2019 Maxime “pep” Buquet <pep@bouah.net> # -# Distributed under terms of the zlib license. +# Distributed under terms of the GPL-3.0+ license. """ Usage @@ -23,10 +23,17 @@ This plugin also respects security guidelines listed in XEP-0419. """ from base64 import b64decode, b64encode -from poezio.plugin_e2ee import E2EEPlugin -from poezio.tabs import ChatTab +from typing import List, Optional from slixmpp import Message, JID -from typing import Optional + +from poezio.plugin_e2ee import E2EEPlugin +from poezio.tabs import ( + ChatTab, + MucTab, + PrivateTab, + DynamicConversationTab, + StaticConversationTab, +) class Plugin(E2EEPlugin): @@ -39,14 +46,22 @@ class Plugin(E2EEPlugin): # This encryption mechanism is using <body/> as a container replace_body_with_eme = False - async def decrypt(self, message: Message, jid: Optional[JID], _tab: ChatTab) -> None: + # In what tab is it ok to use this plugin. Here we want all of them + supported_tab_types = ( + MucTab, + PrivateTab, + DynamicConversationTab, + StaticConversationTab, + ) + + async def decrypt(self, message: Message, jid: Optional[JID], _tab: Optional[ChatTab]) -> None: """ Decrypt base64 """ body = message['body'] message['body'] = b64decode(body.encode()).decode() - async def encrypt(self, message: Message, jid: Optional[JID], _tab: ChatTab) -> None: + async def encrypt(self, message: Message, _jid: Optional[List[JID]], _tab: ChatTab) -> None: """ Encrypt to base64 """ |