From 04efd8ee07b4ea34f080570b1878d52ac9e2cc4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sun, 25 Aug 2019 02:11:12 +0200 Subject: omemo: implement get_fingerprints method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- plugins/omemo_plugin.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 -- cgit v1.2.3