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,

source

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

source

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.

source

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.

source

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
source

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

source

pub async fn send_configuration( &mut self, recipient: &ServiceAddress, configuration: Configuration, ) -> Result<(), MessageSenderError>

Send Configuration synchronization message

source

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

source

pub async fn send_keys( &mut self, recipient: &ServiceAddress, keys: Keys, ) -> Result<(), MessageSenderError>

Send Keys synchronization message

source

pub async fn send_sync_message_request( &mut self, recipient: &ServiceAddress, request_type: Type, ) -> Result<(), MessageSenderError>

Send a Keys request message

Trait Implementations§

source§

impl<Service: Clone, S: Clone, R: Clone> Clone for MessageSender<Service, S, R>

source§

fn clone(&self) -> MessageSender<Service, S, R>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<Service, S, R> Freeze for MessageSender<Service, S, R>
where Service: Freeze, R: Freeze, S: Freeze,

§

impl<Service, S, R> !RefUnwindSafe for MessageSender<Service, S, R>

§

impl<Service, S, R> Send for MessageSender<Service, S, R>
where Service: Send, R: Send, S: Send,

§

impl<Service, S, R> Sync for MessageSender<Service, S, R>
where Service: Sync, R: Sync, S: Sync,

§

impl<Service, S, R> Unpin for MessageSender<Service, S, R>
where Service: Unpin, R: Unpin, S: Unpin,

§

impl<Service, S, R> !UnwindSafe for MessageSender<Service, S, R>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> MaybeSend for T