From a8e35756f9e2b2a94d76c88e699692aef05555a9 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 5 Dec 2020 06:09:05 +0100 Subject: Matrix: scroll to bottom when receiving previous messages and no visible messages, fix thumbnail size json crash --- src/plugins/Mangadex.cpp | 2 +- src/plugins/Matrix.cpp | 12 ++++++------ src/plugins/Pleroma.cpp | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/Mangadex.cpp b/src/plugins/Mangadex.cpp index a8318e8..6df0903 100644 --- a/src/plugins/Mangadex.cpp +++ b/src/plugins/Mangadex.cpp @@ -145,7 +145,7 @@ namespace QuickMedia { const rapidjson::Value &chapter = it.value; const rapidjson::Value ×tamp_json = chapter["timestamp"]; - if(timestamp_json.IsNumber() && timestamp_json.GetInt64() > time_now) + if(timestamp_json.IsInt64() && timestamp_json.GetInt64() > time_now) continue; const rapidjson::Value &lang_code = chapter["lang_code"]; diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index a7d50d0..f8a88b1 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -1401,7 +1401,7 @@ namespace QuickMedia { const rapidjson::Value &unread_notification_json = GetMember(it.value, "unread_notifications"); if(unread_notification_json.IsObject() && !is_additional_messages_sync) { const rapidjson::Value &highlight_count_json = GetMember(unread_notification_json, "highlight_count"); - if(highlight_count_json.IsNumber() && (highlight_count_json.GetInt64() > 0 || initial_sync)) { + if(highlight_count_json.IsInt64() && (highlight_count_json.GetInt64() > 0 || initial_sync)) { room->unread_notification_count = highlight_count_json.GetInt64(); if(highlight_count_json.GetInt64() > 0) has_unread_notifications = true; @@ -1588,7 +1588,7 @@ namespace QuickMedia { bool found_resolution = false; const rapidjson::Value &w_json = GetMember(info_json, "w"); const rapidjson::Value &h_json = GetMember(info_json, "h"); - if(w_json.IsNumber() && h_json.IsNumber()) { + if(w_json.IsInt() && h_json.IsInt()) { thumbnail_size.x = w_json.GetInt(); thumbnail_size.y = h_json.GetInt(); found_resolution = true; @@ -1598,7 +1598,7 @@ namespace QuickMedia { if(thumbnail_info_json.IsObject()) { const rapidjson::Value &w_json = GetMember(thumbnail_info_json, "w"); const rapidjson::Value &h_json = GetMember(thumbnail_info_json, "h"); - if(w_json.IsNumber() && h_json.IsNumber()) { + if(w_json.IsInt() && h_json.IsInt()) { thumbnail_size.x = w_json.GetInt(); thumbnail_size.y = h_json.GetInt(); found_resolution = true; @@ -1762,7 +1762,7 @@ namespace QuickMedia { time_t timestamp = 0; const rapidjson::Value &origin_server_ts = GetMember(event_item_json, "origin_server_ts"); - if(origin_server_ts.IsNumber()) + if(origin_server_ts.IsInt64()) timestamp = origin_server_ts.GetInt64(); const rapidjson::Value &type_json = GetMember(event_item_json, "type"); @@ -2236,7 +2236,7 @@ namespace QuickMedia { continue; const rapidjson::Value ×tamp_json = GetMember(event_json, "origin_server_ts"); - if(!timestamp_json.IsNumber()) + if(!timestamp_json.IsInt64()) continue; const rapidjson::Value &membership_json = GetMember(content_json, "membership"); @@ -3391,7 +3391,7 @@ namespace QuickMedia { return PluginResult::ERR; const rapidjson::Value &upload_size_json = GetMember(json_root, "m.upload.size"); - if(!upload_size_json.IsNumber()) + if(!upload_size_json.IsInt()) return PluginResult::ERR; upload_limit = upload_size_json.GetInt(); diff --git a/src/plugins/Pleroma.cpp b/src/plugins/Pleroma.cpp index c04482d..8479e39 100644 --- a/src/plugins/Pleroma.cpp +++ b/src/plugins/Pleroma.cpp @@ -92,15 +92,15 @@ namespace QuickMedia { } const rapidjson::Value &favourites_count_json = GetMember(post_json, "favourites_count"); - if(favourites_count_json.IsNumber()) + if(favourites_count_json.IsInt()) num_favorites = favourites_count_json.GetInt(); const rapidjson::Value &reblogs_count_json = GetMember(post_json, "reblogs_count"); - if(reblogs_count_json.IsNumber()) + if(reblogs_count_json.IsInt()) num_reblogs = reblogs_count_json.GetInt(); const rapidjson::Value &replies_count_json = GetMember(post_json, "replies_count"); - if(replies_count_json.IsNumber()) + if(replies_count_json.IsInt()) num_replies = replies_count_json.GetInt(); const rapidjson::Value &id_json = GetMember(post_json, "id"); -- cgit v1.2.3