aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2021-07-20Promote read receipts/marker in addNewMessageEvents()Alexey Rusakov
Read marker promotion worked before the rework - and it works again with this commit. Read receipts are promoted from anywhere, the fully read marker is only promoted if it's adjacent to the batch just added.
2021-07-19addHistoricalMessageEvents(): restore force-recount logicAlexey Rusakov
Pre-e12d7ba2, addHistoricalMessageEvents() triggered recounting and emitting unreadMessagesChanged() even if the number remained the same. This logic has been lost when refactoring the code; now it's back there again.
2021-07-19Fix m.read getting stuck behind m.fully_readAlexey Rusakov
2021-07-16Merge branch 'kitsune-fix-read-receipts-and-markers-0.6' into 0.6.xAlexey Rusakov
2021-07-14User::rename(): actually build on the current stateAlexey Rusakov
This is a further extension of #481 fix that takes the whole current state event content, rather than just the avatar URL.
2021-07-14SyncData::parseJson(): further minor optimisationAlexey Rusakov
Just to align with the similar changes coming in 0.7
2021-07-14SyncData::parseJson(): fix incorrect reserve() argAlexey Rusakov
That is unlikely to impact performance, since reserve() is usually called only once per given JSON object (`{ "join": { ... } }`).
2021-07-11Fix Room::processAccountDataEvent() return valueAlexey Rusakov
(cherry picked from commit 7b65051e959968fe538f40c975d85757cfcc7df7)
2021-07-10Merge branch '0.6.x' into kitsune-fix-read-receipts-and-markers-0.6Alexey Rusakov
2021-07-10Update and extend doc-comments for read marker-related methodsAlexey Rusakov
2021-07-10Fix Room::processAccountDataEvent() return valueAlexey Rusakov
2021-07-10Room: refactoring around logging (esp. profile logs)Alexey Rusakov
2021-07-10Room: fix the read markers/receipts confusionAlexey Rusakov
This turns the design changes laid out in #464 comments to code: - 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, though the current code doesn't use that).
2021-07-02Room::memberJoinState(): return Leave if user == nullptrAlexey Rusakov
2021-06-29More re-generated API files (only doc-comments updated)Alexey Rusakov
All actual updates to the API go to 0.7.
2021-06-27Room::processEphemeralEvents(): refactoringAlexey Rusakov
2021-06-27Retain the current room member avatar when renamingAlexey Rusakov
Closes #481. Note: the library doesn't even have the API in User to set per-room avatars; one still can achieve that by calling Room::setState<RoomMemberEvent>(...) though (and it's likely to be _the_ recommended way to deal with per-room user profiles in 0.7, with User being entirely deprecated).
2021-06-23Re-generated API files according to the previous commitAlexey Rusakov
Only API-preserving changes are included in this branch (0.7 will have all changes).
2021-06-07Connection::joinRoom() shouldn't enforce room stateAlexey Rusakov
This is an adjustment to the earlier fix of #471: if a join is immediately followed by a leave (e.g. from another client/bot - you can't do it programmatically from libQuotient) the sync may bring the room already in the Leave state; therefore `joinRoom` should not impose the state but rather ask `provideRoom` to create a `Join` room - just as it's designed when passed an empty `joinState`.
2021-05-08Fix joinedRoom signal not being emitted in some casesAlexey Rusakov
An alternative implementation of #463 (and thanks to Carl for spotting the original problem).
2021-03-04Tighten up against malformed user ids in eventsAlexey Rusakov
A few months ago 3c85f049 introduced validation of user ids but the rest of the library code wasn't updated to the fact that Connection::user() may quite legitimately (if not routinely) return nullptr, leading to crashes particularaly when malformed ids come from the wire. This commit adds necessary checks before using the value returned from user(). Closes #456.
2021-02-21Update a comment that still mentions RiotAlexey Rusakov
2021-02-21Uri: support abbreviated types in Matrix URIsAlexey Rusakov
As per the latest iteration of MSC2312, room/, user/ and event/ are only supported for parsing and replication but not for emitting from Matrix identifiers.
2021-01-28Fix rich edits (transmit)Roland Pallai
The new formatted_body was not included into new content on edit due to badly constructed json. (cherry picked from commit df6b2d31ec8f2f5890826719e960f450a4968f22)
2021-01-28Fix rich replies json format (transmit)Roland Pallai
With this patch it looks like: "m.relates_to": { "m.in_reply_to": { "event_id": "$another:event.com" } } instead of: "m.relates_to": { "event_id": "$another:event.com", "rel_type": "m.in_reply_to" }, So it fits the specification by now. https://matrix.org/docs/spec/client_server/r0.6.1#rich-replies (cherry picked from commit b850edadde2299b122a5cd17da85e943430e43b7)
2021-01-25Connection: stop login flows job before resolvingAlexey Rusakov
This avoids a corner case when a login flows job finishes (or worse, goes for a retry) while the homeserver is (being) resolved, yielding the Connection object in an inconsistent state to the client.
2021-01-07Connection: don't explicitly reset QPointersKitsune Ral
See #437 for the discussion. (cherry picked from commit 6101971af86fdecd084759aa039b9d20a9d662a7)
2021-01-07Connection::resolveServer: abandon is not a failureKitsune Ral
So just reset the base URL and return, with no error signals.
2021-01-07BaseJob: setStatus(Pending) on scheduling a retryKitsune Ral
Fixes #437.
2021-01-07BaseJob: more loggingKitsune Ral
2021-01-07Prefer connecting to BaseJob::result(), not finished()Kitsune Ral
...because finished() includes abandoning and should only be relevant when lifecycle issues are involved.
2020-12-29Connection: fix FTBFS with Quotient_E2EE_ENABLEDKitsune Ral
(cherry picked from commit 0f974c0f96f29035ee766e8913504fed4a4903a5)
2020-12-28Connection: refactor the resolve/login codeKitsune Ral
1. resolveServer() now emits homeserverChanged() even when there's no .well-known file found. 2. checkAndConnect() entirely removed from the header file. 3. Sunny-day scenario for assumeIdentity() is now asynchronous, triggering a call to /whoami to double-check the user. (based on commit 6c9ff40dbd91cc4966f0ecf9ed817efc2495a2fb to master)
2020-12-28Cleanup and clang-tidy/clazy fixesKitsune Ral
(cherry picked from commit 56c1db077b5da653c230432abc6c746318a77bed)
2020-12-28BaseJob::initiate: add Q_LIKELYKitsune Ral
...to show the sunny-day case. (cherry picked from commit 5d15e3b23649a54abdb3812c10f4a7d2ce07d7dd)
2020-12-27Fix use-after-free of QNetworkReply in BaseJobNicolas Fella
Usually QNetworkAccessManager expects the user to delete the replies, but when the QNetworkAccessManager itself is deleted it deletes all pending replies (https://code.woboq.org/qt5/qtbase/src/network/access/qnetworkaccessmanager.cpp.html#529). This can lead to use-after-free crashes when d->reply is accessed. By putting the reply into a QPointer the exiting if(d->reply) checks can work properly. (cherry picked from commit 9d854e778d8d6ef8e03e1ea74fe958675b24fd45)
2020-12-27More comments/documentationKitsune Ral
Notably, recommend using loginFlowsChanged() rather than homeserverChanged() to detect when a Connection object is ready for a login sequence. Related: #427. (cherry picked from commit 8981c5451ac378f16d5b57d7460d053e2cbc666e)
2020-12-24Room: don't accept . at 0-th position in the tagKitsune Ral
Also: use a structured binding for better code readability.
2020-12-24Fix clang-tidy/clazy warningsKitsune Ral
2020-12-23BaseJob: add [[fallthrough]] as clang-tidy saysKitsune Ral
2020-12-23BaseJob: tolerate unexpected error payloadsKitsune Ral
Proxy servers may return arbitrary HTML, for one example; so don't expect to find a valid JSON object in whatever non-empty payload next to a non-2xx HTTP code. Fixes #421.
2020-12-23Connection::resolveServer(): fix error handlingKitsune Ral
Part of the fix for #421.
2020-12-10Uri: fix a few cases of insufficient escapingKitsune Ral
2020-12-10Fix DELETE jobs with json dataTobias Fella
DeleteDeviceJob requires authentication, but the JSON data is not added for DELETE requests. Since QNetworkAccessManager::deleteResource does not support body data, we need to send a custom request.
2020-12-03Room: fix breakage in internal member mapKitsune Ral
The change in 39830496 led to prev_content becoming a fallback not only for displaying user names but also for storing them in the internal member map, which is really not what was intended.
2020-11-19Fix Q_ASSERT failure on sending messagesKitsune Ral
Changes in e81117fb exposed a flaw in EncryptionEvent causing assertion failure when this event is default-initialised (i.e. no encryption).
2020-11-15Room: add power level events to redaction rulesKitsune Ral
2020-11-15MembershipType: drop warning on empty valuesKitsune Ral
This is a usual situation when a membership type is undefined; and the current code constructs _a lot_ of stub events by loading them from empty JSON. So just silence those warnings for now.
2020-11-15Room::P::getCurrentState<>(): bypass the factory chainKitsune Ral
This is to optimize a rather hot path creating stub events (for member events in bigger rooms, in particular) when the event type is known. Version 0.7 will have a completely different code based on event content rather than event that will obviate stubs creation but 0.6.x can benefit from it.
2020-11-14ConnectionData: fix defunct jobs stalling the queueKitsune Ral