diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-01-18 19:25:52 +0100 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-01-18 19:25:52 +0100 |
commit | 142fc5a21f541e2a7592119df075a543527195b9 (patch) | |
tree | f38cd3f38465a0cf8b38c198b202e624fe939ae1 /lib/room.cpp | |
parent | ecbff4c1a21ff4c0ab72141bc1a34ae189d33483 (diff) | |
parent | bf82aeea369cacfc93a0e6d6d9feb01f1f2afdb2 (diff) | |
download | libquotient-142fc5a21f541e2a7592119df075a543527195b9.tar.gz libquotient-142fc5a21f541e2a7592119df075a543527195b9.zip |
Merge branch 'kitsune/cleanup2' into dev
Diffstat (limited to 'lib/room.cpp')
-rw-r--r-- | lib/room.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/room.cpp b/lib/room.cpp index edf5dcd9..55efb5b9 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -562,16 +562,14 @@ QStringList Room::pinnedEventIds() const { return d->getCurrentState<RoomPinnedEvent>()->pinnedEvents(); } -QVector< const Quotient::RoomEvent* > Quotient::Room::pinnedEvents() const +QVector<const Quotient::RoomEvent*> Quotient::Room::pinnedEvents() const { - QStringList events = d->getCurrentState<RoomPinnedEvent>()->pinnedEvents(); + const auto& pinnedIds = d->getCurrentState<RoomPinnedEvent>()->pinnedEvents(); QVector<const RoomEvent*> pinnedEvents; - QStringList::iterator i; - for (i = events.begin(); i != events.end(); ++i) { - auto timelineItem = findInTimeline(*i); - if (timelineItem != historyEdge()) - pinnedEvents.append(timelineItem->event()); - } + for (auto&& evtId: pinnedIds) + if (const auto& it = findInTimeline(evtId); it != historyEdge()) + pinnedEvents.append(it->event()); + return pinnedEvents; } |