From 18a98a7c1d712e39fbdc49c3a5d3a037e2fe1bad Mon Sep 17 00:00:00 2001 From: Victor Berger Date: Fri, 28 Sep 2018 14:40:51 +0200 Subject: Display tags as sorting items in the community panel (#401) --- src/Cache.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/Cache.h') diff --git a/src/Cache.h b/src/Cache.h index 5bdfb113..b730d6fc 100644 --- a/src/Cache.h +++ b/src/Cache.h @@ -115,6 +115,8 @@ struct RoomInfo 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; }; inline void @@ -129,6 +131,9 @@ to_json(json &j, const RoomInfo &info) if (info.member_count != 0) j["member_count"] = info.member_count; + + if (info.tags.size() != 0) + j["tags"] = info.tags; } inline void @@ -143,6 +148,9 @@ from_json(const json &j, RoomInfo &info) if (j.count("member_count")) info.member_count = j.at("member_count"); + + if (j.count("tags")) + info.tags = j.at("tags").get>(); } //! Basic information per member; @@ -384,11 +392,16 @@ public: RoomInfo singleRoomInfo(const std::string &room_id); std::vector roomsWithStateUpdates(const mtx::responses::Sync &res); + std::vector roomsWithTagUpdates(const mtx::responses::Sync &res); std::map getRoomInfo(const std::vector &rooms); std::map roomUpdates(const mtx::responses::Sync &sync) { return getRoomInfo(roomsWithStateUpdates(sync)); } + std::map roomTagUpdates(const mtx::responses::Sync &sync) + { + return getRoomInfo(roomsWithTagUpdates(sync)); + } //! Calculates which the read status of a room. //! Whether all the events in the timeline have been read. -- cgit 1.5.1