diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2016-04-11 12:43:32 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2016-04-11 12:45:00 +0900 |
commit | def5a08b4d360f6035ad4c420f0206ad6f96e0bd (patch) | |
tree | 65eea09fa684406cd6cc2a47bcba69e74b8cb3e8 /room.cpp | |
parent | 8045e36b6b8597120f46e0d4d42cf87ac790351b (diff) | |
download | libquotient-def5a08b4d360f6035ad4c420f0206ad6f96e0bd.tar.gz libquotient-def5a08b4d360f6035ad4c420f0206ad6f96e0bd.zip |
Factor out the code that searches an insertion point in a timeline.
This is used once in the library and, I guess, twice more in the
Quaternion. Implemented as a template function that is equally suitable
for Event and Message, and any container that supports STL-style
iterators (QList and other Qt containers do).
Diffstat (limited to 'room.cpp')
-rw-r--r-- | room.cpp | 10 |
1 files changed, 1 insertions, 9 deletions
@@ -284,15 +284,7 @@ Connection* Room::connection() void Room::processMessageEvent(Event* event) { - for( int i=0; i<d->messageEvents.count(); i++ ) - { - if( event->timestamp() < d->messageEvents.at(i)->timestamp() ) - { - d->messageEvents.insert(i, event); - return; - } - } - d->messageEvents.append(event); + d->messageEvents.insert(findInsertionPos(d->messageEvents, event), event); } void Room::processStateEvent(Event* event) |