From d8a96e56a563f8b1d975108d737c62d2910dfc84 Mon Sep 17 00:00:00 2001 From: Tim Henkes Date: Mon, 30 Sep 2024 11:20:58 +0200 Subject: [PATCH] Emit an event when OMEMO has initialized --- CHANGELOG.md | 3 +++ slixmpp_omemo/xep_0384.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fb8499..240ca00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### Added +- Emit an event when OMEMO has initialized + ### Fixed - Use only strings for data form values used in pubsub publish options and node configuration diff --git a/slixmpp_omemo/xep_0384.py b/slixmpp_omemo/xep_0384.py index 202f85f..b5bac58 100644 --- a/slixmpp_omemo/xep_0384.py +++ b/slixmpp_omemo/xep_0384.py @@ -523,6 +523,11 @@ class XEP_0384(BasePlugin, metaclass=ABCMeta): # pylint: disable=invalid-name The plugin does not treat the protocol versions as separate encryption mechanisms, instead it manages all versions transparently with no manual intervention required. + Certain initialization tasks such as a data consistency check are transparently ran in the background when + the plugin is loaded. The ``omemo_initialized`` event is fired when those initial background tasks are + done. Waiting for this event can be useful e.g. in automated testing environments to be sure that a test + client has generated and uploaded its OMEMO data before continuing. + Tip: A lot of essential functionality is accessible via the `SessionManager` instance that is returned by :meth:`get_session_manager`. The session manager is the core of the underlying OMEMO library and @@ -666,6 +671,7 @@ async def get_session_manager(self) -> SessionManager: session_manager = await self.__session_manager_task self.__session_manager = session_manager self.__session_manager_task = None + self.xmpp.event("omemo_initialized") return session_manager # If the session manager is currently being built, wait for it to be done