pub struct MessageSender<S> { /* private fields */ }
Implementations§
Source§impl<S> MessageSender<S>
impl<S> MessageSender<S>
pub fn new( identified_ws: SignalWebSocket, unidentified_ws: SignalWebSocket, service: PushService, cipher: ServiceCipher<S>, protocol_store: S, local_aci: impl Into<Aci>, local_pni: impl Into<Pni>, aci_identity: IdentityKeyPair, pni_identity: Option<IdentityKeyPair>, device_id: DeviceId, ) -> Self
Sourcepub async fn upload_attachment<R: Rng + CryptoRng>(
&mut self,
spec: AttachmentSpec,
contents: Vec<u8>,
csprng: &mut R,
) -> Result<AttachmentPointer, AttachmentUploadError>
pub async fn upload_attachment<R: Rng + CryptoRng>( &mut self, spec: AttachmentSpec, contents: Vec<u8>, csprng: &mut R, ) -> Result<AttachmentPointer, AttachmentUploadError>
Encrypts and uploads an attachment
Contents are accepted as an owned, plain text Vec, because encryption happens in-place.
Sourcepub async fn send_message(
&mut self,
recipient: &ServiceId,
unidentified_access: Option<UnidentifiedAccess>,
message: impl Into<ContentBody>,
timestamp: u64,
include_pni_signature: bool,
online: bool,
) -> SendMessageResult
pub async fn send_message( &mut self, recipient: &ServiceId, unidentified_access: Option<UnidentifiedAccess>, message: impl Into<ContentBody>, timestamp: u64, include_pni_signature: bool, online: bool, ) -> SendMessageResult
Send a message content
to a single recipient
.
Sourcepub async fn send_message_to_group(
&mut self,
recipients: impl AsRef<[(ServiceId, Option<UnidentifiedAccess>, bool)]>,
message: impl Into<ContentBody>,
timestamp: u64,
online: bool,
) -> Vec<SendMessageResult> ⓘ
pub async fn send_message_to_group( &mut self, recipients: impl AsRef<[(ServiceId, Option<UnidentifiedAccess>, bool)]>, message: impl Into<ContentBody>, timestamp: u64, online: bool, ) -> Vec<SendMessageResult> ⓘ
Send a message to the recipients in a group.
Recipients are a list of tuples, each containing:
- The recipient’s address
- The recipient’s unidentified access
- Whether the recipient requires a PNI signature
Sourcepub async fn send_contact_details<Contacts>(
&mut self,
recipient: &ServiceId,
unidentified_access: Option<UnidentifiedAccess>,
contacts: Contacts,
online: bool,
complete: bool,
) -> Result<(), MessageSenderError>where
Contacts: IntoIterator<Item = ContactDetails>,
pub async fn send_contact_details<Contacts>(
&mut self,
recipient: &ServiceId,
unidentified_access: Option<UnidentifiedAccess>,
contacts: Contacts,
online: bool,
complete: bool,
) -> Result<(), MessageSenderError>where
Contacts: IntoIterator<Item = ContactDetails>,
Upload contact details to the CDN and send a sync message
Sourcepub async fn send_configuration(
&mut self,
recipient: &ServiceId,
configuration: Configuration,
) -> Result<(), MessageSenderError>
pub async fn send_configuration( &mut self, recipient: &ServiceId, configuration: Configuration, ) -> Result<(), MessageSenderError>
Send Configuration
synchronization message
Sourcepub async fn send_message_request_response(
&mut self,
recipient: &ServiceId,
thread: &ThreadIdentifier,
action: Type,
) -> Result<(), MessageSenderError>
pub async fn send_message_request_response( &mut self, recipient: &ServiceId, thread: &ThreadIdentifier, action: Type, ) -> Result<(), MessageSenderError>
Send MessageRequestResponse
synchronization message with either a recipient ACI or a GroupV2 ID
Sourcepub async fn send_keys(
&mut self,
recipient: &ServiceId,
keys: Keys,
) -> Result<(), MessageSenderError>
pub async fn send_keys( &mut self, recipient: &ServiceId, keys: Keys, ) -> Result<(), MessageSenderError>
Send Keys
synchronization message
Sourcepub async fn send_sync_message_request(
&mut self,
recipient: &ServiceId,
request_type: Type,
) -> Result<(), MessageSenderError>
pub async fn send_sync_message_request( &mut self, recipient: &ServiceId, request_type: Type, ) -> Result<(), MessageSenderError>
Send a Keys
request message
Trait Implementations§
Source§impl<S: Clone> Clone for MessageSender<S>
impl<S: Clone> Clone for MessageSender<S>
Source§fn clone(&self) -> MessageSender<S>
fn clone(&self) -> MessageSender<S>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<S> Freeze for MessageSender<S>where
S: Freeze,
impl<S> !RefUnwindSafe for MessageSender<S>
impl<S> Send for MessageSender<S>where
S: Send,
impl<S> Sync for MessageSender<S>where
S: Sync,
impl<S> Unpin for MessageSender<S>where
S: Unpin,
impl<S> !UnwindSafe for MessageSender<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more