aboutsummaryrefslogtreecommitdiff
path: root/room.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'room.cpp')
-rw-r--r--room.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/room.cpp b/room.cpp
index b7c6450d..e08b45e8 100644
--- a/room.cpp
+++ b/room.cpp
@@ -409,10 +409,9 @@ void Room::addHistoricalMessageEvents(const Events& events)
void Room::doAddHistoricalMessageEvents(const Events& events)
{
- // Preserver the order of messages when inserting the block in the
- // beginning of the container.
- std::reverse_copy(events.begin(), events.end(),
- std::front_inserter(d->messageEvents));
+ // Historical messages arrive in newest-to-oldest order
+ d->messageEvents.reserve(d->messageEvents.size() + events.size());
+ std::copy(events.begin(), events.end(), std::front_inserter(d->messageEvents));
}
void Room::processStateEvents(const Events& events)