aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------depends/mglpp0
-rw-r--r--plugins/Matrix.hpp4
-rw-r--r--src/Body.cpp2
-rw-r--r--src/plugins/Matrix.cpp22
4 files changed, 7 insertions, 21 deletions
diff --git a/depends/mglpp b/depends/mglpp
-Subproject 5c002784679ede545977ef641db34d905f0249e
+Subproject 45e509ea8d21bf45df09deecc2e5a2f09751667
diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp
index 7c2103c..1452af1 100644
--- a/plugins/Matrix.hpp
+++ b/plugins/Matrix.hpp
@@ -318,8 +318,6 @@ namespace QuickMedia {
virtual void add_invite(const std::string &room_id, const Invite &invite) = 0;
virtual void remove_invite(const std::string &room_id) = 0;
- virtual void add_unread_notification(MatrixNotification notification) = 0;
-
virtual void add_user(MatrixEventUserInfo user_info) = 0;
virtual void remove_user(MatrixEventUserInfo user_info) = 0;
virtual void set_user_info(MatrixEventUserInfo user_info) = 0;
@@ -348,8 +346,6 @@ namespace QuickMedia {
void add_invite(const std::string &room_id, const Invite &invite) override;
void remove_invite(const std::string &room_id) override;
- void add_unread_notification(MatrixNotification notification) override;
-
void add_user(MatrixEventUserInfo user_info) override;
void remove_user(MatrixEventUserInfo user_info) override;
void set_user_info(MatrixEventUserInfo user_info) override;
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;