From fd25e2ef3e0c38a1c25a25e6e49aedb1cd66011e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20F=C3=A9ron?= Date: Mon, 20 Nov 2023 10:34:46 +0100 Subject: [PATCH] Enforce selecting a mode when receiving messages --- presage/src/manager/registered.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/presage/src/manager/registered.rs b/presage/src/manager/registered.rs index 1af2c938b..6fcf8803b 100644 --- a/presage/src/manager/registered.rs +++ b/presage/src/manager/registered.rs @@ -470,15 +470,13 @@ impl Manager { /// Starts receiving and storing messages. /// + /// As a client, it is heavily recommended to run this once in `ReceivingMode::InitialSync` once + /// before enabling the possiblity of sending messages. That way, all possible updates (sessions, profile keys, sender keys) + /// are processed _before_ trying to encrypt and send messages which might fail otherwise. + /// /// Returns a [futures::Stream] of messages to consume. Messages will also be stored by the implementation of the [Store]. pub async fn receive_messages( &mut self, - ) -> Result, Error> { - self.receive_messages_stream(ReceivingMode::Forever).await - } - - pub async fn receive_messages_with_mode( - &mut self, mode: ReceivingMode, ) -> Result, Error> { self.receive_messages_stream(mode).await