Struct libsignal_service::sender::MessageSender
source · pub struct MessageSender<Service, S, R> { /* private fields */ }
Expand description
Equivalent of Java’s SignalServiceMessageSender
.
Implementations§
source§impl<Service, S, R> MessageSender<Service, S, R>where
Service: PushService,
S: ProtocolStore + SenderKeyStore + SessionStoreExt + Sync + Clone,
R: Rng + CryptoRng,
impl<Service, S, R> MessageSender<Service, S, R>where
Service: PushService,
S: ProtocolStore + SenderKeyStore + SessionStoreExt + Sync + Clone,
R: Rng + CryptoRng,
pub fn new( identified_ws: SignalWebSocket, unidentified_ws: SignalWebSocket, service: Service, cipher: ServiceCipher<S, R>, csprng: R, protocol_store: S, local_aci: impl Into<ServiceAddress>, local_pni: impl Into<ServiceAddress>, aci_identity: IdentityKeyPair, pni_identity: Option<IdentityKeyPair>, device_id: DeviceId, ) -> Self
sourcepub async fn upload_attachment(
&mut self,
spec: AttachmentSpec,
contents: Vec<u8>,
) -> Result<AttachmentPointer, AttachmentUploadError>
pub async fn upload_attachment( &mut self, spec: AttachmentSpec, contents: Vec<u8>, ) -> 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: &ServiceAddress,
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: &ServiceAddress, 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<[(ServiceAddress, 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<[(ServiceAddress, 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: &ServiceAddress,
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: &ServiceAddress,
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: &ServiceAddress,
configuration: Configuration,
) -> Result<(), MessageSenderError>
pub async fn send_configuration( &mut self, recipient: &ServiceAddress, configuration: Configuration, ) -> Result<(), MessageSenderError>
Send Configuration
synchronization message
sourcepub async fn send_message_request_response(
&mut self,
recipient: &ServiceAddress,
thread: &ThreadIdentifier,
action: Type,
) -> Result<(), MessageSenderError>
pub async fn send_message_request_response( &mut self, recipient: &ServiceAddress, 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: &ServiceAddress,
keys: Keys,
) -> Result<(), MessageSenderError>
pub async fn send_keys( &mut self, recipient: &ServiceAddress, keys: Keys, ) -> Result<(), MessageSenderError>
Send Keys
synchronization message
sourcepub async fn send_sync_message_request(
&mut self,
recipient: &ServiceAddress,
request_type: Type,
) -> Result<(), MessageSenderError>
pub async fn send_sync_message_request( &mut self, recipient: &ServiceAddress, request_type: Type, ) -> Result<(), MessageSenderError>
Send a Keys
request message
Trait Implementations§
Auto Trait Implementations§
impl<Service, S, R> Freeze for MessageSender<Service, S, R>
impl<Service, S, R> !RefUnwindSafe for MessageSender<Service, S, R>
impl<Service, S, R> Send for MessageSender<Service, S, R>
impl<Service, S, R> Sync for MessageSender<Service, S, R>
impl<Service, S, R> Unpin for MessageSender<Service, S, R>
impl<Service, S, R> !UnwindSafe for MessageSender<Service, S, R>
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,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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>
§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> 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