aboutsummaryrefslogtreecommitdiff
path: root/lib/events
AgeCommit message (Collapse)Author
2021-12-10Apply suggestions from code reviewTobias Fella
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
2021-12-09Ifdef all the thingsTobias Fella
2021-12-08Store encryptedevent in decrypted roomeventsTobias Fella
2021-12-07Rename "crypto" -> "e2ee"Tobias Fella
2021-12-07Port E2EE to database instead of JSON filesTobias Fella
2021-12-03Cleanup; drop an unused RoomAliasesEvent constructorAlexey Rusakov
Also, RoomAliasesEvent is to be completely gone after 0.7.
2021-12-02Improve function_traits<>; split out from util.*Alexey Rusakov
Quotient::function_traits<> did not support member functions in a proper way (i.e. the way std::invoke_result<> treats them, with the function's owning class represented as the first parameter). Now that I gained the skill and understanding in function_traits<> somewhat wicked machinery, I could properly support member functions. Overloads and generic lambdas are not supported but maybe we'll get to those one day.
2021-12-02visit(Event, ...) -> switchOnType()Alexey Rusakov
It has not much to do with the Visitor design pattern; also, std::visit() has different conventions on the order of parameters.
2021-12-01Apply suggestions from code reviewTobias Fella
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
2021-12-01Apply even more suggestionsTobias Fella
2021-12-01Store pickling key in qtkeychain and pickle encryptedTobias Fella
2021-12-01Implement key verification eventsCarl Schwan
2021-12-01Remove duplicated fileCarl Schwan
2021-11-28Comment on const return types in event.hAlexey Rusakov
Proper linters recognise that the returned types are not primitive, while people might still be confused a bit.
2021-11-28Don't std::move when the callee doesn't support itAlexey Rusakov
In both fixed cases the callee accepts a const reference, which makes std::move() useless. Static analyzers apparently missed them because the cases are inside a macro.
2021-11-28Event::unsignedPart()Alexey Rusakov
Similar to contentPart() - apparently there are enough places across the code that would benefit from it.
2021-11-27basicEventJson(): dismiss with the templateAlexey Rusakov
Given that QJsonObject only accepts QStrings in the list constructor, the template is useless cruft.
2021-11-27Event::content() -> contentPart()Alexey Rusakov
There's a clash between Event::content() (a template function) and RoomMessageEvent::content() (plain member). Out of these two, the name more fits to the RME's member function - strictly speaking, Event::content() retrieves a part of content, and so is renamed. In addition, contentPart() defaults to QJsonValue now, which is pretty intuitive (the function returns values from a JSON object) and allows to implement more elaborate logic such as if (const auto v = contentPart<>("key"_ls); v.isObject()) { // foo } else if (v.isString()) { // bar } else { // boo }
2021-11-26Revert "Drop #include "logging.h" from event.h"Alexey Rusakov
Doesn't really help build times, instead breaking the build on older Qt.
2021-11-26Event: deprecate originalJson[Object]()Alexey Rusakov
The "original JSON" wording is misleading: the returned JSON can be and is routinely edited as a part of event construction, redaction, editing. Also, originalJson() name is misleading in that it returns a stringified (in a very specific way) JSON and not an object. You have to call fullJson() to get the object, and originalJsonObject(), confusingly, returns exactly the same thing but as a value rather than as a reference. The original intention of keeping originalJsonObject() was to make it Q_INVOKABLE or use it as an accessor for a Q_PROPERTY. unfortunately, this was never really practical as discussed in the previous commit. All that implies that clients have to handle passing event JSON to QML themselves, in the form they prefer (as an object or a string). The added complexity is negligible though; on the other hand, there's added flexibility in, e.g., choosing a compact instead of default JSON layout or even generate a highlighted JSON representation.
2021-11-26Drop #include "logging.h" from event.hAlexey Rusakov
Makes compilation a tad lighter.
2021-11-26Drop Q_GADGET from most uncopyable classes; other minor cleanupAlexey Rusakov
Q_GADGET is generally used to enable two things outside of QObject: Q_PROPERTY/Q_INVOKABLE and Q_ENUM/Q_FLAG. While the latter can be used in its own right in QML, the former requires Q_GADGET instances to be passed to QML by value, which is not really possible with uncopyable/unassignable classes. Bottom line is that Q_PROPERTY in anything derived from Quotient::Event is not viable, making Q_GADGET macro useless unless there's a Q_ENUM/Q_FLAG (as is the case with RoomMessageEvent, e.g.).
2021-11-19CleanupAlexey Rusakov
2021-11-12Make ReceiptEvent constructible from contentAlexey Rusakov
Makes the Room::P::toJson() code more readable.
2021-11-08Q_DISABLE_MOVE/COPY_MOVE; QT_IGNORE_DEPRECATIONSAlexey Rusakov
DISABLE_MOVE is no more; instead, the library provides Q_DISABLE_MOVE (and also Q_DISABLE_COPY_MOVE while at it) for Qt pre-5.13 that don't have it yet. Same for QT_IGNORE_DEPRECATIONS - it only arrived in 5.15 but all the building pieces existed prior so libQuotient has it regardless of the Qt version used for building.
2021-10-12RoomMemberEvent::is*(): fix comparison against OmittableAlexey Rusakov
Closes #514.
2021-09-18Merge pull request #505 from TobiasFella/encryptedfileAlexey Rusakov
2021-09-18Add the encryptedfile to the eventcontentTobias Fella
2021-09-14Add room types to RoomCreateEventTobias Fella
2021-09-11Add convenience function for activating encryption and fixTobias Fella
EncryptionEvent constructor
2021-08-22RoomEvent: drop timestamp()Alexey Rusakov
Use originTimestamp(); the corresponding Q_PROPERTY was not renamed (in error) so it is now.
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-02More doc-commentsAlexey Rusakov
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-30Room: drop 0.6 deprecations; deprecate RoomAliasEventAlexey Rusakov
Namely memberCount(), localAliases(), remoteAliases(), timelineEdge().
2021-07-18Merge branch 'kitsune-member-state-enum' into masterAlexey Rusakov
2021-07-18Fix bit rot in commentsAlexey Rusakov
2021-07-18MembershipType -> Membership, also used for JoinStateAlexey Rusakov
Instead of being defined independently, JoinState now uses values from the Membership enumeration (former MemberEventContent::MembershipType) that was moved to quotient_common.h for that purpose. Both enumerations gained a Q_FLAG_NS decoration and operator<< overrides that strip "Quotient::" prefix when dumping member/join state values to the log - obviating toCString(JoinState) along the way. Quotient::MembershipType alias is deprecated from now.
2021-07-18Re-apply the previous commit and actually fix the breakageAlexey Rusakov
Ok, it was stupid to delete #include <QtCore/QMetaType> in 004ebf8d and then to expect that Qt macros would still work, given that I don't use QObject. In my defense I can only say that with Qt 6 it still compiled.
2021-07-18Revert previous commitAlexey Rusakov
Q_DECLARE_METATYPE is really unhappy about types without a public default constructor.
2021-07-18Make EventContent::TypedBase() constructor protectedAlexey Rusakov
TypedBase is an abstract class; constructing it doesn't make sense. But even if it were not abstract, it's not supposed to be instantiated.
2021-07-18Room::postFile(): adjust to the changed RoomMessageEvent APIAlexey Rusakov
9a5fa623 dropped one of RoomMessageEvent constructors for Qt 6 in order to address #483 - breaking the build with Qt 6 along the way, as Room::postFile() relied on that constructor. This commit changes Room::postFile() in turn, deprecating the current signature and adding a new one that accepts an EventContent object rather than a path to a file. In order to achieve that, FileInfo and ImageInfo classes have gained new constructors that accept QFileInfo instead of the legacy series of parameters, streamlining usage of EventContent structures.
2021-07-16Officially drop Qt Multimedia with Qt 6Alexey Rusakov
Closes #483.
2021-06-13EncryptionEvent: fix "too perfect forwarding"Alexey Rusakov
Now that QMetaType introspects into types, it reveals hidden problems (which is very nice of it).
2021-06-13Disable the piece depending on Qt Multimedia for Qt 6Alexey Rusakov
Waiting for the Multimedia arrival in Qt 6.2.
2021-05-25FixesArnav Rawat
2021-03-11Support for pinned messagesArnav Rawat
Fixes issue #188
2021-02-21Update a comment that still mentions RiotAlexey Rusakov
(cherry picked from commit b25785d294669f2bab7dcd1e3cd1fba61991fe46)
2021-01-28Merge pull request #449 from rpallai/richeditfixAlexey Rusakov
Fix rich edits (transmit)
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.