Type Alias PossiblyRedactedRoomMemberEventContent

Source
pub type PossiblyRedactedRoomMemberEventContent = RoomMemberEventContent;
Expand description

The possibly redacted form of RoomMemberEventContent.

This type is used when it’s not obvious whether the content is redacted or not.

Aliased Type§

struct PossiblyRedactedRoomMemberEventContent {
    pub avatar_url: Option<OwnedMxcUri>,
    pub displayname: Option<String>,
    pub is_direct: Option<bool>,
    pub membership: MembershipState,
    pub third_party_invite: Option<ThirdPartyInvite>,
    pub blurhash: Option<String>,
    pub reason: Option<String>,
    pub join_authorized_via_users_server: Option<OwnedUserId>,
}

Fields§

§avatar_url: Option<OwnedMxcUri>

The avatar URL for this user, if any.

This is added by the homeserver. If you activate the compat-empty-string-null feature, this field being an empty string in JSON will result in None here during deserialization.

§displayname: Option<String>

The display name for this user, if any.

This is added by the homeserver.

§is_direct: Option<bool>

Flag indicating whether the room containing this event was created with the intention of being a direct chat.

§membership: MembershipState

The membership state of this user.

§third_party_invite: Option<ThirdPartyInvite>

If this member event is the successor to a third party invitation, this field will contain information about that invitation.

§blurhash: Option<String>
Available on crate feature unstable-msc2448 only.

The BlurHash for the avatar pointed to by avatar_url.

This uses the unstable prefix in MSC2448.

§reason: Option<String>

User-supplied text for why their membership has changed.

For kicks and bans, this is typically the reason for the kick or ban. For other membership changes, this is a way for the user to communicate their intent without having to send a message to the room, such as in a case where Bob rejects an invite from Alice about an upcoming concert, but can’t make it that day.

Clients are not recommended to show this reason to users when receiving an invite due to the potential for spam and abuse. Hiding the reason behind a button or other component is recommended.

§join_authorized_via_users_server: Option<OwnedUserId>

Arbitrarily chosen UserId (MxID) of a local user who can send an invite.

Implementations

Source§

impl RoomMemberEventContent

Source

pub fn new(membership: MembershipState) -> RoomMemberEventContent

Creates a new RoomMemberEventContent with the given membership state.

Source

pub fn details(&self) -> MembershipDetails<'_>

Obtain the details about this event that are required to calculate a membership change.

This is required when you want to calculate the change a redacted m.room.member event made.

Source

pub fn membership_change<'a>( &'a self, prev_details: Option<MembershipDetails<'a>>, sender: &UserId, state_key: &UserId, ) -> MembershipChange<'a>

Helper function for membership change.

This requires data from the full event:

  • The previous details computed from event.unsigned.prev_content,
  • The sender of the event,
  • The state key of the event.

Check the specification for details.

Trait Implementations

Source§

impl Clone for RoomMemberEventContent

Source§

fn clone(&self) -> RoomMemberEventContent

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 RoomMemberEventContent

Source§

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

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

impl<'de> Deserialize<'de> for RoomMemberEventContent

Source§

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

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

impl EventContent for RoomMemberEventContent

Source§

type EventType = StateEventType

The Rust enum for the event kind’s known types.
Source§

fn event_type(&self) -> <RoomMemberEventContent as EventContent>::EventType

Get the event’s type, like m.room.message.
Source§

impl PossiblyRedactedStateEventContent for RoomMemberEventContent

Source§

type StateKey = OwnedUserId

The type of the event’s state_key field.
Source§

impl RedactContent for RoomMemberEventContent

Source§

type Redacted = RedactedRoomMemberEventContent

The redacted form of the event’s content.
Source§

fn redact(self, version: &RoomVersionId) -> RedactedRoomMemberEventContent

Transform self into a redacted form (removing most or all fields) according to the spec. Read more
Source§

impl Serialize for RoomMemberEventContent

Source§

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

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

impl StateEventContent for RoomMemberEventContent

Source§

type StateKey = OwnedUserId

The type of the event’s state_key field.
Source§

impl StaticEventContent for RoomMemberEventContent

Source§

const TYPE: &'static str = "m.room.member"

The event type.
Source§

impl StaticStateEventContent for RoomMemberEventContent

Source§

type PossiblyRedacted = RoomMemberEventContent

The possibly redacted form of the event’s content.
Source§

type Unsigned = RoomMemberUnsigned

The type of the event’s unsigned field.