aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2021-09-09Straighten up file transfer cancellationAlexey Rusakov
There was a mess with fileTransferCancelled(); it was only emitted when a download (but not an upload) was cancelled; besides, in case of downloads a file transfer info structure was getting deleted whereas uploads left a file transfer in Cancelled status. This all now converges on: - fileTransferFailed() for both failures and cancellations (to simplify slot connection, and also to follow the practice in, e.g., Qt Network). - the file transfer info structure is kept around in Cancelled status, following the logic used for failures. There's no particular cleanup which may become a problem if one uploads and cancels many times (download file transfers are keyed to event ids, mitigating the problem); this will be fixed in another commit. Closes #503. Closes #504.
2021-09-07Fix showing non-animated ImagesTobias Fella
2021-09-05Create a NAM for each threadTobias Fella
2021-09-05Implement the mxc protocol in the NetworkAccessManagerTobias Fella
Allows images to be loaded using the NetworkAccessManager instead of an ImageProvider
2021-09-02Merge pull request #495 from quotient-im/kitsune-ci-windows-codeqlAlexey Rusakov
CI: add Windows, CodeQL
2021-09-01Fix building with MSVCAlexey Rusakov
Turned out it was broken, and I was looking the other way.
2021-08-31Add functions and macros to query for Quotient's versionTobias Fella
2021-08-30Room: displayNameForHtmlAlexey Rusakov
This is useful for cases when the room display name is returned to QML that doesn't have an equivalent of QString::toHtmlEscaped().
2021-08-30SettingsGroup, AccountSettings: simplify constructorsAlexey Rusakov
The parameter packs intended to pass organisation/application names to QSettings never worked that way since Quotient::Settings didn't have that parameter pack in its constructor. On the other hand, setting organisation/application name using static methods before constructing the first settings object has been working just fine so far. If someone needs to create a settings object with customised org/app name for some reason (sneaking settings from other apps?), those can be brought back in a working manner and without breaking API/ABI even.
2021-08-26Add AccountRegistryTobias Fella
Basic session management class; Created from Quaternion's AccountRegistry and NeoChat's AccountListModel. The connections can be accessed by the user's id, this technically limits it to one connection for each matrix account.
2021-08-23Room: isMember(); memberState() only needs user idAlexey Rusakov
Room::memberJoinState() was only used to check if the user has joined the room (it couldn't be used for anything else), meaning that its best replacement is actually not memberState() but isMember() introduced hereby. It's also better to pass user ids instead of User objects to memberState() and isMember() since that is enough to check membership. # Conflicts: # lib/room.cpp # lib/room.h
2021-08-23Merge branch 'kitsune/deprecations'Alexey Rusakov
2021-08-22User::isGuest(): fix a clazy warningAlexey Rusakov
2021-08-22Fix building with MSVCAlexey Rusakov
2021-08-22RoomEvent: drop timestamp()Alexey Rusakov
Use originTimestamp(); the corresponding Q_PROPERTY was not renamed (in error) so it is now.
2021-08-22Settings: no more setToken() and accessToken(); deprecate clearAccessToken()Alexey Rusakov
Access tokens should be stored with Qt Keychain that's about to come; and these methods were deprecated since before 0.5.
2021-08-22Use Q_DECL_DEPRECATED_X instead of \deprecated doc-commentAlexey Rusakov
This still works with older moc yet produces actual warnings when compiling C++ code.
2021-08-22Drop other stuff deprecated pre- or early 0.6Alexey Rusakov
BaseJob: StatusCode::JsonParseError Connection: resolved() and reconnected() signals; roomMap(); postReceipt() User: bridged() and rawName() ConnectionData: setHost() and setPort() StateEventBase: prev_content()
2021-08-22Drop QMatrixClient namespace aliasAlexey Rusakov
2021-08-22Deprecate BaseJob::DataAlexey Rusakov
The grand plan is to get rid of `BaseJob` and turn job invocations to function calls returning `QFuture`. `RequestData` will stay though, feeding data into those calls.
2021-08-22Regenerate API filesAlexey Rusakov
2021-08-21CleanupAlexey Rusakov
2021-08-10Turn EventStatus from a class to a namespaceAlexey Rusakov
This wrapper only exists for an enum inside of it and dates back to times when Qt meta-object system did not support free-standing enums.
2021-08-10Room::Private::sync/historyEdge()Alexey Rusakov
Move Room::sync/historyEdge() implementation to Room::Private, so that internal logic could use the same readable shortcuts without q-> prefixes, instead of timeline.crend() and timeline.cend() that are much less readable.
2021-08-09Merge pull request #492 from quotient-im/kitsune-qurl-in-csapiAlexey Rusakov
Use QUrl in CS API backend
2021-08-09Room::setDisplayed(): Don't reset unread countersAlexey Rusakov
Closes #489.
2021-08-09Room::toJson(): save the last local user's read receiptAlexey Rusakov
Read receipts are entangled with counting unread messages, and saving them also helps in not sending receipts for too old events. Other users' read receipts are still treated as truly ephemeral.
2021-08-09Enhanced logging for read receiptsAlexey Rusakov
2021-08-07Update non-generated code to work with QUrls in CS APIAlexey Rusakov
2021-08-07Update generated filesAlexey Rusakov
This uses API definition files from https://github.com/matrix-org/matrix-doc/pull/3236, and additionally makes uploadFile>content_uri to have 'format: uri' (as suggested in the PR review). Only use this commit with the next one; alone it breaks the build.
2021-08-07User::avatar: add constAlexey Rusakov
2021-08-07converters.h: (actually) enable QUrl; drop unused typesAlexey Rusakov
QUrl can now be converted even with QT_NO_URL_CAST_FROM_STRING; and it can also be put to queries. QByteArray did not really need conversion in JSON context; and QJsonObject is/was never used in queries.
2021-08-07Drop an out-of-date commentAlexey Rusakov
BaseJob::loadFromJson() does just fine without QStringViews. [skip ci]
2021-08-07API files: reformat after .clang-format changeAlexey Rusakov
See 000b5730.
2021-08-02Fix lack of percent encoding in User::load()Alexey Rusakov
Users with slashes in their ids do it at their own peril of course but to encode the id in the URL is a good thing in any case. Too bad it's pretty invisible and has to be dealt with case by case, instead of GTAD magically sticking QUrl::toPercentEncoding() where appropriate in the generated code.
2021-08-02More doc-commentsAlexey Rusakov
2021-07-31Room: Mark dependent Q_PROPERTYs as STORED falseAlexey Rusakov
hasUnreadMessages is derived from unreadCount; isFavourite/isLowPriority effectively depend on tagNames.
2021-07-31Add/update doc-comments on the new/updated methodsAlexey Rusakov
[skip ci]
2021-07-30Room::setReadReceipt()Alexey Rusakov
2021-07-30Merge branch 'master' into kitsune-fix-read-receipts-and-markersAlexey Rusakov
2021-07-30Quotient::ReadReceipt; deprecated readMarker()Alexey Rusakov
It's now possible to get receipts along with their timestamps by calling Room::lastReadReceipt(). Together this new method, fullyReadMarker(), and lastFullyReadEventId() deprecate readMarker() overloads and readMarkerEventId() respectively. lastFullyReadEventId is also a Q_PROPERTY (deprecating readMarkerEventId); readMarkerMoved() signal is deprecated by fullyReadMarkerMoved(), while readMarkerForUserMoved() is deprecated in favour of existing lastReadEventChanged().
2021-07-30Clean up after the previous commitAlexey Rusakov
RoomAliasesEvent is no more even registered (meaning that the library will load m.room.aliases as unknown state events); quotest code updated to use historyEdge() instead of timelineEdge().
2021-07-30Use a better type in makeRedactedAlexey Rusakov
2021-07-30Room: drop 0.6 deprecations; deprecate RoomAliasEventAlexey Rusakov
Namely memberCount(), localAliases(), remoteAliases(), timelineEdge().
2021-07-30FormattingAlexey Rusakov
2021-07-28Room: fix the read markers/receipts confusionAlexey Rusakov
This turns the design changes laid out in #464 comments to code, as of 0.6.x branch (0.7 API will be introduced separately): - readMarker() now returns the fully read marker, unlike readMarker(User*) that returns a read receipt, even when called for the local user. - Private::setLastReadEvent() -> setLastReadReceipt(), incorporating the "promotion" logic from promoteReadReceipt(). - The above makes promoteReadReceipt() unneeded; the remaining piece of logic that recalculates the number of unread messages is put to its own method - Private::recalculateUnreadCount(). - Private::updateUnreadCount() is only slightly refreshed, continues to use the fully read marker position (as it used to). - Now that read receipts and fully read markers are managed separately, Private::setLastReadReceipt() has got its counterpart, Private::setFullyReadMarker(); both only update their respective markers locally (emitting signals as needed), without interaction with the homeserver. - Private::markMessagesAsRead() now delegates updating the fully read marker to setFullyReadMarker() and on top of that sends the new fully read marker to the homeserver. - Private::serverReadMarker -> fullyReadUntilEventId (to be really clear what it stores). - The hand-written PostReadMarkersJob is replaced with the generated SetReadMarkerJob that does the same thing (and can update the read receipt on top).
2021-07-28SyncData: minor update to the cache versionAlexey Rusakov
The minor component is now updated in .cpp, not in .h.
2021-07-28Room::usersAtEventId(): switch from QMultiHash to QHash of QSetsAlexey Rusakov
While slightly more complex for updating, this allows COW to kick in in the read accessor; using QSet instead of QList also provides better consistency guarantees. For QML both are converted to an Array-like collection since Qt 5.15; Qt 5.12 turns QSet<> in a QVariantList, according to the documentation, which is quite reasonable too.
2021-07-28setFirst/LastDisplayedEvent(): warn about unloaded eventsAlexey Rusakov
2021-07-24Wrap SyncRoomData counters into OmittablesAlexey Rusakov
Also: introduce a merge(T1&, const Omittable<T2>&) that does pretty much the same as Omittable<T1>::merge(const Omittable<T2>&) except it works on non-omittables as the left/first operand. The change removes the need for a clumsy -2 fallback in unreadCount, and makes the logic loading those counters cleaner along the way.