Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Threema/libthreema/lib/src/model/   (Social Medium ©)  Datei vom 26.9.2026 mit Größe 3 kB image not shown  

Quelle  user_profile.rs   Sprache: Rust

 

//! User profile related structs.
use std::collections::HashSet;

use libthreema_macros::Name;

use crate::{
    common::{ChatServerGroup, ThreemaId, keys::ClientKey},
    model::profile::ProfilePicture,
    provider::ProviderError,
    work::properties::WorkAvailabilityStatus,
};

/// The user's identity data.
#[derive(Debug, Name)]
pub struct IdentityData {
    /// The user's identity.
    pub user_identity: ThreemaId,

    /// The user's client key.
    pub client_key: ClientKey,

    /// CSP server group.
    pub csp_server_group: ChatServerGroup,
}

/// Profile picture sharing policy.
#[derive(Clone, Debug, Default, Name)]
#[cfg_attr(test, derive(PartialEq))]
pub enum ProfilePictureSharePolicy {
    /// Do not share the profile picture with anyone.
    Nobody,

    /// Share the profile picture with everyone.
    #[default]
    Everyone,

    /// Share the profile picture only with explicitly listed contacts.
    ///
    /// Note: An empty set is valid and has the same effect as [`ProfilePictureSharePolicy::Nobody`].
    AllowList(HashSet<ThreemaId>),
}

/// A phone number identity link.
#[derive(Clone, Debug)]
#[cfg_attr(test, derive(PartialEq))]
#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
pub enum IdentityLinkPhoneNumber {
    /// Linked with a verified telephone number in E.164 format without leading `+`.
    PhoneNumber(String),

    /// A phone number is linked, but the actual number is unknown.
    Unknown,
}

/// An email address identity link.
#[derive(Clone, Debug)]
#[cfg_attr(test, derive(PartialEq))]
#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
pub enum IdentityLinkEmailAddress {
    /// Linked with a verified email address.
    EmailAddress(String),

    /// An email address is linked, but the actual email address is unknown.
    Unknown,
}

/// The user's profile.
#[derive(Clone, Debug, Default, Name)]
#[cfg_attr(test, derive(PartialEq))]
pub struct UserProfile {
    /// The nickname of the user.
    ///
    /// Empty string means that the user has no provided nickname.
    pub nickname: String,

    /// The user's profile picture.
    pub profile_picture: Option<ProfilePicture>,

    /// Profile picture share policy.
    pub profile_picture_share_policy: ProfilePictureSharePolicy,

    /// A phone number linked with the user's identity.
    pub linked_phone_number: Option<IdentityLinkPhoneNumber>,

    /// An email address linked with the user's identity.
    pub linked_email_address: Option<IdentityLinkEmailAddress>,

    /// The user's work availability status.
    pub work_availability_status: Option<WorkAvailabilityStatus>,
}

/// User profile storage interface.
pub trait UserProfileProvider {
    /// Set the user's profile.
    ///
    /// # Errors
    ///
    /// In case libthreema provides invalid parameters. Otherwise, this function is considered infallible and
    /// should not return an error.
    fn set(&mut self, user_profile: UserProfile) -> Result<(), ProviderError>;

    /// Return the user's profile.
    ///
    /// # Errors
    ///
    /// This function is considered infallible and should not return an error.
    fn get(&self) -> Result<UserProfile, ProviderError>;
}

Messung
CHZG
859610093

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet am  2026-11-04) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover


Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.