aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-05-09Allow to get a Connection object of the RoomKitsune Ral
It's just natural, after all, Connection is a parent of Room. But seriously, this will be needed when we have rooms from different Connections living next to each other.
2017-05-09Code cleanup and tweaking (partially driven by clang-tidy)Kitsune Ral
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.
2017-05-08Make QNetworkAccessManager member a singletonKitsune Ral
As Qt documentation advises, a single QNetworkAccessManager is enough for the whole Qt application.
2017-05-01Merge pull request #61 from elvisangelaccio/qloggingcategoryKitsune Ral
Port to categorized logging
2017-04-30Port to categorized loggingElvis Angelaccio
This greatly reduces the noise made by quaternion. To enable full logging, export the following variable: QT_LOGGING_RULES="libqmatrixclient.*.debug=true"
2017-04-20Merge pull request #60 from elvisangelaccio/dont-discard-avatarsKitsune Ral
Don't discard avatars as well
2017-04-19Don't discard avatars as wellElvis Angelaccio
Same workaround as in commit 836f35dc7d, but this time also for avatars.
2017-04-18Added markAllMessagesAsRead()Kitsune Ral
2017-04-18Use localeAwareCompare() to sort room membersKitsune Ral
Because it's a recommended by Qt method to sort end-user-facing lists.
2017-04-17Merge pull request #59 from elvisangelaccio/fix-displaynameKitsune Ral
Don't discard user display names upon leave membership events
2017-04-17Don't discard user display names upon leave membership eventsElvis Angelaccio
Otherwise the following QJsonObject will discard a valid display name in RoomMemberEvent::fromJson(): QJsonObject({"content":{"membership":"leave"},"event_id":"$14905359301189950PoADM:matrix.org","membership":"leave","origin_server_ts":1490535930821,"sender":"@elvisangelaccio:matrix.org","state_key":"@elvisangelaccio:matrix.org","type":"m.room.member","unsigned":{"age":1887090448,"prev_content":{"avatar_url":"mxc://matrix.org/PuDxgBQfeplXbCQFvOGpTEmC","displayname":"eang","membership":"join"},"prev_sender":"@elvisangelaccio:matrix.org","replaces_state":"$14905358091189487gXwtE:matrix.org"}})
2017-04-16Make sure message body is treated as plain textKitsune Ral
The previous code deviated from the spec, trying to guess on the content type of body as if there could be HTML in some cases. The spec openly states that 'body' value should always be in plain text.
2017-04-14Enable PostMessageJob to send rich text messagesKitsune Ral
2017-04-13Use own copy of MIME database on WindowsKitsune Ral
The one that comes with Qt as a fallback is from 2012 (even from newer Qt versions) and is missing many common content types.
2017-04-05Make Room data Q_PROPERTY's so that they could be accessed from QML tooKitsune Ral
2017-04-04Merge pull request #58 from elvisangelaccio/masterKitsune Ral
You've got the point. Merged this.
2017-04-04Don't extend the spec when calculating the display nameElvis Angelaccio
Room names conflicts should be handled at the client level, for example by displaying the canonical alias in a tooltip or in the custom delegate of the view. If we extend the display name algorithm at the lib level, we are just cluttering the display name in the most common scenario (i.e. when there are no name clashes).
2017-04-02Renamed JobHttpType to more fitting HttpVerb; removed Job from enum valuesKitsune Ral
2017-04-02Rotten comments fixesKitsune Ral
2017-04-01Merge pull request #57 from elvisangelaccio/default-avatarKitsune Ral
Couldn't find anything cross-platform to track theme changes, so just merging this. Thanks!
2017-03-30Fixed accidental auto-promotion when read marker is out of sightKitsune Ral
2017-03-27Map QNetworkReply::UnknownContentError to BaseJob::IncorrectRequestErrorKitsune Ral
This is what /join returns if I supply garbage for the alias.
2017-03-28Merge pull request #56 from Fxrh/kitsune-retry-on-some-errorsKitsune Ral
Jobs retry functionality for recoverable errors
2017-03-26Provide a default avatarElvis Angelaccio
If the user doesn't have a custom avatar set, show a default avatar instead of nothing. This fixes a misalignment in the tableview between users with and without a custom avatar. Since libqmatrixclient doesn't recognize yet if a user is online or offline, just use the `user-available` standard [1] icon for now. [1]: https://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.htmli
2017-03-25Split connectionError into networkError and syncErrorKitsune Ral
When SyncJob retries, networkError is emitted; if it fails entirely, either loginError or syncError, depending on the kind of failure.
2017-03-25Stop sync upon successful logoutKitsune Ral
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