summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2022-03-21 01:11:43 +0100
committerMaxime “pep” Buquet <pep@bouah.net>2022-03-21 17:45:30 +0100
commit433d5e6f76da52ed7f7f798cfb031f164a76fb23 (patch)
tree23952d0b261a568fe673d3e24dcae1766c35e390
parentb2de905464e113b3db88633cc726b76847f4b040 (diff)
downloadpoezio-433d5e6f76da52ed7f7f798cfb031f164a76fb23.tar.gz
poezio-433d5e6f76da52ed7f7f798cfb031f164a76fb23.tar.bz2
poezio-433d5e6f76da52ed7f7f798cfb031f164a76fb23.tar.xz
poezio-433d5e6f76da52ed7f7f798cfb031f164a76fb23.zip
plugin_e2ee: new format_fingerprint method to be overriden by plugin
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r--poezio/plugin_e2ee.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/poezio/plugin_e2ee.py b/poezio/plugin_e2ee.py
index 38ecbb83..a11337e9 100644
--- a/poezio/plugin_e2ee.py
+++ b/poezio/plugin_e2ee.py
@@ -34,7 +34,7 @@ from poezio.tabs import (
StaticConversationTab,
)
from poezio.plugin import BasePlugin
-from poezio.theming import get_theme, dump_tuple
+from poezio.theming import Theme, get_theme, dump_tuple
from poezio.config import config
from poezio.decorators import command_args_parser
@@ -273,17 +273,24 @@ class E2EEPlugin(BasePlugin):
'Info',
)
+ @staticmethod
+ def format_fingerprint(fingerprint: str, theme: Theme) -> str:
+ return fingerprint
+
async def _show_fingerprints(self, jid: JID) -> None:
"""Display encryption fingerprints for a JID."""
+ theme = get_theme()
fprs = await self.get_fingerprints(jid)
if len(fprs) == 1:
+ fingerprint = self.format_fingerprint(fprs[0], theme)
self.api.information(
- f'Fingerprint for {jid}: {fprs[0]}',
+ f'Fingerprint for {jid}: {fingerprint}',
'Info',
)
elif fprs:
+ fmt_fprs = map(lambda fp: self.format_fingerprint(fp, theme), fprs)
self.api.information(
- 'Fingerprints for %s:\n\t%s' % (jid, '\n\t'.join(fprs)),
+ 'Fingerprints for %s:\n\t%s' % (jid, '\n\t'.join(fmt_fprs)),
'Info',
)
else: