summary refs log tree commit diff
path: root/src/Cache.h
diff options
context:
space:
mode:
authorVictor Berger <vberger@users.noreply.github.com>2018-09-28 14:40:51 +0200
committermujx <mujx@users.noreply.github.com>2018-09-28 12:40:51 +0000
commit18a98a7c1d712e39fbdc49c3a5d3a037e2fe1bad (patch)
tree215d3ef59826df9fedd179e4a319c779bd1ec228 /src/Cache.h
parentDon't enable tray by default (diff)
downloadnheko-18a98a7c1d712e39fbdc49c3a5d3a037e2fe1bad.tar.xz
Display tags as sorting items in the community panel (#401)
Diffstat (limited to 'src/Cache.h')
-rw-r--r--src/Cache.h13
1 files changed, 13 insertions, 0 deletions
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<std::string> 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<std::vector<std::string>>(); } //! Basic information per member; @@ -384,11 +392,16 @@ public: RoomInfo singleRoomInfo(const std::string &room_id); std::vector<std::string> roomsWithStateUpdates(const mtx::responses::Sync &res); + std::vector<std::string> roomsWithTagUpdates(const mtx::responses::Sync &res); std::map<QString, RoomInfo> getRoomInfo(const std::vector<std::string> &rooms); std::map<QString, RoomInfo> roomUpdates(const mtx::responses::Sync &sync) { return getRoomInfo(roomsWithStateUpdates(sync)); } + std::map<QString, RoomInfo> 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.