From b1ca4264f25db826a98455698f1e05babd85eb26 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Wed, 21 Sep 2016 07:29:25 +0900 Subject: Fixed the order of historical messages --- room.cpp | 7 +++---- 1 file 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) -- cgit v1.2.3