diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-04-27 13:34:52 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-04-27 13:34:52 +0900 |
commit | 3a763fd470b8aeffa3d412e6f605231492fb5b0c (patch) | |
tree | 4759fe9eb980f5de1b0bca7dabfeecdc75668b30 /lib | |
parent | e74e48507f68e36c289c5dbe4b75f32a6910f3c1 (diff) | |
download | libquotient-3a763fd470b8aeffa3d412e6f605231492fb5b0c.tar.gz libquotient-3a763fd470b8aeffa3d412e6f605231492fb5b0c.zip |
Fix broken User::displayName() logic
Also, add an assert to Connection::user() to make sure it doesn't create users with invalid ids. Closes #201.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/connection.cpp | 1 | ||||
-rw-r--r-- | lib/user.cpp | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp index 241fa43d..f2bbf903 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -590,6 +590,7 @@ Room* Connection::invitation(const QString& roomId) const User* Connection::user(const QString& userId) { + Q_ASSERT(userId.startsWith('@') && userId.contains(':')); if( d->userMap.contains(userId) ) return d->userMap.value(userId); auto* user = userFactory(this, userId); diff --git a/lib/user.cpp b/lib/user.cpp index 88d20276..c4fbfe35 100644 --- a/lib/user.cpp +++ b/lib/user.cpp @@ -311,7 +311,7 @@ QString User::displayname(const Room* room) const { auto name = d->nameForRoom(room); return name.isEmpty() ? d->userId : - room ? room->roomMembername(name) : name; + room ? room->roomMembername(this) : name; } QString User::fullName(const Room* room) const |