Skip to content

Commit

Permalink
Enforce selecting a mode when receiving messages
Browse files Browse the repository at this point in the history
  • Loading branch information
gferon committed Nov 20, 2023
1 parent 676cf3a commit fd25e2e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions presage/src/manager/registered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,15 +470,13 @@ impl<S: Store> Manager<S, Registered> {

/// 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<impl Stream<Item = Content>, Error<S::Error>> {
self.receive_messages_stream(ReceivingMode::Forever).await
}

pub async fn receive_messages_with_mode(
&mut self,
mode: ReceivingMode,
) -> Result<impl Stream<Item = Content>, Error<S::Error>> {
self.receive_messages_stream(mode).await
Expand Down

0 comments on commit fd25e2e

Please sign in to comment.