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§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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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