Age | Commit message (Collapse) | Author |
|
Closes #183. There's also the m.read part but it can be done sometime later, as it's pure optimisation.
|
|
|
|
Because we should practice what we preach in CONTRIBUTING.md.
|
|
Event::toTimestamp() duplicates fromJson<>() code, so it should go.
|
|
Since there's no such thing as "unread messages flag" in the CS API spec, there's now a non-standard key-value in cached m.read receipts for that.
|
|
The biggest change is we have no pimpls in Event objects anymore - because it's two new's instead of one per Event, and we have thousands and even more of Events created during initial sync. The other big change is introduction of RoomEvent, so that now the structure of events almost precisely reflects the CS API spec. The refactoring made UnknownEvent unnecessary as a separate class; a respective base class (either RoomEvent or Event) is used for this purpose now. All the other changes are consequences of these (mostly of RoomEvent introduction).
|
|
Mainly it's about const-ification (in particular, passing const-refs instead of values) and deleting unneeded declarations/#includes. Since the changes alter the external interface, this is submitted as a PR for peer review.
One of unneeded declarations/definitions is a virtual destructor in BaseJob descendants. Since a job object should be deleted through QObject::deleteLater() anyway (and it's the only correct way of disposing of the object), all deletions will call the stack of destructors through virtual QObject::~QObject(). Therefore even BaseJob could get on with a non-virtual destructor but for the sake of clarity BaseJob::~BaseJob() is still declared virtual.
|
|
Instead of QHash, use QVector< QPair<> > because it's more efficient and
we don't really need a hashmap functions, only direct iteration over the
list of event-to-receipt pairs. Also, iteration over QJsonObjects is
more efficient (and better conveys the intention) than collecting keys()
and then finding a value() for each of them. Also, fixed accidental
allocation of empty Receipt structures instead of reserving space for
them.
|
|
|
|
|
|
associated with Event objects anyway
|
|
The previous code had no effect because QVector<Receipt> was instantiated before Q_DECLARE_TYPEINFO occurence.
|
|
See https://marcmutz.wordpress.com/effective-qt/containers/ for the background and http://lists.qt-project.org/pipermail/development/2015-July/022283.html for the relevant flamewar in Qt dev mailing list.
|
|
|