Display tags as sorting items in the community panel (#401)
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.
|