Skip to main content

Room

Struct Room 

Source
pub struct Room {
Show 43 fields matrix_room: OnceCell<Room>, session: WeakRef<Session>, room_id_string: PhantomData<String>, aliases: RoomAliases, name: RefCell<Option<String>>, has_avatar: Cell<bool>, topic: RefCell<Option<String>>, topic_linkified: RefCell<Option<String>>, category: Cell<RoomCategory>, is_direct: Cell<bool>, is_tombstoned: Cell<bool>, pub(super) predecessor_id: OnceCell<OwnedRoomId>, predecessor_id_string: PhantomData<Option<String>>, pub(super) successor_id: OnceCell<OwnedRoomId>, successor_id_string: PhantomData<Option<String>>, successor: WeakRef<Room>, pub(super) members: WeakRef<MemberList>, members_drop_guard: OnceCell<EventHandlerDropGuard>, joined_members_count: Cell<u64>, own_member: OnceCell<Member>, is_invite: Cell<bool>, inviter: RefCell<Option<Member>>, direct_member: RefCell<Option<Member>>, live_timeline: OnceCell<Timeline>, latest_activity: Cell<u64>, is_marked_unread: Cell<bool>, is_read: Cell<bool>, notification_count: Cell<u64>, has_notifications: Cell<bool>, highlight: Cell<HighlightFlags>, is_encrypted: Cell<bool>, join_rule: JoinRule, guests_allowed: Cell<bool>, history_visibility: Cell<HistoryVisibilityValue>, version: PhantomData<String>, federated: PhantomData<bool>, typing_list: TypingList, typing_drop_guard: OnceCell<EventHandlerDropGuard>, notifications_setting: Cell<NotificationsRoomSetting>, permissions: Permissions, verification: BoundObjectWeakRef<IdentityVerification>, is_room_info_initialized: Cell<bool>, attempted_auto_join: Cell<bool>,
}

Fields§

§matrix_room: OnceCell<Room>

The room API of the SDK.

§session: WeakRef<Session>

The current session.

§room_id_string: PhantomData<String>

The ID of this room, as a string.

§aliases: RoomAliases

The aliases of this room.

§name: RefCell<Option<String>>

The name that is set for this room.

This can be empty, the display name should be used instead in the interface.

§has_avatar: Cell<bool>

Whether this room has an avatar explicitly set.

This is false if there is no avatar or if the avatar is the one from the other member.

§topic: RefCell<Option<String>>

The topic of this room.

§topic_linkified: RefCell<Option<String>>

The linkified topic of this room.

This is the string that should be used in the interface when markup is allowed.

§category: Cell<RoomCategory>

The category of this room.

§is_direct: Cell<bool>

Whether this room is a direct chat.

§is_tombstoned: Cell<bool>

Whether this room has been upgraded.

§predecessor_id: OnceCell<OwnedRoomId>

The ID of the room that was upgraded and that this one replaces.

§predecessor_id_string: PhantomData<Option<String>>

The ID of the room that was upgraded and that this one replaces, as a string.

§successor_id: OnceCell<OwnedRoomId>

The ID of the successor of this Room, if this room was upgraded.

§successor_id_string: PhantomData<Option<String>>

The ID of the successor of this Room, if this room was upgraded, as a string.

§successor: WeakRef<Room>

The successor of this Room, if this room was upgraded and the successor was joined.

§members: WeakRef<MemberList>

The members of this room.

§members_drop_guard: OnceCell<EventHandlerDropGuard>§joined_members_count: Cell<u64>

The number of joined members in the room, according to the homeserver.

§own_member: OnceCell<Member>

The member corresponding to our own user.

§is_invite: Cell<bool>

Whether this room is a current invite or an invite that was declined or retracted.

§inviter: RefCell<Option<Member>>

The user who sent the invite to this room.

This is only set when this room is an invitation.

§direct_member: RefCell<Option<Member>>

The other member of the room, if this room is a direct chat and there is only one other member.

§live_timeline: OnceCell<Timeline>

The live timeline of this room.

§latest_activity: Cell<u64>

The timestamp of the room’s latest activity.

This is the timestamp of the latest event that counts as possibly unread.

If it is not known, it will return 0.

§is_marked_unread: Cell<bool>

Whether this room is marked as unread.

§is_read: Cell<bool>

Whether all messages of this room are read.

§notification_count: Cell<u64>

The number of unread notifications of this room.

§has_notifications: Cell<bool>

whether this room has unread notifications.

§highlight: Cell<HighlightFlags>

The highlight state of the room.

§is_encrypted: Cell<bool>

Whether this room is encrypted.

§join_rule: JoinRule

The join rule of this room.

§guests_allowed: Cell<bool>

Whether guests are allowed.

§history_visibility: Cell<HistoryVisibilityValue>

The visibility of the history.

§version: PhantomData<String>

The version of this room.

§federated: PhantomData<bool>

Whether this room is federated.

§typing_list: TypingList

The list of members currently typing in this room.

§typing_drop_guard: OnceCell<EventHandlerDropGuard>§notifications_setting: Cell<NotificationsRoomSetting>

The notifications settings for this room.

§permissions: Permissions

The permissions of our own user in this room

§verification: BoundObjectWeakRef<IdentityVerification>

An ongoing identity verification in this room.

§is_room_info_initialized: Cell<bool>

Whether the room info is initialized.

Used to silence logs during initialization.

§attempted_auto_join: Cell<bool>

Whether we already attempted an auto-join.

Implementations§

Source§

impl Room

Source

fn register_type()

Registers the type only once.

Source§

impl Room

Source

pub fn downgrade(&self) -> <Self as Downgrade>::Weak

Source§

impl Room

Source

pub(super) fn init( &self, matrix_room: MatrixRoom, metainfo: Option<RoomMetainfo>, )

Initialize this room.

Source

pub(super) fn matrix_room(&self) -> &MatrixRoom

The room API of the SDK.

Source

fn set_session(&self, session: &Session)

Set the current session

Source

pub(super) fn room_id(&self) -> &RoomId

The ID of this room.

Source

fn room_id_string(&self) -> String

The ID of this room, as a string.

Source

fn update_name(&self)

Update the name of this room.

Source

async fn update_display_name(&self)

Load the display name from the SDK.

Source

fn set_has_avatar(&self, has_avatar: bool)

Set whether this room has an avatar explicitly set.

Source

fn update_avatar(&self)

Update the avatar of the room.

Source

fn update_topic(&self)

Update the topic of this room.

Source

fn set_category(&self, category: RoomCategory)

Set the category of this room.

Source

pub(super) async fn update_category(&self)

Update the category from the SDK.

Source

async fn set_is_direct(&self, is_direct: bool)

Set whether this room is a direct chat.

Source

pub(super) async fn update_is_direct(&self)

Update whether the room is direct or not.

Source

fn update_tombstone(&self)

Update the tombstone for this room.

Source

pub(super) fn update_successor(&self)

Update the successor of this room.

Source

fn predecessor_id_string(&self) -> Option<String>

The ID of the room that was upgraded and that this one replaces, as a string.

Source

fn load_predecessor(&self)

Load the predecessor of this room.

Source

fn successor_id_string(&self) -> Option<String>

The ID of the successor of this room, if this room was upgraded.

Source

fn set_successor(&self, successor: &Room)

Set the successor of this room.

Source

fn watch_members(&self)

Watch changes in the members list.

Source

fn handle_member_event(&self, event: &SyncRoomMemberEvent)

Handle a member event received via sync

Source

fn set_joined_members_count(&self, count: u64)

Set the number of joined members in the room, according to the homeserver.

Source

pub(super) fn own_member(&self) -> &Member

The member corresponding to our own user.

Source

async fn load_own_member(&self)

Load our own member from the store.

Source

async fn update_is_invite(&self)

Update whether this room is a current invite or an invite that was declined or retracted.

Source

async fn was_membership(&self, membership: &MembershipState) -> bool

Check whether the previous membership of our user in this room matches the one that is given.

Source

async fn update_inviter(&self)

Update the member that invited us to this room.

Source

fn set_direct_member(&self, member: Option<Member>)

Set the other member of the room, if this room is a direct chat and there is only one other member.

Source

async fn direct_user_id(&self) -> Option<OwnedUserId>

The ID of the other user, if this is a direct chat and there is only one other user.

Source

async fn update_direct_member(&self)

Update the other member of the room, if this room is a direct chat and there is only one other member.

Source

fn init_live_timeline(&self)

Initialize the live timeline of this room.

Source

fn live_timeline(&self) -> &Timeline

The live timeline of this room.

Source

pub(super) fn set_latest_activity(&self, latest_activity: u64)

Set the timestamp of the room’s latest possibly unread event.

Source

async fn update_is_marked_unread(&self)

Update whether this room is marked as unread.

Source

fn set_is_read(&self, is_read: bool)

Set whether all messages of this room are read.

Source

async fn handle_read_change_trigger(&self)

Handle the trigger emitted when a read change might have occurred.

Source

fn set_highlight(&self, highlight: HighlightFlags)

Set how this room is highlighted.

Source

fn update_highlight(&self)

Update the highlight of the room from the current state.

Source

fn set_notification_count(&self, count: u64)

Set the number of unread notifications of this room.

Source

fn set_has_notifications(&self, has_notifications: bool)

Set whether this room has unread notifications.

Source

async fn update_is_encrypted(&self)

Update whether the room is encrypted from the SDK.

Source

fn update_guests_allowed(&self)

Update whether guests are allowed.

Source

fn update_history_visibility(&self)

Update the visibility of the history.

Source

fn version(&self) -> String

The version of this room.

Source

pub(super) fn rules(&self) -> RoomVersionRules

The rules for the version of this room.

Source

fn federated(&self) -> bool

Whether this room is federated.

Source

fn set_up_typing(&self)

Start listening to typing events.

Source

fn update_typing_list(&self, typing_user_ids: Vec<OwnedUserId>)

Update the typing list with the given user IDs.

Source

fn set_notifications_setting(&self, setting: NotificationsRoomSetting)

Set the notifications setting for this room.

Source

fn set_verification(&self, verification: Option<IdentityVerification>)

Set an ongoing verification in this room.

Source

fn watch_room_info(&self)

Watch the SDK’s room info for changes to the room state.

Source

async fn update_with_room_info(&self, room_info: RoomInfo)

Update this room with the given SDK room info.

Source

pub(super) fn handle_ambiguity_changes<'a>( &self, changes: impl Iterator<Item = &'a AmbiguityChange>, )

Handle changes in the ambiguity of members display names.

Source

fn watch_send_queue(&self)

Watch errors in the send queue to try to handle them.

Source

pub(super) async fn change_category( &self, category: TargetRoomCategory, ) -> MatrixResult<()>

Change the category of this room.

This makes the necessary to propagate the category to the homeserver.

This can be used to trigger actions like join or leave, as well as changing the category in the sidebar.

Note that rooms cannot change category once they are upgraded.

Trait Implementations§

Source§

impl Default for Room

Source§

fn default() -> Room

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

impl DerivedObjectProperties for Room

Source§

fn derived_properties() -> &'static [ParamSpec]

Properties installed for this type.
Source§

fn derived_property(&self, id: usize, pspec: &ParamSpec) -> Value

Similar to ObjectImpl but auto-generated by the Properties macro to allow handling more complex use-cases.
Source§

fn derived_set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)

Similar to ObjectImpl but auto-generated by the Properties macro to allow handling more complex use-cases.
Source§

impl ObjectImpl for Room

Source§

fn signals() -> &'static [Signal]

Signals installed for this type.
Source§

fn properties() -> &'static [ParamSpec]

Properties installed for this type.
Source§

fn set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)

Property setter. Read more
Source§

fn property(&self, id: usize, pspec: &ParamSpec) -> Value

Property getter. Read more
Source§

fn constructed(&self)

Constructed. Read more
Source§

fn dispose(&self)

Disposes of the object. Read more
Source§

fn notify(&self, pspec: &ParamSpec)

Function to be called when property change is notified for with self.notify("property").
Source§

fn dispatch_properties_changed(&self, pspecs: &[ParamSpec])

Source§

impl ObjectSubclass for Room

Source§

const NAME: &'static str = "Room"

GObject type name. Read more
Source§

type Interfaces = ()

List of interfaces implemented by this type.
Source§

type Class = ClassStruct<Room>

The C class struct. Read more
Source§

type Instance = InstanceStruct<Room>

The C instance struct. Read more
Source§

type Type = Room

Wrapper around this subclass defined with wrapper!
Source§

type ParentType = PillSource

Parent Rust type to inherit from.
Source§

fn new() -> Self

Constructor. Read more
Source§

const ABSTRACT: bool = false

If this subclass is an abstract class or not. Read more
Source§

const ALLOW_NAME_CONFLICT: bool = false

Allow name conflicts for this class. Read more
Source§

fn type_init(_type_: &mut InitializingType<Self>)

Additional type initialization. Read more
Source§

fn class_init(_klass: &mut Self::Class)

Class initialization. Read more
Source§

fn with_class(_klass: &Self::Class) -> Self

Constructor. Read more
Source§

fn instance_init(_obj: &InitializingObject<Self>)

Performs additional instance initialization. Read more
Source§

impl ObjectSubclassType for Room

Source§

fn type_data() -> NonNull<TypeData>

Storage for the type-specific data used during registration.
Source§

fn type_() -> Type

Returns the glib::Type ID of the subclass. Read more
Source§

impl PillSourceImpl for Room

Source§

fn identifier(&self) -> String

A unique identifier for this source.

Auto Trait Implementations§

§

impl !Freeze for Room

§

impl !RefUnwindSafe for Room

§

impl !Send for Room

§

impl !Sync for Room

§

impl Unpin for Room

§

impl UnsafeUnpin for Room

§

impl !UnwindSafe for Room

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

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

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
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
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
Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> ObjectImplExt for T
where T: ObjectImpl,

Source§

fn parent_constructed(&self)

Chain up to the parent class’ implementation of glib::Object::constructed().
Source§

fn parent_notify(&self, pspec: &ParamSpec)

Chain up to the parent class’ implementation of glib::Object::notify().
Source§

fn parent_dispatch_properties_changed(&self, pspecs: &[ParamSpec])

Chain up to the parent class’ implementation of glib::Object::dispatch_properties_changed().
Source§

fn signal_chain_from_overridden( &self, token: &SignalClassHandlerToken, values: &[Value], ) -> Option<Value>

Chain up to parent class signal handler.
Source§

impl<T> ObjectSubclassExt for T
where T: ObjectSubclass,

Source§

fn obj(&self) -> BorrowedObject<'_, <T as ObjectSubclass>::Type>

Returns the corresponding object instance. Read more
Source§

fn from_obj(obj: &<T as ObjectSubclass>::Type) -> &T

Returns the implementation from an instance. Read more
Source§

fn ref_counted(&self) -> ObjectImplRef<T>

Returns a new reference-counted wrapper around self.
Source§

fn instance_data<U>(&self, type_: Type) -> Option<&U>
where U: Any + Send + Sync + 'static,

Returns a pointer to the instance implementation specific data. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

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

Source§

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

impl<T> Any for T
where T: Any,

§

impl<T> JsonCastable<CanonicalJsonValue> for T

§

impl<T> JsonCastable<Value> for T