diff --git a/slixmpp_omemo/__init__.py b/slixmpp_omemo/__init__.py index 3c2f689..b31d238 100644 --- a/slixmpp_omemo/__init__.py +++ b/slixmpp_omemo/__init__.py @@ -538,7 +538,7 @@ class XEP_0384(BasePlugin): lengths = map(lambda d_l: d_l[1], receiving_chain_lengths) return max(lengths, default=0) > self.heartbeat_after - def make_heartbeat(self, jid: JID) -> Message: + async def make_heartbeat(self, jid: JID) -> Message: """ Returns a heartbeat message. @@ -548,7 +548,7 @@ class XEP_0384(BasePlugin): """ msg = self.xmpp.make_message(mto=jid) - encrypted = self.encrypt_key_transport_message( + encrypted = await self.encrypt_key_transport_message( plaintext=None, recipients=[jid], expect_problems=None, @@ -644,8 +644,10 @@ class XEP_0384(BasePlugin): asyncio.ensure_future(self._publish_bundle()) if self.auto_heartbeat and self.should_heartbeat(): - msg = self.make_heartbeat(jid) - msg.send() + async def send_heartbeat(): + msg = await self.make_heartbeat(JID(jid)) + msg.send() + asyncio.ensure_future(send_heartbeat()) return body