aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2021-01-12EventItemBase: Allow adding custom dataKitsune Ral
A new field of std::any type is added that allows clients to "annotate" any event item with arbitrary kind of data. This is mainly intended so that clients could calculate certain information about the item (e.g. special formatting depending on the event contents, or position) without having to calculate this information every time it is visualised. In case of Quaternion, the idea is to calculate the "spamminess" of the event basing on the past activity of a given user in this room - calculating it upon displaying each event is extremely heavyweight.
2021-01-07Connection: don't explicitly reset QPointersKitsune Ral
See #437 for the discussion.
2021-01-07isJobRunning() -> isJobPending()Kitsune Ral
To be very clear what this function checks. See also #437.
2021-01-07BaseJob: setStatus(Pending) on scheduling a retryKitsune Ral
Fixes #437. (cherry picked from commit 12e00b234e5c5f4ed57b5c400d06f780e71014f4)
2021-01-07Connection::resolveServer: abandon is not a failureKitsune Ral
So just reset the base URL and return, with no error signals. (cherry picked from commit be00308ad67286b45912202750fe49fb87f16e4a)
2021-01-07BaseJob: more loggingKitsune Ral
(cherry picked from commit 4f06d46d6d6062d6d17f69eeaddb7810edac5bbf)
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. (cherry picked from commit 90d41b697af39253483d9bcca4e57b11d2197112)
2020-12-28Merge pull request #425 from ognarb/stickerKitsune Ral
Add support for stickers
2020-12-28Connection: fix FTBFS with Quotient_E2EE_ENABLEDKitsune Ral
2020-12-28event.h: Fix breakage of AppVeyor CIKitsune Ral
The breakage was caused by 639f1d48.
2020-12-28Add support for sticker eventsCarl Schwan
2020-12-28Room: inline a once-used variableKitsune Ral
2020-12-28Room: really fix namesakes assertion failureKitsune Ral
This removes now-deprecated RoomMemberEvent API usages and also does a few more things differently from the stable branch. Rather than rely on prev_content (the way pre-0.7 goes), processStateEvent() now includes a pre-check for no-op state events (the fix in ff020f3b turned out to be insufficient for such events and they still caused the same assertion failure at some point down the line). Now the state event is only added to currentState and, where relevant, to baseState, if it actually changes the room state; otherwise, it is ignored for the purpose of state tracking (even when still added to the timeline, if it came in the timeline block). One side-effect of this change is that processStateEvent() now returns OtherChange instead of NoChange for unknown state events. At the same time removeMemberFromMap() now has an additional safety net, making sure that a given user is actually deleted from the map even if their name is mismatched. This comes at a cost of looking through the whole hashmap but normally should not occur with the current code that shaves away no-op state events. We'll only see when some client starts to actively use 0.7 (quotest doesn't trigger those).
2020-12-28Add a new logging category for room member changesKitsune Ral
MEMBERS, aka quotient.events.members.* - this was promised in ff020f3b but not actually done "before merging".
2020-12-28Use generated SetReadMarkerJob instead of PostReadMarkersJobKitsune Ral
2020-12-28BaseJob::initiate: add Q_LIKELYKitsune Ral
...to show the sunny-day case.
2020-12-28Cleanup and clang-tidy/clazy fixesKitsune Ral
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. 4. LoginFlow aliases is moved out from LoginFlows to Quotient namespace.
2020-12-28More comments/documentationKitsune Ral
Notably, recommend using loginFlowsChanged() rather than homeserverChanged() to detect when a Connection object is ready for a login sequence. Related: #427.
2020-12-28event.h: Minor tweaks around visit<>Kitsune Ral
2020-12-27function_traits<>: define as empty by defaultKitsune Ral
An incomplete type was preventing some SFINAE cases for literal types.
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.
2020-12-24Room: don't accept . at 0-th position in the tagKitsune Ral
Also: use a structured binding for better code readability. (cherry picked from commit 66972c81d018231f08f3767feda4b41ae5e1b8e0)
2020-12-24Fix clang-tidy/clazy warningsKitsune Ral
(cherry picked from commit 0a2acd750a4155969092be674ed3dd9a71b2354f)
2020-12-23BaseJob::Status: add comparison with intKitsune Ral
Since Status single-parameter constructor is (intentionally) not explicit, comparisons may not do what's expected in cases like the one fixed by 3ef036cd. This makes comparisons "do the right thing".
2020-12-23BaseJob: add [[fallthrough]] as clang-tidy saysKitsune Ral
(cherry picked from commit 1a832ae9b6a0d679b551fd644136e4bc17e7db29)
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. (cherry picked from commit 9ef83e044ed4f8409156b19d529dfc7e45f565c1)
2020-12-23Connection::resolveServer(): fix error handlingKitsune Ral
Part of the fix for #421. (cherry picked from commit 104356d945671762af23e346f7898a3208770d97)
2020-12-22Merge pull request #423 from quotient-im/kitsune-fix-namesakes-failureKitsune Ral
Room: fix breakage in internal member map
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. A lot of debug logging has been added - this will be moved to a new logging category before merging.
2020-11-27Make it compile with QT_NO_KEYWORDSCarl Schwan
2020-11-24csapi/search.*Kitsune Ral
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-15Cleanup across event classesKitsune Ral
In particular: removed unnecessary #includes, deprecated and no more used constructs, replaced stored members with dynamic generation from JSON (TypingEvent and, especially promising for performance, ReceiptEvent)
2020-11-14Make StateEventBase Q_GADGET tooKitsune Ral
To align with the two other base event classes (Event and RoomEvent).
2020-11-14CleanupKitsune Ral
2020-11-14Drop EventFactory<RoomPowerLevelsEvent>Kitsune Ral
RoomPowerLevelsEvent is not used in csapi/ classes so the factory is of no use either.
2020-11-14ConnectionData: fix defunct jobs stalling the queueKitsune Ral
2020-11-12Room: add power level events to redaction rulesKitsune Ral
2020-11-12More JSON key constantsKitsune Ral
2020-11-10MembershipType: 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-08Room: drop setMemberState()Kitsune Ral
2020-11-08More robust member profile data retrievalKitsune Ral
MemberEventContent: displayname and avatarUrl are now Omittables; CS API doesn't guarantee their presence (see also https://github.com/matrix-org/matrix-doc/issues/1375) but Quotient used to assume they are always there, causing #412. RoomMemberEvent: displayname() -> newDisplayName() and avatarUrl() -> newAvatarUrl(), to emphasise the actual semantics (and also the changed interface). The old signatures still work but are deprecated. Instead of roomMembername() (with weird camel-casing), three new methods in addition to safeMemberName() are introduced to Room: - memberName() - produces the "best known" display name for a given member; User::name() uses it to avoid the pitfall of #412. - disambiguatedMemberName() - this is what roomMembername() used to be; not recommended for direct use when UI is concerned. - safeMemberName() - remains as is, with the fix to the documentation that used to mislead that the function returns HTML-escaped content (it didn't, and doesn't). - htmlSafeMemberName() - does what safeMemberName() claimed to do. Respectively, memberNames() is deprecated in favor of safeMemberNames() and htmlSafeMemberNames(). The corresponding Q_PROPERTY uses safeMemberNames() now. Similar to memberName(), Room has got memberAvatarUrl() to spare User class from diving into Room state to find the member avatar URL. Closes #412.
2020-11-08converters.h: add QUrl supportKitsune Ral
2020-11-06ChangePasswordJob: logoutDevices doesn't need OmittableKitsune Ral
This is generated by GTAD 0.7.1 (to be released), based on the changed registration.yaml (to be committed and pulled).
2020-11-06Further restrict IPv6 branch of ServerPartRegExKitsune Ral
2020-11-06Uri::toUrl(): fix incorrect matrix.to repKitsune Ral
The first character inside the fragment should be / (cherry picked from commit 948be2ef2bf04e306fbb0e2c3e0a98f4151337a7)
2020-11-06util.cpp: assert validity of regular expressionsKitsune Ral
(cherry picked from commit 0e87640560343c15b0a218796509d2d94e1a5c77)