From 0df442e04c57dd80fc9a6b885b2ba86442b405b9 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 12 Nov 2020 02:35:19 +0100 Subject: Matrix: workaround synapse bug where sync doesn't include membership states when using messages filter --- plugins/Matrix.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'plugins') diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp index 9371900..25225d7 100644 --- a/plugins/Matrix.hpp +++ b/plugins/Matrix.hpp @@ -12,6 +12,12 @@ namespace QuickMedia { struct RoomData; + enum class UserResolveState { + NOT_RESOLVED, + RESOLVING, + RESOLVED + }; + struct UserInfo { friend struct RoomData; UserInfo(RoomData *room, std::string user_id); @@ -20,6 +26,7 @@ namespace QuickMedia { RoomData *room; const sf::Color display_name_color; const std::string user_id; + UserResolveState resolve_state; private: std::string display_name; std::string avatar_url; @@ -37,6 +44,8 @@ namespace QuickMedia { MEMBERSHIP }; + bool is_visual_media_message_type(MessageType message_type); + enum class RelatedEventType { NONE, REPLY, @@ -110,6 +119,7 @@ namespace QuickMedia { // These 4 variables are set by QuickMedia, not the matrix plugin bool last_message_read = true; + bool users_fetched = false; time_t last_read_message_timestamp = 0; void *userdata = nullptr; // Pointer to BodyItem. Note: this has to be valid as long as the room is valid @@ -464,6 +474,8 @@ namespace QuickMedia { std::shared_ptr get_message_by_id(RoomData *room, const std::string &event_id); RoomData* get_room_by_id(const std::string &id); + void update_user_with_latest_state(RoomData *room, const std::string &user_id); + void update_room_users(RoomData *room); bool use_tor = false; private: -- cgit v1.2.3