libQuotient
A Qt library for building matrix clients
|
#include <user.h>
Public Slots | |
void | rename (const QString &newName) |
Set a new name in the global user profile. | |
void | rename (const QString &newName, Room *r) |
Set a new name for the user in one room. | |
void | removeAvatar () const |
Removes the avatar from the profile. | |
void | requestDirectChat () |
Create or find a direct chat with this user. | |
void | ignore () const |
Add the user to the ignore list. | |
void | unmarkIgnore () const |
Remove the user from the ignore list. | |
bool | isIgnored () const |
Check whether the user is in ignore list. | |
void | load () |
Force loading display name and avatar URL. | |
Signals | |
void | defaultNameChanged () |
The default name of the user has changed. | |
void | defaultAvatarChanged () |
The default avatar of the user has changed. | |
Public Member Functions | |
User (QString userId, Connection *connection) | |
Connection * | connection () const |
QString | id () const |
Get unique stable user id. | |
QString | name () const |
Get the default user name. | |
QString | displayname () const |
Get the name to show on the user's profile. | |
QString | fullName () const |
Get user's profilename and id in one string. | |
bool | isGuest () const |
Whether the user is a guest. | |
Avatar & | avatarObject () |
QString | avatarMediaId () const |
The default mxc URL as a string for the user avatar. | |
QUrl | avatarUrl () const |
The default mxc URL for the user avatar. | |
QImage | avatar (int width, int height, Avatar::get_callback_t callback) |
QImage | avatar (int dimension, Avatar::get_callback_t callback) |
Q_INVOKABLE bool | setAvatar (const QString &fileName) |
Upload the file and use it as an avatar. | |
Q_INVOKABLE bool | setAvatar (QIODevice *source) |
Upload contents of the QIODevice and set that as an avatar. | |
Properties | |
QString | id |
bool | isGuest |
QString | name |
QString | displayName |
QString | fullName |
QString | avatarMediaId |
QUrl | avatarUrl |
This class provides an interface to a given user's profile.
Quotient::User::User | ( | QString | userId, |
Connection * | connection | ||
) |
QImage Quotient::User::avatar | ( | int | dimension, |
Avatar::get_callback_t | callback | ||
) |
QImage Quotient::User::avatar | ( | int | width, |
int | height, | ||
Avatar::get_callback_t | callback | ||
) |
QString Quotient::User::avatarMediaId | ( | ) | const |
The default mxc URL as a string for the user avatar.
This can be empty if none set.
Avatar & Quotient::User::avatarObject | ( | ) |
QUrl Quotient::User::avatarUrl | ( | ) | const |
The default mxc URL for the user avatar.
This can be empty if none set.
Connection * Quotient::User::connection | ( | ) | const |
|
signal |
The default avatar of the user has changed.
|
signal |
The default name of the user has changed.
QString Quotient::User::displayname | ( | ) | const |
Get the name to show on the user's profile.
This is intended to always give you something that can be displayed in a UI. If the user doesn't have a default name or one is not available the user's matrix ID will be used.
QString Quotient::User::fullName | ( | ) | const |
Get user's profilename and id in one string.
This is intended to always give you something that can be displayed in a UI. If the user doesn't have a default name or one is not available the fucntion will return the user's matrix ID only.
QString Quotient::User::id | ( | ) | const |
Get unique stable user id.
The Matrix user ID is generated by the server and is never changed.
|
slot |
Add the user to the ignore list.
bool Quotient::User::isGuest | ( | ) | const |
Whether the user is a guest.
As of now, the function relies on the convention used in Synapse that guests and only guests have all-numeric IDs. This may or may not work with non-Synapse servers.
|
slot |
Check whether the user is in ignore list.
|
slot |
Force loading display name and avatar URL.
This is required in some cases where the you need a user's default details independent of the room, e.g. in a profile page.
QString Quotient::User::name | ( | ) | const |
Get the default user name.
This may be empty if the user has not set one.
|
slot |
Removes the avatar from the profile.
Set a new name in the global user profile.
Set a new name for the user in one room.
|
slot |
Create or find a direct chat with this user.
The resulting chat is returned asynchronously via Connection::directChatAvailable().
Q_INVOKABLE bool Quotient::User::setAvatar | ( | const QString & | fileName | ) |
Upload the file and use it as an avatar.
Q_INVOKABLE bool Quotient::User::setAvatar | ( | QIODevice * | source | ) |
Upload contents of the QIODevice and set that as an avatar.
|
slot |
Remove the user from the ignore list.