Skip to main content

Module profile

Module profile 

Source

Re-exportsΒ§

use std::borrow::Cow; πŸ”’
use std::collections::BTreeMap; πŸ”’
use std::sync::Arc; πŸ”’
use futures::Stream; πŸ”’
use futures::StreamExt; πŸ”’
use futures::TryStreamExt; πŸ”’
use futures::future::Either; πŸ”’
use futures::future::join; πŸ”’
use futures::stream::empty; πŸ”’
use ruma::CanonicalJsonObject; πŸ”’
use ruma::CanonicalJsonValue; πŸ”’
use ruma::MxcUri; πŸ”’
use ruma::OwnedMxcUri; πŸ”’
use ruma::OwnedRoomId; πŸ”’
use ruma::OwnedUserId; πŸ”’
use ruma::RoomId; πŸ”’
use ruma::UserId; πŸ”’
use ruma::api::federation::query::get_profile_information; πŸ”’
use ruma::events::StateEventType; πŸ”’
use ruma::events::room::member::MembershipState; πŸ”’
use ruma::events::room::member::RoomMemberEventContent; πŸ”’
use ruma::profile::ProfileFieldName; πŸ”’
use ruma::profile::ProfileFieldValue; πŸ”’
use serde::Deserialize; πŸ”’
use serde::Deserialize; πŸ”’
use serde_json::Value; πŸ”’
use tuwunel_core::Err; πŸ”’
use tuwunel_core::Result; πŸ”’
use tuwunel_core::err; πŸ”’
use tuwunel_core::implement; πŸ”’
use tuwunel_core::smallvec::SmallVec; πŸ”’
use tuwunel_core::utils::BoolExt; πŸ”’
use tuwunel_core::utils::MutexMap; πŸ”’
use tuwunel_core::utils::MutexMapGuard; πŸ”’
use tuwunel_core::utils::ReadyExt; πŸ”’
use tuwunel_core::utils::future::TryExtExt; πŸ”’
use tuwunel_core::utils::result::NotFound; πŸ”’
use tuwunel_core::utils::stream::IterStream; πŸ”’
use tuwunel_core::utils::stream::TryIgnore; πŸ”’
use tuwunel_core::utils::stream::TryReadyExt; πŸ”’
use tuwunel_core::utils::stream::automatic_width; πŸ”’
use tuwunel_core::warn; πŸ”’
use tuwunel_database::Deserialized; πŸ”’
use tuwunel_database::Ignore; πŸ”’
use tuwunel_database::Interfix; πŸ”’
use tuwunel_database::Json; πŸ”’
use tuwunel_database::KeyVal; πŸ”’
use tuwunel_database::Map; πŸ”’
use tuwunel_database::Txn; πŸ”’
use tuwunel_database::deserialize_from_slice; πŸ”’
use tuwunel_database::serialize_key; πŸ”’
use tuwunel_matrix::PduBuilder; πŸ”’
use tuwunel_matrix::pdu::Content; πŸ”’

ModulesΒ§

remote πŸ”’

StructsΒ§

Service

EnumsΒ§

Propagation
Per-update policy for fanning a global profile change out to each of the user’s joined rooms as a fresh m.room.member event. Mirrors the MSC4466 propagate_to axis.

ConstantsΒ§

MAX_AVATAR_URL_LENGTH πŸ”’
MAX_DISPLAYNAME_LENGTH
Maximum local display name length, in characters.
MAX_KEY_LENGTH πŸ”’
MSC4133 maximum profile field-name length, in bytes.
MAX_PROFILE_SIZE πŸ”’
MSC4133 maximum total profile size (64 KiB), measured over the JSON of the full profile including displayname and avatar_url.
MAX_STATUS_EMOJI_LENGTH πŸ”’
MSC4426 maximum m.status emoji length, in bytes.
MAX_STATUS_TEXT_LENGTH πŸ”’
MSC4426 maximum m.status text length, in bytes.
MAX_TIMEZONE_COMPONENTS πŸ”’
Maximum number of /-separated components in an m.tz name.
MAX_TIMEZONE_LENGTH πŸ”’
Maximum m.tz length, in bytes.

FunctionsΒ§

avatar_matches πŸ”’
Whether the member’s avatar reads as url.
changed_writes πŸ”’
Returns the profile writes that change the member event.
check_avatar_mxc πŸ”’
check_avatar_url πŸ”’
check_avatar_url_length πŸ”’
check_call πŸ”’
Validate an MSC4426 call indicator.
check_displayname πŸ”’
Bound a display name by its character budget.
check_displayname_length πŸ”’
check_field_length πŸ”’
Bound a display name or avatar URL by its length budget.
check_length πŸ”’
Bound one profile value by its length budget.
check_member_avatar_url
Validates a member event’s avatar URL.
check_member_content
Validates a client-supplied m.room.member content from any route that accepts one.
check_member_displayname
Bounds a member event’s display name, in characters.
check_member_size
Bounds the canonical size of a client-supplied m.room.member content, in bytes.
check_profile_key πŸ”’
Validate a profile field name against the Common Namespaced Identifier Grammar: a lowercase-leading identifier over [a-z0-9_.-], matching the reference homeserver. Length is bounded separately by MAX_KEY_LENGTH.
check_profile_value πŸ”’
Validate a profile field value against the schema of the proposal naming the field.
check_status πŸ”’
Validate an MSC4426 status against its two required fields and their byte budgets.
check_timezone πŸ”’
Validate an MSC4175 time zone against the shape of an IANA Time Zone Database name.
field_matches πŸ”’
Whether the member’s name field reads as value.
holds_current πŸ”’
is_timezone_component πŸ”’
Test one /-separated component of an m.tz name.
is_timezone_name πŸ”’
Test a string against the tzfile naming rules, narrowed to what every name the database ships actually uses.
member_holds πŸ”’
overlay_holds πŸ”’
overlay_member_content πŸ”’
Overlays the profile writes onto the previous member content.
string_field
Pairs a profile field with the string a write stores in it.
write_field πŸ”’

Type AliasesΒ§

ChangeKeyVal πŸ”’
A row of the profile change log: the field’s name rides the key so that a write covering several fields needs one count, and the value names the user for the rows keyed by room.
ChangedFields πŸ”’
The field names one write actually changes, almost always just the one the caller named.
ChangedWrites πŸ”’
ClearedFields πŸ”’
The field names a profile holds when it is cleared.
ProfileChange
One logged profile write: the user whose profile was written, and the name of a field the write logged.
ProfileLock πŸ”’
ProfileValue
One field of a profile write: the name and the value to store, or None to clear it.
ProspectiveProfile πŸ”’
The stored profile as it would read after candidate fields are written.