aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/room.cpp14
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;
}