diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 11 | ||||
-rw-r--r-- | src/plugins/Mangadex.cpp | 2 | ||||
-rw-r--r-- | src/plugins/Matrix.cpp | 12 | ||||
-rw-r--r-- | src/plugins/Pleroma.cpp | 6 |
4 files changed, 12 insertions, 19 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index d3a745f..89ced4a 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -3869,7 +3869,7 @@ namespace QuickMedia { int num_items = tabs[MESSAGES_TAB_INDEX].body->items.size(); bool scroll_to_end = num_items == 0; - if(tabs[MESSAGES_TAB_INDEX].body->is_selected_item_last_visible_item() && selected_tab == MESSAGES_TAB_INDEX && chat_state != ChatState::TYPING_MESSAGE) + if(selected_tab == MESSAGES_TAB_INDEX && (tabs[MESSAGES_TAB_INDEX].body->is_selected_item_last_visible_item() || !tabs[MESSAGES_TAB_INDEX].body->get_selected()) && chat_state != ChatState::TYPING_MESSAGE) scroll_to_end = true; if(current_room->initial_prev_messages_fetch) { @@ -4482,14 +4482,7 @@ namespace QuickMedia { fprintf(stderr, "Finished fetching older messages, num new messages: %zu\n", new_messages.size()); size_t num_new_messages = new_messages.size(); if(num_new_messages > 0) { - BodyItem *selected_item = tabs[MESSAGES_TAB_INDEX].body->get_selected(); - BodyItems new_body_items = messages_to_body_items(current_room, new_messages, current_room->get_user_display_name(me), me->user_id); - tabs[MESSAGES_TAB_INDEX].body->insert_items_by_timestamps(std::move(new_body_items)); - if(selected_item) { - int selected_item_index = tabs[MESSAGES_TAB_INDEX].body->get_index_by_body_item(selected_item); - if(selected_item_index != -1) - tabs[MESSAGES_TAB_INDEX].body->set_selected_item(selected_item_index); - } + add_new_messages_to_current_room(new_messages); modify_related_messages_in_current_room(new_messages); process_reactions(new_messages); // TODO: Do not loop all items, only loop the new items 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"); |