deltachat::contact

Struct ContactId

source
pub struct ContactId(u32);
Expand description

Contact ID, including reserved IDs.

Some contact IDs are reserved to identify special contacts. This type can represent both the special as well as normal contacts.

Tuple Fields§

§0: u32

Implementations§

source§

impl ContactId

source

pub const UNDEFINED: ContactId = _

Undefined contact. Used as a placeholder for trashed messages.

source

pub const SELF: ContactId = _

The owner of the account.

The email-address is set by set_config using “addr”.

source

pub const INFO: ContactId = _

ID of the contact for info messages.

source

pub const DEVICE: ContactId = _

ID of the contact for device messages.

source

pub(crate) const LAST_SPECIAL: ContactId = _

source

pub const DEVICE_ADDR: &'static str = "device@localhost"

Address to go with ContactId::DEVICE.

This is used by APIs which need to return an email address for this contact.

source

pub const fn new(id: u32) -> ContactId

Creates a new ContactId.

source

pub fn is_special(&self) -> bool

Whether this is a special ContactId.

Some ContactIds are reserved for special contacts like ContactId::SELF, ContactId::INFO and ContactId::DEVICE. This function indicates whether this ContactId is any of the reserved special ContactIds (true) or whether it is the ContactId of a real contact (false).

source

pub const fn to_u32(&self) -> u32

Numerical representation of the ContactId.

Each contact ID has a unique numerical representation which is used in the database (via [rusqlite::ToSql]) and also for FFI purposes. In Rust code you should never need to use this directly.

source

pub(crate) async fn mark_bot( &self, context: &Context, is_bot: bool, ) -> Result<()>

Mark contact as bot.

source

pub(crate) async fn regossip_keys(&self, context: &Context) -> Result<()>

Reset gossip timestamp in all chats with this contact.

source

pub(crate) async fn scaleup_origin( context: &Context, ids: &[Self], origin: Origin, ) -> Result<()>

Updates the origin of the contacts, but only if origin is higher than the current one.

source

pub async fn addr(&self, context: &Context) -> Result<String>

Returns contact address.

source

pub async fn reset_encryption(self, context: &Context) -> Result<()>

Resets encryption with the contact.

Effect is similar to receiving a message without Autocrypt header from the contact, but this action is triggered manually by the user.

For example, this will result in sending the next message to 1:1 chat unencrypted, but will not remove existing verified keys.

source§

impl ContactId

source

async fn get_stock_name_n_addr(self, context: &Context) -> String

Get contact name and address for stock string, e.g. Bob (bob@example.net)

source

async fn get_stock_name(self, context: &Context) -> String

Get contact name, e.g. Bob, or bob@example.net if no name is set.

Trait Implementations§

source§

impl Clone for ContactId

source§

fn clone(&self) -> ContactId

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

impl Debug for ContactId

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ContactId

source§

fn default() -> ContactId

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for ContactId

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for ContactId

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl FromSql for ContactId

Allow converting an SQLite integer directly into ContactId.

source§

fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self>

Converts SQLite value into Rust value.
source§

impl Hash for ContactId

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for ContactId

source§

fn cmp(&self, other: &ContactId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for ContactId

source§

fn eq(&self, other: &ContactId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for ContactId

source§

fn partial_cmp(&self, other: &ContactId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for ContactId

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl ToSql for ContactId

Allow converting ContactId to an SQLite type.

source§

fn to_sql(&self) -> Result<ToSqlOutput<'_>>

Converts Rust value to SQLite value
source§

impl Copy for ContactId

source§

impl Eq for ContactId

source§

impl StructuralPartialEq for ContactId

Auto Trait Implementations§

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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§

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
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

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

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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> Same for T

source§

type Output = T

Should always be Self
source§

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

source§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

source§

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>,

source§

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

§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T

§

impl<T> PeerIdentity for T

source§

impl<T> RuleType for T
where T: Copy + Debug + Eq + Hash + Ord,