summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-02-20 02:38:41 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-02-20 02:38:41 +0100
commit264a85b9e41321ad61f0adf5efa0cd0faa2cf263 (patch)
treee872d741016236c4118d6a97f41fc3bffbed291d /src
parentFix login with SSO and Password supported (diff)
downloadnheko-264a85b9e41321ad61f0adf5efa0cd0faa2cf263.tar.xz
Avoid some copies when sorting the room list
Diffstat (limited to 'src')
-rw-r--r--src/RoomInfoListItem.h2
-rw-r--r--src/RoomList.cpp8
2 files changed, 6 insertions, 4 deletions
diff --git a/src/RoomInfoListItem.h b/src/RoomInfoListItem.h

index baa8b98b..c2826f6f 100644 --- a/src/RoomInfoListItem.h +++ b/src/RoomInfoListItem.h
@@ -217,4 +217,6 @@ private: QColor bubbleBgColor_; QColor bubbleFgColor_; + + friend struct room_sort; }; diff --git a/src/RoomList.cpp b/src/RoomList.cpp
index 67a7ac40..10042c94 100644 --- a/src/RoomList.cpp +++ b/src/RoomList.cpp
@@ -353,8 +353,8 @@ RoomList::updateRoomDescription(const QString &roomid, const DescInfo &info) struct room_sort { - bool operator()(const QSharedPointer<RoomInfoListItem> a, - const QSharedPointer<RoomInfoListItem> b) const + bool operator()(const QSharedPointer<RoomInfoListItem> &a, + const QSharedPointer<RoomInfoListItem> &b) const { // Sort by "importance" (i.e. invites before mentions before // notifs before new events before old events), then secondly @@ -370,9 +370,9 @@ struct room_sort // Now sort by recency // Zero if empty, otherwise the time that the event occured const uint64_t a_recency = - a->lastMessageInfo().userid.isEmpty() ? 0 : a->lastMessageInfo().timestamp; + a->lastMsgInfo_.userid.isEmpty() ? 0 : a->lastMsgInfo_.timestamp; const uint64_t b_recency = - b->lastMessageInfo().userid.isEmpty() ? 0 : b->lastMessageInfo().timestamp; + b->lastMsgInfo_.userid.isEmpty() ? 0 : b->lastMsgInfo_.timestamp; return a_recency > b_recency; } };