aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-01-10 11:31:51 +0100
committerdec05eba <dec05eba@protonmail.com>2023-01-10 11:31:51 +0100
commiteb6295751d07b8ee173317234daee8acf6b07a5f (patch)
tree44a6b8e5258f7b6c826946e38a84c51170bab7ca /src
parent665c015988ce5a27f48f61ffdc0fc579075f6ddf (diff)
Matrix: use room messages for notifications intead of notifications api (synapse cache issue)
Diffstat (limited to 'src')
-rw-r--r--src/Body.cpp2
-rw-r--r--src/plugins/Matrix.cpp22
2 files changed, 7 insertions, 17 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index 7deea43..8cff959 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -1683,7 +1683,7 @@ namespace QuickMedia {
}
if(reaction.text) {
- reaction.text->set_position(mgl::vec2f(reaction_background.get_position() + mgl::vec2f(body_spacing[body_theme].reaction_background_padding_x, -(float)reaction.text->get_character_size()*0.18f)).floor());
+ reaction.text->set_position(mgl::vec2f(reaction_background.get_position() + mgl::vec2f(body_spacing[body_theme].reaction_background_padding_x, -(float)reaction.text->get_character_size()*0.10f)).floor());
}
if(draw && reaction.text) {
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 56f4e73..de49409 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -693,11 +693,6 @@ namespace QuickMedia {
invites_page->remove_body_item_by_room_id(room_id);
}
- void MatrixQuickMedia::add_unread_notification(MatrixNotification notification) {
- if(notifications_shown.insert(notification.event_id).second)
- show_notification("QuickMedia matrix - " + notification.sender_user_id + " (" + notification.room->get_name() + ")", notification.body);
- }
-
void MatrixQuickMedia::add_user(MatrixEventUserInfo user_info) {
auto &users = users_by_room[user_info.room];
const bool new_user = users.insert(std::make_pair(user_info.user_id, user_info)).second;
@@ -1672,9 +1667,11 @@ namespace QuickMedia {
return;
}
+ const bool cache_updated = get_file_type(get_cache_dir().join("matrix").join("updated-cache-version1")) == FileType::REGULAR;
+ bool overwrite_cache = !cache_updated;
std::ifstream sync_cache_file_stream;
sync_cache_file_stream.open(matrix_cache_dir.data.c_str(), std::ifstream::in | std::ifstream::binary);
- if(sync_cache_file_stream.good() && get_file_type(get_cache_dir().join("matrix").join("updated-cache-version1")) == FileType::REGULAR) {
+ if(sync_cache_file_stream.good() && cache_updated) {
rapidjson::Document doc;
std::string line;
while(std::getline(sync_cache_file_stream, line)) {
@@ -1792,15 +1789,7 @@ namespace QuickMedia {
// TODO: This ignores new rooms that are not part of the previous sync message. Fix this.
notification_thread = std::thread([this]() {
- get_previous_notifications([this](const MatrixNotification &notification) {
- if(notification.read)
- return;
-
- MatrixDelegate *delegate = this->delegate;
- ui_thread_tasks.push([delegate, notification] {
- delegate->add_unread_notification(std::move(notification));
- });
- });
+ get_previous_notifications([](const MatrixNotification&) {});
finished_fetching_notifications = true;
});
}
@@ -1821,7 +1810,8 @@ namespace QuickMedia {
// Then the daemon will do the sync and matrix processes will ask that daemon for the cached data
// and fetch previous messages etc themselves.
if(!matrix_instance_already_running) {
- sync_cache_file = fopen(matrix_cache_dir.data.c_str(), "ab");
+ sync_cache_file = fopen(matrix_cache_dir.data.c_str(), overwrite_cache ? "wb" : "ab");
+ overwrite_cache = false;
if(sync_cache_file) {
if(json_root.IsObject()) {
rapidjson::StringBuffer buffer;