From 13df852479bf84f297bf59ed99236e52f486a095 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sat, 14 Dec 2019 23:39:02 +0100 Subject: Reduce some include of Cache.h since it needs 11s on average --- src/CacheStructs.h | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 src/CacheStructs.h (limited to 'src/CacheStructs.h') diff --git a/src/CacheStructs.h b/src/CacheStructs.h new file mode 100644 index 00000000..275d20cb --- /dev/null +++ b/src/CacheStructs.h @@ -0,0 +1,91 @@ +#pragma once + +#include +#include +#include + +#include + +#include + +struct RoomMember +{ + QString user_id; + QString display_name; + QImage avatar; +}; + +struct SearchResult +{ + QString user_id; + QString display_name; +}; + +//! Used to uniquely identify a list of read receipts. +struct ReadReceiptKey +{ + std::string event_id; + std::string room_id; +}; + +void +to_json(json &j, const ReadReceiptKey &key); + +void +from_json(const json &j, ReadReceiptKey &key); + +struct DescInfo +{ + QString event_id; + QString userid; + QString body; + QString timestamp; + QDateTime datetime; +}; + +//! UI info associated with a room. +struct RoomInfo +{ + //! The calculated name of the room. + std::string name; + //! The topic of the room. + std::string topic; + //! The calculated avatar url of the room. + std::string avatar_url; + //! The calculated version of this room set at creation time. + std::string version; + //! Whether or not the room is an invite. + bool is_invite = false; + //! Total number of members in the room. + int16_t member_count = 0; + //! Who can access to the room. + mtx::events::state::JoinRule join_rule = mtx::events::state::JoinRule::Public; + bool guest_access = false; + //! Metadata describing the last message in the timeline. + DescInfo msgInfo; + //! The list of tags associated with this room + std::vector tags; +}; + +void +to_json(json &j, const RoomInfo &info); +void +from_json(const json &j, RoomInfo &info); + +//! Basic information per member; +struct MemberInfo +{ + std::string name; + std::string avatar_url; +}; + +void +to_json(json &j, const MemberInfo &info); +void +from_json(const json &j, MemberInfo &info); + +struct RoomSearchResult +{ + std::string room_id; + RoomInfo info; +}; -- cgit 1.5.1 From a07e6998118ef62785f51fc0f59d1ca7ceb5be28 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 29 Jan 2020 23:39:05 +0100 Subject: Fix build with build system optimizations of mtxclient --- CMakeLists.txt | 2 +- src/CacheStructs.h | 12 ++++++------ src/Utils.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/CacheStructs.h') diff --git a/CMakeLists.txt b/CMakeLists.txt index c2496f2f..bd579b20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -333,7 +333,7 @@ if(USE_BUNDLED_MTXCLIENT) FetchContent_Declare( MatrixClient GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git - GIT_TAG 03b5008a05f895e91e3968de7b68db50f6c41b2a + GIT_TAG 19e7d680bf5e8bc6a25586a225e881fe4e60d9fb ) FetchContent_MakeAvailable(MatrixClient) else() diff --git a/src/CacheStructs.h b/src/CacheStructs.h index 275d20cb..2051afc8 100644 --- a/src/CacheStructs.h +++ b/src/CacheStructs.h @@ -29,10 +29,10 @@ struct ReadReceiptKey }; void -to_json(json &j, const ReadReceiptKey &key); +to_json(nlohmann::json &j, const ReadReceiptKey &key); void -from_json(const json &j, ReadReceiptKey &key); +from_json(const nlohmann::json &j, ReadReceiptKey &key); struct DescInfo { @@ -68,9 +68,9 @@ struct RoomInfo }; void -to_json(json &j, const RoomInfo &info); +to_json(nlohmann::json &j, const RoomInfo &info); void -from_json(const json &j, RoomInfo &info); +from_json(const nlohmann::json &j, RoomInfo &info); //! Basic information per member; struct MemberInfo @@ -80,9 +80,9 @@ struct MemberInfo }; void -to_json(json &j, const MemberInfo &info); +to_json(nlohmann::json &j, const MemberInfo &info); void -from_json(const json &j, MemberInfo &info); +from_json(const nlohmann::json &j, MemberInfo &info); struct RoomSearchResult { diff --git a/src/Utils.h b/src/Utils.h index 505d8e6a..ea0df21f 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -272,7 +272,7 @@ getMessageBody(const RoomMessageT &event) if (event.content.format.empty()) return QString::fromStdString(event.content.body).toHtmlEscaped(); - if (event.content.format != common::FORMAT_MSG_TYPE) + if (event.content.format != mtx::common::FORMAT_MSG_TYPE) return QString::fromStdString(event.content.body).toHtmlEscaped(); return QString::fromStdString(event.content.formatted_body); -- cgit 1.5.1