aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-08-02 13:59:37 +0200
committerdec05eba <dec05eba@protonmail.com>2021-08-02 13:59:37 +0200
commit01bac70680553e622a655722959a113ed35f4de9 (patch)
treeb968f96dbefab52e404e1592f5827400b1d0b354
parent66a40b2bc729f60de81d87a6d26e12d66fd5608c (diff)
Matrix: use correct read marker for notifications (custom qm read marker)
-rw-r--r--TODO5
-rw-r--r--src/plugins/Matrix.cpp10
2 files changed, 12 insertions, 3 deletions
diff --git a/TODO b/TODO
index 3b6ffb9..8a09a6d 100644
--- a/TODO
+++ b/TODO
@@ -187,4 +187,7 @@ Cache solved 4chan captcha solution (and challenge id) on disk. ttl is (always?)
Posting on bant doesn't work for some reason. The request is sent successfully but the comment never appears on the website.
4chan_pass cookie is needed to get captcha without slider. How to get this without an account? 4chan website sets this for anon too.
Handle replaces_state in matrix to get correct order for states?
-Handle users_default power level in matrix. \ No newline at end of file
+Handle users_default power level in matrix.
+Remove power_levels from sync and request them manually when entering a room.
+Synapse is gay and mentions do not actually include the whole mxid. It only includes the username part of it. This conflicts with quickmedia notification and mentions where quickmedia includes the mxid in the mention instead,
+ while the user might have disable username mentions. In those cases the user wont get a notification for mxid mention. Mention name instead? \ No newline at end of file
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 0bb3e7b..58a90c9 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -576,8 +576,9 @@ namespace QuickMedia {
read_marker_message_timestamp = read_marker_message->timestamp;
}
- if(read_marker_message_timestamp == 0 || read_marker_message_timestamp < room->read_marker_event_timestamp)
- read_marker_message_timestamp = room->read_marker_event_timestamp;
+ const int64_t qm_read_marker = room->read_marker_event_timestamp;
+ if(read_marker_message_timestamp == 0 || read_marker_message_timestamp < qm_read_marker)
+ read_marker_message_timestamp = qm_read_marker;
std::shared_ptr<Message> last_new_message = get_last_message_by_timestamp(new_messages);
if(!last_new_message)
@@ -2022,6 +2023,11 @@ namespace QuickMedia {
read_marker_message_timestamp = read_marker_message->timestamp;
}
+ // TODO: Make sure |events_set_user_read_marker| is called before |events_add_messages| so this is set
+ const int64_t qm_read_marker = room_data->read_marker_event_timestamp;
+ if(read_marker_message_timestamp == 0 || read_marker_message_timestamp < qm_read_marker)
+ read_marker_message_timestamp = qm_read_marker;
+
for(auto &message : new_messages) {
// TODO: Is @room ok? shouldn't we also check if the user has permission to do @room? (only when notifications are limited to @mentions)
// TODO: Is comparing against read marker timestamp ok enough?