aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2016-09-21 07:29:25 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2016-09-21 07:29:25 +0900
commitb1ca4264f25db826a98455698f1e05babd85eb26 (patch)
treef1413ff18e50beb5e5f8859723b1b4070cdb9ced
parent9ad7029587829aee5c4c21768b7b4831096f1593 (diff)
downloadlibquotient-b1ca4264f25db826a98455698f1e05babd85eb26.tar.gz
libquotient-b1ca4264f25db826a98455698f1e05babd85eb26.zip
Fixed the order of historical messages
-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)