summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2019-08-25 02:11:12 +0200
committerMaxime “pep” Buquet <pep@bouah.net>2019-12-27 18:58:48 +0100
commit04efd8ee07b4ea34f080570b1878d52ac9e2cc4a (patch)
tree6bbe67467262a1995bec9d27378abcf8a7934892
parent518ba47e2aaea628e38132a826101a8c17801a79 (diff)
downloadpoezio-04efd8ee07b4ea34f080570b1878d52ac9e2cc4a.tar.gz
poezio-04efd8ee07b4ea34f080570b1878d52ac9e2cc4a.tar.bz2
poezio-04efd8ee07b4ea34f080570b1878d52ac9e2cc4a.tar.xz
poezio-04efd8ee07b4ea34f080570b1878d52ac9e2cc4a.zip
omemo: implement get_fingerprints method
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r--plugins/omemo_plugin.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/omemo_plugin.py b/plugins/omemo_plugin.py
index 8af2402d..55adda14 100644
--- a/plugins/omemo_plugin.py
+++ b/plugins/omemo_plugin.py
@@ -12,6 +12,7 @@
import os
import asyncio
import logging
+from typing import List
from poezio.plugin_e2ee import E2EEPlugin
from poezio.xdg import DATA_HOME
@@ -67,6 +68,20 @@ class Plugin(E2EEPlugin):
def display_error(self, txt) -> None:
self.api.information(txt, 'Error')
+ def get_fingerprints(self, jid: JID) -> List[str]:
+ devices = self.core.xmpp['xep_0384'].get_trust_for_jid(jid)
+
+ # XXX: What to do with did -> None entries?
+ # XXX: What to do with the active/inactive devices differenciation?
+ # For now I'll merge both. We should probably display them separately
+ # later on.
+ devices['active'].update(devices['inactive'])
+ return [
+ trust['fingerprint']
+ for trust in devices['active'].values()
+ if trust is not None
+ ]
+
def decrypt(self, message: Message, tab, allow_untrusted=False) -> None:
body = None