Struct matrix_sdk::room::RoomMember
source · pub struct RoomMember { /* private fields */ }
Expand description
The high-level RoomMember
representation
Implementations§
source§impl RoomMember
impl RoomMember
sourcepub async fn avatar(&self, format: MediaFormat) -> Result<Option<Vec<u8>>>
pub async fn avatar(&self, format: MediaFormat) -> Result<Option<Vec<u8>>>
Gets the avatar of this member, if set.
Returns the avatar. If a thumbnail is requested no guarantee on the size of the image is given.
§Arguments
format
- The desired format of the avatar.
§Examples
use matrix_sdk::{
media::MediaFormat, room::RoomMember, ruma::room_id, Client,
RoomMemberships,
};
let client = Client::new(homeserver).await.unwrap();
client.matrix_auth().login_username(user, "password").send().await.unwrap();
let room_id = room_id!("!roomid:example.com");
let room = client.get_room(&room_id).unwrap();
let members = room.members(RoomMemberships::empty()).await.unwrap();
let member = members.first().unwrap();
if let Some(avatar) = member.avatar(MediaFormat::File).await.unwrap() {
std::fs::write("avatar.png", avatar);
}
sourcepub async fn ignore(&self) -> Result<()>
pub async fn ignore(&self) -> Result<()>
Adds the room member to the current account data’s ignore list which will ignore the user across all rooms.
sourcepub async fn unignore(&self) -> Result<()>
pub async fn unignore(&self) -> Result<()>
Removes the room member from the current account data’s ignore list which will unignore the user across all rooms.
sourcepub fn is_account_user(&self) -> bool
pub fn is_account_user(&self) -> bool
Returns true if the member of the room is the user of the account
sourcepub fn suggested_role_for_power_level(&self) -> RoomMemberRole
pub fn suggested_role_for_power_level(&self) -> RoomMemberRole
Get the suggested role of this member based on their power level.
Methods from Deref<Target = BaseRoomMember>§
sourcepub fn event(&self) -> &Arc<SyncOrStrippedState<RoomMemberEventContent>>
pub fn event(&self) -> &Arc<SyncOrStrippedState<RoomMemberEventContent>>
Get the original member event
sourcepub fn display_name(&self) -> Option<&str>
pub fn display_name(&self) -> Option<&str>
Get the display name of the member if there is one.
sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Get the name of the member.
This returns either the display name or the local part of the user id if the member didn’t set a display name.
sourcepub fn avatar_url(&self) -> Option<&MxcUri>
pub fn avatar_url(&self) -> Option<&MxcUri>
Get the avatar url of the member, if there is one.
sourcepub fn normalized_power_level(&self) -> i64
pub fn normalized_power_level(&self) -> i64
Get the normalized power level of this member.
The normalized power level depends on the maximum power level that can be found in a certain room, positive values are always in the range of 0-100.
sourcepub fn power_level(&self) -> i64
pub fn power_level(&self) -> i64
Get the power level of this member.
sourcepub fn can_ban(&self) -> bool
pub fn can_ban(&self) -> bool
Whether this user can ban other users based on the power levels.
Same as member.can_do(PowerLevelAction::Ban)
.
sourcepub fn can_invite(&self) -> bool
pub fn can_invite(&self) -> bool
Whether this user can invite other users based on the power levels.
Same as member.can_do(PowerLevelAction::Invite)
.
sourcepub fn can_kick(&self) -> bool
pub fn can_kick(&self) -> bool
Whether this user can kick other users based on the power levels.
Same as member.can_do(PowerLevelAction::Kick)
.
sourcepub fn can_redact_own(&self) -> bool
pub fn can_redact_own(&self) -> bool
Whether this user can redact their own events based on the power levels.
Same as member.can_do(PowerLevelAction::RedactOwn)
.
sourcepub fn can_redact_other(&self) -> bool
pub fn can_redact_other(&self) -> bool
Whether this user can redact events of other users based on the power levels.
Same as member.can_do(PowerLevelAction::RedactOther)
.
sourcepub fn can_send_message(&self, msg_type: MessageLikeEventType) -> bool
pub fn can_send_message(&self, msg_type: MessageLikeEventType) -> bool
Whether this user can send message events based on the power levels.
Same as member.can_do(PowerLevelAction::SendMessage(msg_type))
.
sourcepub fn can_send_state(&self, state_type: StateEventType) -> bool
pub fn can_send_state(&self, state_type: StateEventType) -> bool
Whether this user can send state events based on the power levels.
Same as member.can_do(PowerLevelAction::SendState(state_type))
.
sourcepub fn can_pin_or_unpin_event(&self) -> bool
pub fn can_pin_or_unpin_event(&self) -> bool
Whether this user can pin or unpin events based on the power levels.
sourcepub fn can_trigger_room_notification(&self) -> bool
pub fn can_trigger_room_notification(&self) -> bool
Whether this user can notify everybody in the room by writing @room
in
a message.
Same as member. can_do(PowerLevelAction::TriggerNotification(NotificationPowerLevelType::Room))
.
sourcepub fn can_do(&self, action: PowerLevelAction) -> bool
pub fn can_do(&self, action: PowerLevelAction) -> bool
Whether this user can do the given action based on the power levels.
sourcepub fn name_ambiguous(&self) -> bool
pub fn name_ambiguous(&self) -> bool
Is the name that the member uses ambiguous in the room.
A name is considered to be ambiguous if at least one other member shares the same name.
sourcepub fn membership(&self) -> &MembershipState
pub fn membership(&self) -> &MembershipState
Get the membership state of this member.
sourcepub fn is_ignored(&self) -> bool
pub fn is_ignored(&self) -> bool
Is the room member ignored by the current account user
Trait Implementations§
source§impl Clone for RoomMember
impl Clone for RoomMember
source§fn clone(&self) -> RoomMember
fn clone(&self) -> RoomMember
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for RoomMember
impl Debug for RoomMember
Auto Trait Implementations§
impl Freeze for RoomMember
impl !RefUnwindSafe for RoomMember
impl Send for RoomMember
impl Sync for RoomMember
impl Unpin for RoomMember
impl !UnwindSafe for RoomMember
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> CompatExt for T
impl<T> CompatExt for T
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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