diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-02-03 12:12:04 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-02-03 12:12:04 +0900 |
commit | c62180d910cc23b5360bbb0807d792f876f195a6 (patch) | |
tree | 656b744af4155b7b7c5f53e643367873d294bdde /user.h | |
parent | b34368907cba52954849bfb0266e119e5563eeb7 (diff) | |
parent | ffb8233d1b6ac54e37391e1949697ba8f6828f47 (diff) | |
download | libquotient-c62180d910cc23b5360bbb0807d792f876f195a6.tar.gz libquotient-c62180d910cc23b5360bbb0807d792f876f195a6.zip |
Merge branch 'master' into kitsune-gtad
Diffstat (limited to 'user.h')
-rw-r--r-- | user.h | 35 |
1 files changed, 29 insertions, 6 deletions
@@ -30,8 +30,10 @@ namespace QMatrixClient { Q_OBJECT Q_PROPERTY(QString id READ id CONSTANT) + Q_PROPERTY(bool isGuest READ isGuest CONSTANT) Q_PROPERTY(QString name READ name NOTIFY nameChanged) Q_PROPERTY(QString displayName READ displayname NOTIFY nameChanged STORED false) + Q_PROPERTY(QString fullName READ fullName NOTIFY nameChanged STORED false) Q_PROPERTY(QString bridgeName READ bridged NOTIFY nameChanged STORED false) Q_PROPERTY(QString avatarMediaId READ avatarMediaId NOTIFY avatarChanged STORED false) Q_PROPERTY(QUrl avatarUrl READ avatarUrl NOTIFY avatarChanged) @@ -39,26 +41,47 @@ namespace QMatrixClient User(QString userId, Connection* connection); ~User() override; - /** - * Returns the id of the user + /** Get unique stable user id + * User id is generated by the server and is not changed ever. */ QString id() const; - /** - * Returns the name chosen by the user + /** Get the name chosen by the user + * This may be empty if the user didn't choose the name or cleared + * it. + * \sa displayName */ QString name() const; - /** - * Returns the name that should be used to display the user. + /** Get the displayed user name + * This method returns the result of name() if its non-empty; + * otherwise it returns user id. This is convenient to show a user + * name outside of a room context. In a room context, user names + * should be disambiguated. + * \sa name, id, fullName Room::roomMembername */ QString displayname() const; + /** Get user name and id in one string + * The constructed string follows the format 'name (id)' + * used for users disambiguation in a room context and in other + * places. + * \sa displayName, Room::roomMembername + */ + QString fullName() const; + /** * Returns the name of bridge the user is connected from or empty. */ QString bridged() 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. + */ + bool isGuest() const; + const Avatar& avatarObject() const; Q_INVOKABLE QImage avatar(int dimension); Q_INVOKABLE QImage avatar(int requestedWidth, int requestedHeight); |