aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Matrix.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 1734fb0..5f96fa0 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -866,7 +866,7 @@ namespace QuickMedia {
}
void MatrixQuickMedia::update_room_description(RoomData *room, const Messages &new_messages, bool is_initial_sync) {
- time_t read_marker_message_timestamp = 0;
+ int64_t read_marker_message_timestamp = 0;
std::shared_ptr<UserInfo> me = matrix->get_me(room);
std::string my_user_read_marker;
if(me) {
@@ -1746,7 +1746,6 @@ namespace QuickMedia {
else
filter_encoded = url_param_encode(CONTINUE_FILTER);
- initial_sync = true;
while(sync_running) {
char url[2048];
if(next_batch.empty())
@@ -2099,11 +2098,6 @@ namespace QuickMedia {
if(!room_id_json.IsString())
continue;
- time_t timestamp = 0;
- const rapidjson::Value &ts_json = GetMember(notification_json, "ts");
- if(ts_json.IsInt64())
- timestamp = ts_json.GetInt64();
-
const rapidjson::Value &event_json = GetMember(notification_json, "event");
if(!event_json.IsObject())
continue;
@@ -2112,6 +2106,11 @@ namespace QuickMedia {
if(!event_id_json.IsString())
continue;
+ int64_t timestamp = 0;
+ const rapidjson::Value &origin_server_ts_json = GetMember(event_json, "origin_server_ts");
+ if(origin_server_ts_json.IsInt64())
+ timestamp = origin_server_ts_json.GetInt64();
+
const rapidjson::Value &sender_json = GetMember(event_json, "sender");
if(!sender_json.IsString())
continue;
@@ -2135,7 +2134,7 @@ namespace QuickMedia {
std::string event_id(event_id_json.GetString(), event_id_json.GetStringLength());
if(notifications_by_event_id.insert(event_id).second) {
auto me = get_me(room);
- time_t read_marker_message_timestamp = 0;
+ int64_t read_marker_message_timestamp = 0;
if(me) {
auto read_marker_message = room->get_message_by_id(room->get_user_read_marker(me));
if(read_marker_message)
@@ -2145,10 +2144,11 @@ namespace QuickMedia {
bool actually_read = read_json.GetBool();
// 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->read_marker_event_timestamp;
- if(read_marker_message_timestamp == 0 || read_marker_message_timestamp < qm_read_marker) {
+ if(read_marker_message_timestamp == 0 || read_marker_message_timestamp < qm_read_marker)
read_marker_message_timestamp = qm_read_marker;
+
+ if(read_marker_message_timestamp > 0)
actually_read = read_marker_message_timestamp >= timestamp;
- }
MatrixNotification notification;
notification.room = room;
@@ -2705,7 +2705,7 @@ namespace QuickMedia {
num_new_messages = room_data->append_messages(new_messages);
}
- time_t read_marker_message_timestamp = 0;
+ int64_t read_marker_message_timestamp = 0;
if(me) {
auto read_marker_message = room_data->get_message_by_id(room_data->get_user_read_marker(me));
if(read_marker_message)