diff options
author | KitsuneRal <Kitsune-Ral@users.sf.net> | 2016-09-21 08:45:53 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-21 08:45:53 +0900 |
commit | 11dd106d8d99c187c22f7a37ce557daf25450e4b (patch) | |
tree | f1413ff18e50beb5e5f8859723b1b4070cdb9ced /events/event.h | |
parent | ac5ae85ed43d1f92cfc99bf1ea687d33f56ccd13 (diff) | |
parent | b1ca4264f25db826a98455698f1e05babd85eb26 (diff) | |
download | libquotient-11dd106d8d99c187c22f7a37ce557daf25450e4b.tar.gz libquotient-11dd106d8d99c187c22f7a37ce557daf25450e4b.zip |
Merge pull request #30 from Fxrh/fix-messages-ordering
Fix messages ordering
Diffstat (limited to 'events/event.h')
-rw-r--r-- | events/event.h | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/events/event.h b/events/event.h index a66f5e68..6b566be0 100644 --- a/events/event.h +++ b/events/event.h @@ -35,7 +35,7 @@ namespace QMatrixClient RoomMessage, RoomName, RoomAliases, RoomCanonicalAlias, RoomMember, RoomTopic, Typing, Receipt, Unknown }; - + class Event { public: @@ -61,28 +61,7 @@ namespace QMatrixClient }; using Events = QVector<Event*>; - Events eventsFromJson(const QJsonArray& contents); - - /** - * Finds a place in the timeline where a new event/message could be inserted. - * @return an iterator to an item with the earliest timestamp after - * the one of 'item'; or timeline.end(), if all events are earlier - */ - template <class ItemT, class ContT> - typename ContT::iterator - findInsertionPos(ContT & timeline, const ItemT *item) - { - return std::lower_bound (timeline.begin(), timeline.end(), item, - [](const typename ContT::value_type a, const ItemT * b) { - // FIXME: We should not order the message list by origin timestamp. - // Rather, an order of receiving should be used (which actually - // poses a question on whether this method is needed at all - - // or we'd just prepend and append, depending on whether we - // received something from /sync or from /messages. - return a->timestamp() < b->timestamp(); - } - ); - } + Events eventsFromJson(const QJsonArray& json); /** * @brief Lookup a value by a key in a varargs list |