diff options
author | dec05eba <dec05eba@protonmail.com> | 2023-01-12 22:54:07 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2023-01-12 23:04:58 +0100 |
commit | 3bfa7ea4beac7710ac5484c46ce181027131ebf8 (patch) | |
tree | 6b54dedf9c38d498062e796fc2b7d9e22c59bd8d /plugins | |
parent | d0c13982cba9a3d04f0d3f4d2178b244c9b61ce9 (diff) |
Matrix: do not trust synapse when it comes to unread messages
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Matrix.hpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp index 7c2103c..4e3309f 100644 --- a/plugins/Matrix.hpp +++ b/plugins/Matrix.hpp @@ -67,6 +67,7 @@ namespace QuickMedia { std::string text_to_decrypt; }; + // TODO: Remove. Not needed anymore. struct TimestampedDisplayData { std::string data; time_t timestamp = 0; // In milliseconds @@ -83,6 +84,7 @@ namespace QuickMedia { RoomData *room; const mgl::Color display_name_color; const std::string user_id; + int power_level = 0; private: TimestampedDisplayData display_name; TimestampedDisplayData avatar_url; @@ -226,9 +228,9 @@ namespace QuickMedia { bool avatar_is_fallback = false; std::atomic_int64_t last_message_timestamp = 0; - std::atomic_int unread_notification_count = 0; std::atomic_int64_t read_marker_event_timestamp = 0; + int notification_power_level = 50; size_t index = 0; private: std::mutex user_mutex; @@ -324,6 +326,8 @@ namespace QuickMedia { virtual void remove_user(MatrixEventUserInfo user_info) = 0; virtual void set_user_info(MatrixEventUserInfo user_info) = 0; virtual void set_room_info(MatrixEventRoomInfo room_info) = 0; + + virtual void set_room_as_read(RoomData *room) = 0; }; class Matrix; @@ -356,7 +360,7 @@ namespace QuickMedia { void set_room_info(MatrixEventRoomInfo room_info) override; void for_each_user_in_room(RoomData *room, std::function<void(const MatrixEventUserInfo&)> callback); - void set_room_as_read(RoomData *room); + void set_room_as_read(RoomData *room) override; Program *program; Matrix *matrix; @@ -370,6 +374,7 @@ namespace QuickMedia { private: std::map<RoomData*, std::shared_ptr<BodyItem>> room_body_item_by_room; std::map<RoomData*, std::shared_ptr<Message>> last_message_by_room; + std::map<RoomData*, int> unread_mention_count_by_room; std::unordered_set<std::string> notifications_shown; UsersByRoom users_by_room; }; @@ -736,6 +741,8 @@ namespace QuickMedia { void async_decrypt_message(std::shared_ptr<MatrixChatBodyDecryptJob> decrypt_job); + MatrixDelegate* get_delegate(); + // Calls the |MatrixDelegate| pending events. // Should be called from the main (ui) thread void update(); |