summaryrefslogtreecommitdiff
path: root/plugins/b64.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/b64.py')
-rw-r--r--plugins/b64.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/plugins/b64.py b/plugins/b64.py
index d56ac5b3..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,8 +23,17 @@ This plugin also respects security guidelines listed in XEP-0419.
"""
from base64 import b64decode, b64encode
+from typing import List, Optional
+from slixmpp import Message, JID
+
from poezio.plugin_e2ee import E2EEPlugin
-from slixmpp import Message
+from poezio.tabs import (
+ ChatTab,
+ MucTab,
+ PrivateTab,
+ DynamicConversationTab,
+ StaticConversationTab,
+)
class Plugin(E2EEPlugin):
@@ -37,14 +46,22 @@ class Plugin(E2EEPlugin):
# This encryption mechanism is using <body/> as a container
replace_body_with_eme = False
- def decrypt(self, message: Message, _tab) -> 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()
- def encrypt(self, message: Message, _tab) -> None:
+ async def encrypt(self, message: Message, _jid: Optional[List[JID]], _tab: ChatTab) -> None:
"""
Encrypt to base64
"""