diff options
-rw-r--r-- | plugins/b64.py | 8 | ||||
-rw-r--r-- | plugins/emoji_ascii.py | 6 | ||||
-rwxr-xr-x | plugins/qr.py | 3 | ||||
-rw-r--r-- | plugins/screen_detach.py | 4 | ||||
-rw-r--r-- | plugins/untrackme.py | 2 | ||||
-rw-r--r-- | plugins/user_extras.py | 2 | ||||
-rw-r--r-- | poezio/plugin.py | 4 |
7 files changed, 18 insertions, 11 deletions
diff --git a/plugins/b64.py b/plugins/b64.py index d56ac5b3..1fec6123 100644 --- a/plugins/b64.py +++ b/plugins/b64.py @@ -24,7 +24,9 @@ This plugin also respects security guidelines listed in XEP-0419. from base64 import b64decode, b64encode from poezio.plugin_e2ee import E2EEPlugin -from slixmpp import Message +from poezio.tabs import ChatTab +from slixmpp import Message, JID +from typing import Optional class Plugin(E2EEPlugin): @@ -37,14 +39,14 @@ class Plugin(E2EEPlugin): # This encryption mechanism is using <body/> as a container replace_body_with_eme = False - def decrypt(self, message: Message, _tab) -> None: + async def decrypt(self, message: Message, jid: Optional[JID], _tab: 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[JID], _tab: ChatTab) -> None: """ Encrypt to base64 """ diff --git a/plugins/emoji_ascii.py b/plugins/emoji_ascii.py index 6629c50e..4beec3b1 100644 --- a/plugins/emoji_ascii.py +++ b/plugins/emoji_ascii.py @@ -21,10 +21,12 @@ import os import re from poezio.plugin import BasePlugin +from typing import Dict + class Plugin(BasePlugin): - emoji_to_ascii = {} - ascii_to_emoji = {} + emoji_to_ascii: Dict[str, str] = {} + ascii_to_emoji: Dict[str, str] = {} emoji_pattern = None alias_pattern = None diff --git a/plugins/qr.py b/plugins/qr.py index 25530248..9b05750d 100755 --- a/plugins/qr.py +++ b/plugins/qr.py @@ -3,7 +3,8 @@ import io import logging import qrcode -import sys + +from typing import Dict, Callable from poezio import windows from poezio.tabs import Tab diff --git a/plugins/screen_detach.py b/plugins/screen_detach.py index 0a2514c4..1f908513 100644 --- a/plugins/screen_detach.py +++ b/plugins/screen_detach.py @@ -43,10 +43,10 @@ DEFAULT_CONFIG = { # overload if this is not how your stuff # is configured try: - LOGIN = os.getlogin() + LOGIN = os.getlogin() or '' LOGIN_TMUX = os.getuid() except Exception: - LOGIN = os.getenv('USER') + LOGIN = os.getenv('USER') or '' LOGIN_TMUX = os.getuid() SCREEN_DIR = '/var/run/screens/S-%s' % LOGIN diff --git a/plugins/untrackme.py b/plugins/untrackme.py index c5db1a9d..ceddc5c5 100644 --- a/plugins/untrackme.py +++ b/plugins/untrackme.py @@ -49,7 +49,7 @@ def proxy(service: str) -> Callable[[str], str]: class Plugin(BasePlugin): """UntrackMe""" - default_config: Dict[str, str] = { + default_config: Dict[str, Dict[str, Union[str, bool]]] = { 'default': { 'cleanup': True, 'redirect': True, diff --git a/plugins/user_extras.py b/plugins/user_extras.py index b66545ed..ad49a142 100644 --- a/plugins/user_extras.py +++ b/plugins/user_extras.py @@ -369,6 +369,8 @@ class Plugin(BasePlugin): return if activity[0]: general = ACTIVITIES.get(activity[0]) + if general is None: + return s = general['category'] if activity[1]: s = s + '/' + general.get(activity[1], 'other') diff --git a/poezio/plugin.py b/poezio/plugin.py index 0ba13412..5fde7a12 100644 --- a/poezio/plugin.py +++ b/poezio/plugin.py @@ -4,7 +4,7 @@ These are used in the plugin system added in poezio 0.7.5 (see plugin_manager.py) """ -from typing import Any, Dict, Set +from typing import Any, Dict, Set, Optional from asyncio import iscoroutinefunction from functools import partial from configparser import RawConfigParser @@ -404,7 +404,7 @@ class BasePlugin(object, metaclass=SafetyMetaclass): # Internal use only _unloading = False - default_config = None + default_config: Optional[Dict[Any, Any]] = None dependencies: Set[str] = set() # This dict will get populated when the plugin is initialized refs: Dict[str, Any] = {} |