diff --git a/ChangeLog b/ChangeLog index 5eafc82..418f380 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ -Version 0.7.1: +Version 0.8.0: xxxx-xx-xx Maxime “pep” Buquet + * Breaking: + - get_devices and get_active_devices now return Iterable[int] instead of Iterable[str] * Changes: - fetch_bundle and fetch_device methods are now public * Added: diff --git a/slixmpp_omemo/__init__.py b/slixmpp_omemo/__init__.py index 5e9f89f..3c6b5d3 100644 --- a/slixmpp_omemo/__init__.py +++ b/slixmpp_omemo/__init__.py @@ -489,7 +489,7 @@ class XEP_0384(BasePlugin): return None - async def _set_device_list(self, device_ids: Optional[Set[int]] = None) -> None: + async def _set_device_list(self, device_ids: Optional[Iterable[int]] = None) -> None: own_jid = self.xmpp.boundjid try: @@ -554,19 +554,19 @@ class XEP_0384(BasePlugin): own_jid.bare, OMEMO_DEVICES_NS, payload=payload, ) - async def get_devices(self, jid: JID) -> Iterable[str]: + async def get_devices(self, jid: JID) -> Iterable[int]: """ Get all devices for a JID. """ devices = await self._omemo().getDevices(jid.bare) - return set(devices.get('active', []) + devices.get('inactive', [])) + return map(int, set(devices.get('active', []) + devices.get('inactive', []))) - async def get_active_devices(self, jid: JID) -> Iterable[str]: + async def get_active_devices(self, jid: JID) -> Iterable[int]: """ Return active device ids. Always contains our own device id. """ devices = await self._omemo().getDevices(jid.bare) - return set(devices.get('active', [])) + return map(int, set(devices.get('active', []))) async def _should_heartbeat(self, jid: JID, device_id: int, prekey: bool) -> bool: """