libQuotient
A Qt library for building matrix clients
|
Representation of a user state in a room. More...
#include <roommember.h>
Public Member Functions | |
RoomMember ()=default | |
RoomMember (const Room *room, const RoomMemberEvent *member) | |
bool | isEmpty () const |
bool | operator== (const RoomMember &other) const |
QString | id () const |
Get unique stable user id. More... | |
Uri | uri () const |
The matrix.to URI for the user. More... | |
bool | isLocalMember () const |
Whether this member is the local user. More... | |
Membership | membershipState () const |
The membership state of the member. More... | |
QString | name () const |
The raw unmodified display name for the user in the given room. More... | |
QString | displayName () const |
Get the user display name ready for display. More... | |
QString | htmlSafeDisplayName () const |
Get the user display name ready for display. More... | |
QString | fullName () const |
Get user name and id in a single string. More... | |
QString | htmlSafeFullName () const |
Get user name and id in a single string. More... | |
QString | disambiguatedName () const |
Get the disambiguated user name. More... | |
QString | htmlSafeDisambiguatedName () const |
Get the disambiguated user name. More... | |
Q_INVOKABLE bool | matches (QStringView substr, Qt::CaseSensitivity cs=Qt::CaseSensitive) const |
Check whether the name or id of the member contains a substring. More... | |
int | hue () const |
Hue color component of this user based on the user's Matrix ID. More... | |
qreal | hueF () const |
HueF color component of this user based on the user's Matrix ID. More... | |
QColor | color () const |
Color based on the user's Matrix ID. More... | |
const Avatar & | avatarObject () const |
QString | avatarMediaId () const |
The mxc URL as a string for the user avatar in the room. More... | |
QUrl | avatarUrl () const |
The mxc URL for the user avatar in the room. More... | |
QImage | avatar (int width, int height, Avatar::get_callback_t callback) const |
QImage | avatar (int dimension, Avatar::get_callback_t callback) const |
int | powerLevel () const |
The power level of the member. More... | |
Properties | |
Q_GADGETbool | isEmpty |
QString | id |
Uri | uri |
bool | isLocalMember |
QString | displayName |
QString | htmlSafeDisplayName |
QString | fullName |
QString | htmlSafeFullName |
QString | disambiguatedName |
QString | htmlSafeDisambiguatedName |
int | hue |
qreal | hueF |
QColor | color |
QUrl | avatarUrl |
int | powerLevel |
Representation of a user state in a room.
The class is intentionally a read-only data object that is effectively a wrapper around an m.room.member
event for the desired user. This is designed to provide the data in a format ready for visualizing a user (avatar or name) in the context of the room it was generated in. This means that if a user has set a unique name or avatar for a particular room that is what will be returned.
Definition at line 32 of file roommember.h.
|
default |
|
explicit |
QImage Quotient::RoomMember::avatar | ( | int | dimension, |
Avatar::get_callback_t | callback | ||
) | const |
QImage Quotient::RoomMember::avatar | ( | int | width, |
int | height, | ||
Avatar::get_callback_t | callback | ||
) | const |
QString Quotient::RoomMember::avatarMediaId | ( | ) | const |
The mxc URL as a string for the user avatar in the room.
This can be empty if none set.
const Avatar& Quotient::RoomMember::avatarObject | ( | ) | const |
QUrl Quotient::RoomMember::avatarUrl | ( | ) | const |
The mxc URL for the user avatar in the room.
This can be empty if none set.
QColor Quotient::RoomMember::color | ( | ) | const |
Color based on the user's Matrix ID.
See https://github.com/quotient-im/libQuotient/wiki/User-color-coding-standard-draft-proposal for the methodology.
QString Quotient::RoomMember::disambiguatedName | ( | ) | const |
Get the disambiguated user name.
This function always aims to return something that can be displayed in a UI, so if no display name is set the just user's Matrix ID will be returned. The output is equivalent to fullName() if there is another user in the room with the same name. Otherwise it is equivalent to displayName().
The output is sanitized and suitable for a plain text field. For a rich field use htmlSafeDisambiguatedName().
QString Quotient::RoomMember::displayName | ( | ) | const |
Get the user display name ready for display.
This function always aims to return something that can be displayed in a UI, so if no display name is set the user's Matrix ID will be returned.
The output is sanitized and suitable for a plain text field. For a rich field use htmlSafeDisplayName().
QString Quotient::RoomMember::fullName | ( | ) | const |
Get user name and id in a single string.
This function always aims to return something that can be displayed in a UI, so if no display name is set the just user's Matrix ID will be returned. The constructed string follows the format 'name (id)' which the spec recommends for users disambiguation in a room context and in other places.
The output is sanitized and suitable for a plain text field. For a rich field use htmlSafeFullName().
QString Quotient::RoomMember::htmlSafeDisambiguatedName | ( | ) | const |
Get the disambiguated user name.
This function always aims to return something that can be displayed in a UI, so if no display name is set the just user's Matrix ID will be returned. The output is equivalent to htmlSafeFullName() if there is another user in the room with the same name. Otherwise it is equivalent to htmlSafeDisplayName().
The output is sanitized and html escaped ready for a rich text field. For a plain field use disambiguatedName().
QString Quotient::RoomMember::htmlSafeDisplayName | ( | ) | const |
Get the user display name ready for display.
This function always aims to return something that can be displayed in a UI, so if no display name is set the user's Matrix ID will be returned.
The output is sanitized and html escaped ready for a rich text field. For a plain field use displayName().
QString Quotient::RoomMember::htmlSafeFullName | ( | ) | const |
Get user name and id in a single string.
This function always aims to return something that can be displayed in a UI, so if no display name is set the just user's Matrix ID will be returned. The constructed string follows the format 'name (id)' which the spec recommends for users disambiguation in a room context and in other places.
The output is sanitized and html escaped ready for a rich text field. For a plain field use fullName().
int Quotient::RoomMember::hue | ( | ) | const |
Hue color component of this user based on the user's Matrix ID.
The implementation is based on XEP-0392: https://xmpp.org/extensions/xep-0392.html Naming and ranges are the same as QColor's hue methods: https://doc.qt.io/qt-5/qcolor.html#integer-vs-floating-point-precision
qreal Quotient::RoomMember::hueF | ( | ) | const |
HueF color component of this user based on the user's Matrix ID.
The implementation is based on XEP-0392: https://xmpp.org/extensions/xep-0392.html Naming and ranges are the same as QColor's hue methods: https://doc.qt.io/qt-5/qcolor.html#integer-vs-floating-point-precision
QString Quotient::RoomMember::id | ( | ) | const |
Get unique stable user id.
The Matrix user ID is generated by the server and is never changed.
|
inline |
Definition at line 55 of file roommember.h.
bool Quotient::RoomMember::isLocalMember | ( | ) | const |
Whether this member is the local user.
Q_INVOKABLE bool Quotient::RoomMember::matches | ( | QStringView | substr, |
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Check whether the name or id of the member contains a substring.
This is useful for a predicate to filter room members.
Membership Quotient::RoomMember::membershipState | ( | ) | const |
The membership state of the member.
QString Quotient::RoomMember::name | ( | ) | const |
The raw unmodified display name for the user in the given room.
The value will be empty if no display name has been set.
bool Quotient::RoomMember::operator== | ( | const RoomMember & | other | ) | const |
int Quotient::RoomMember::powerLevel | ( | ) | const |
The power level of the member.
This is in the context of the current room. Will return the default power level for the room if not specifically set.
Uri Quotient::RoomMember::uri | ( | ) | const |
The matrix.to URI for the user.
Typically used when you want to visit a user (see Quotient::UriResolverBase::visitResource()).
|
read |
Definition at line 33 of file roommember.h.
|
read |
Definition at line 33 of file roommember.h.
|
read |
Definition at line 33 of file roommember.h.
|
read |
Definition at line 33 of file roommember.h.
|
read |
Definition at line 33 of file roommember.h.
|
read |
Definition at line 33 of file roommember.h.
|
read |
Definition at line 33 of file roommember.h.
|
read |
Definition at line 33 of file roommember.h.
|
read |
Definition at line 33 of file roommember.h.
|
read |
Definition at line 33 of file roommember.h.
|
read |
Definition at line 33 of file roommember.h.
|
read |
Definition at line 33 of file roommember.h.
|
read |
Definition at line 33 of file roommember.h.
|
read |
Definition at line 33 of file roommember.h.
|
read |
Definition at line 33 of file roommember.h.