diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/room.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/room.cpp b/lib/room.cpp index 7ff8f5e9..1931be49 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -89,11 +89,6 @@ class Room::Private Room* q; - // This updates the room displayname field (which is the way a room - // should be shown in the room list) It should be called whenever the - // list of members or the room name (m.room.name) or canonical alias change. - void updateDisplayname(); - Connection* connection; QString id; JoinState joinState; @@ -179,6 +174,14 @@ class Room::Private void renameMember(User* u, QString oldName); void removeMemberFromMap(const QString& username, User* u); + // This updates the room displayname field (which is the way a room + // should be shown in the room list); called whenever the list of + // members, the room name (m.room.name) or canonical alias change. + void updateDisplayname(); + // This is used by updateDisplayname() but only calculates the new name + // without any updates. + QString calculateDisplayname() const; + /// A point in the timeline corresponding to baseState rev_iter_t timelineBase() const { return q->findInTimeline(-1); } @@ -278,7 +281,6 @@ class Room::Private template<typename ContT> users_shortlist_t buildShortlist(const ContT& users) const; users_shortlist_t buildShortlist(const QStringList& userIds) const; - QString calculateDisplayname() const; bool isLocalUser(const User* u) const { @@ -293,6 +295,7 @@ Room::Room(Connection* connection, QString id, JoinState initialJoinState) // See "Accessing the Public Class" section in // https://marcmutz.wordpress.com/translated-articles/pimp-my-pimpl-%E2%80%94-reloaded/ d->q = this; + d->displayname = d->calculateDisplayname(); // Set initial "Empty room" name qCDebug(MAIN) << "New" << toCString(initialJoinState) << "Room:" << id; } |