diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2016-09-21 07:29:25 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2016-09-21 07:29:25 +0900 |
commit | b1ca4264f25db826a98455698f1e05babd85eb26 (patch) | |
tree | f1413ff18e50beb5e5f8859723b1b4070cdb9ced | |
parent | 9ad7029587829aee5c4c21768b7b4831096f1593 (diff) | |
download | libquotient-b1ca4264f25db826a98455698f1e05babd85eb26.tar.gz libquotient-b1ca4264f25db826a98455698f1e05babd85eb26.zip |
Fixed the order of historical messages
-rw-r--r-- | room.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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) |