aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-03-25Jobs retry on network and timeout errorsKitsune Ral
As of now, the retry logic (see BaseJob::finishJob() method) invokes the same network request several times with increasing timeouts and retry intervals. Some additional signals and accessors are also provided to control the behaviour from inheriting classes (see a notable example with SyncJob in the same commit) and clients (support of retries in Quaternion comes in a respective commit shortly).
2017-03-25Simplified formatJson definitionKitsune Ral
Fixed the "formatJson unused" warning with that.
2017-03-24Connection::joinRoom now returns a job object pointerKitsune Ral
So now you can directly connect to signals emitted by the job, instead of making intermediate signals in Connection for the same thing.
2017-03-24BaseJob: Add more error statesKitsune Ral
This should help to provide more reasonable error messages when a particular resource is not found or entered data are outright incorrect.
2017-03-24Added a missing #includeKitsune Ral
2017-03-21Fixed to work with older MinGWKitsune Ral
At least MinGW 4.8 (bundled with Qt 5.2.1 for Windows) crashes with internal error on lambdas-in-lambdas.
2017-03-20Added an example of libqmatrixclient usageKitsune Ral
Compile and run with your username and password as the first two arguments.
2017-03-16Log RoomMessagesJob's parametersKitsune Ral
2017-03-16Fixed warnings about a static lambda defined but unusedKitsune Ral
2017-03-16Aligned README.md with the one of QuaternionKitsune Ral
2017-03-16Merge pull request #55 from Fxrh/kitsune-timeline-itemsKitsune Ral
2017-03-14Room: exposed findInTimeline and related things from Room::PrivateKitsune Ral
This will be used from Quaternion for a better algorithm dealing with read markers
2017-03-10Use special indices instead of iterators for persistent pointers into ↵Kitsune Ral
timeline + no more discarding read markers to events that haven't arrived yet When using deque::const_reverse_iterator for read markers and eventsIndex, I didn't realise that insertions into std::deque invalidate iterators (though preserve references and pointers). Therefore, a small TimelineItem class has been introduced that stores an event together with a persistent index that is generated upon insertion into the timeline (timeline.back()+1 for newer events, timeline.front()-1 for older events). Using such indices, we can still reach an event by it's index in constant time, while avoiding a problem with invalidating iterators. While rewriting the code, another problem has been detected with read markers to events that haven't yet arrived to the timeline (in particular, older events). The old code simply discarded such read markers. The new code stores such read markers anyway, so that when that event arrives, it could be matched against the stored last-read-event id.
2017-03-09Fixed building with VS2013Kitsune Ral
2017-03-09Reduce noise in logsKitsune Ral
2017-03-09Merge pull request #54 from Fxrh/kitsune-call-serverKitsune Ral
Connection::callApi + Room::getPreviousMessages(limit)
2017-03-08Room::getPreviousContent() gets a number of messages + Room::postMessage()Kitsune Ral
Also, Room now uses callApi<PostReceiptJob>() instead of postReceipt() (to allow further removal of postReceipt() from Connection)
2017-03-08Connection::callApi<>, a factory for all API call jobsKitsune Ral
This call (intended to only be used within the lib) creates a job object of the passed type and passes a ConnectionData pointer to its constructor. This allows to avoid making a switchboard of methods on Connection for the whole API, leaving only those that naturally belong there - e.g. joinRoom() or sync() - and moving, e.g., postMessage() to where it belongs - Room. PostMessageJob and RoomMessagesJob were updated along the way, to unbind from the Room class (which they really don't and won't need).
2017-03-08Merge pull request #53 from Fxrh/kitsune-fix-adding-eventsKitsune Ral
Fix adding events to the timeline
2017-03-06Fixed building with MSVCKitsune Ral
2017-02-28Room: Make sure an event with the same id isn't added twice to the timeline; ↵Kitsune Ral
forbid empty event id's Added assertions and enhanced debug messages along the way
2017-02-28Renamed logging_util.h to util.h and moved (improved) Owning<> and lookup() ↵Kitsune Ral
there Because these fall outside of SyncJob and Event context, respectively. In addition, Owning<> has gained a move assignment operator (because we have a move constructor) and assign() convenience method to take ownership over an existing container; also, Owning<>::release() is done the right way now (the previous version was copying the return value to a new container instead of releasing the old container).
2017-02-28Parse event id for all events; timestamp for all except typing and receiptsKitsune Ral
This is not quite correct because only room events are guaranteed by the spec to have an id and a timestamp. But we don't parse all room events as of yet, so that's a way to at least make those attributes universally available for even unknown room events. It matters, because read receipts can refer to any room event id and because we'll use event id's to filter out duplicate events in further commits; and missing timestamps used to break the timeline display (showing <> instead of <valid timestamps>).
2017-02-26Skip read events with an empty event idKitsune Ral
2017-02-23Receipts internal handling improvedKitsune Ral
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.
2017-01-27Merge pull request #52 from Fxrh/kitsune-reverse-iteratorsKitsune Ral
Room: Use reverse iterators internally to deal with read markers
2017-01-17Room: Use reverse iterators internally to deal with read markersKitsune Ral
Turns out that because the read marker is positioned _after_ the last read message, a reverse iterator models it much better than the usual one. This commit switches the internal representation to reverse iterators (externally, we operate in terms of event id's, still).
2017-01-11Merge pull request #51 from Fxrh/kitsune-traceable-eventsKitsune Ral
Make events traceable
2017-01-08Simplified Room::Private::readMarker() codeKitsune Ral
2016-11-26Room: provide ability to find an event in the timeline by its idKitsune Ral
A new hashmap, eventsIndex, is provided, that allows you to find the event in the timeline if you have eventId. This hashmap uses the fact that deque iterators don't invalidate upon insertion of elements to either end of the deque. Thanks to that, promoteReadMarker() and doAddNewMessageEvents() have been considerably simplified; also, it should be easier now to calculate event indices without rolling back and forth over the timeline.
2016-11-26Room: use std::deque for the timelineKitsune Ral
2016-11-26CleanupKitsune Ral
2016-11-25Merge pull request #46 from maralorn/crop-avatarKitsuneRal
Crop avatar to ensure it has exactly the wanted size; Fixes memory leak #45
2016-11-25Merge pull request #48 from Fxrh/kitsune-unread-messages-in-libKitsuneRal
Unread messages implementation in the library
2016-11-14Merge branch 'pragma-once'Kitsune Ral
2016-11-14Removed no more used filesKitsune Ral
2016-11-07Fixed a crasher that slipped in the previous commitKitsune Ral
Room::Private::member() filters out non-members of the room, which is not the right thing when adding messages from a person that left the room, e.g.
2016-11-07Room::doAddNewMessages: Extend auto-promotion to all users, not only localKitsune Ral
Thanks to @maralorn for pointing out.
2016-11-07Merge pull request #49 from Fxrh/kitsune-cleanupKitsuneRal
Cleanup upon code inspection in CLion
2016-11-06Use #pragma once everywhereMalte Brandy
2016-11-06Room: extend promoteReadMarker over non-local users (again)Kitsune Ral
2016-11-03Auto-promote the read marker over locally-originated messagesKitsune Ral
2016-11-02Room: make read marker a Q_PROPERTY; markMessagesAsRead now uses eventId againKitsune Ral
The first change allows to use the read marker from QML (hint to Tensor). The second change is actually a fix for a case when markMessagesAsRead() is called with an iterator behind the last read event (in that case markMessagesAsRead() would post a receipt for that older event, which is not quite right).
2016-11-01Removed unused codeKitsune Ral
These parts are either deprecated or just unlikely to be reused in the current form. Breaks Quaternion master as of now (it #includes logmessage.h).
2016-11-01Receipt: eventId is extraneous inside the receipt, since receipts are ↵Kitsune Ral
associated with Event objects anyway
2016-11-01Moved MemberNameSorter from Quaternion to libKitsune Ral
This code is useful for any client that uses the Room class and needs to display the list of room members. Also removed an unused #include.
2016-11-01Removed unused #includesKitsune Ral
2016-10-31Code cleanup upon inspection in CLionKitsune Ral
These changes are most harmless; a no more used Private class removed, and an incorrect signal specification in connect() fixed. Also, one explicit #include has been added, just in case.
2016-10-28Relax logging a bitKitsune Ral
Kicking markMessagesAsRead() at each mouse move is still a bad idea - I'm looking at you Quaternion.
2016-10-28Implemented unread messages indication on the lib sideKitsune Ral
The implementation allows further extension to actually counting unread messages (in their Room::isEventNotable() sense - see the code) but so far just replicates what Quaternion previously provided. The only difference from the Quaternion implementation is that last own message is not marked as read immediately - so that we can allow the local user to send messages while staying with the read marker well above. This implies, though, that the read marker won't reset to the timeline bottom at any movement of the user - rather that it resets to the bottom of the current view (which is the ultimately correct behaviour, anyway).