Skip to content

Commit

Permalink
Emit an event when OMEMO has initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
Syndace committed Sep 30, 2024
1 parent d4242d3 commit d8a96e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions slixmpp_omemo/xep_0384.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d8a96e5

Please sign in to comment.