aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-12-05 06:09:05 +0100
committerdec05eba <dec05eba@protonmail.com>2020-12-05 06:09:05 +0100
commita8e35756f9e2b2a94d76c88e699692aef05555a9 (patch)
treedc9c41210aa39a63a6dd77238c89526cb6754f86
parent3a501ffbe0cd705eed09e697e22023754558aa89 (diff)
Matrix: scroll to bottom when receiving previous messages and no visible messages, fix thumbnail size json crash
-rw-r--r--TODO4
-rw-r--r--src/QuickMedia.cpp11
-rw-r--r--src/plugins/Mangadex.cpp2
-rw-r--r--src/plugins/Matrix.cpp12
-rw-r--r--src/plugins/Pleroma.cpp6
5 files changed, 15 insertions, 20 deletions
diff --git a/TODO b/TODO
index 14c9afb..65bf39b 100644
--- a/TODO
+++ b/TODO
@@ -148,4 +148,6 @@ Have an option to remove membership events from room unread messages, so that on
then comparing that to the read marker.
Comparing latest message for unread message should be done by comparing event id ascii-wise instead of checking if the latest message is equal to the read marker event id. This is to fix unread messages in the case of the latest message in a room being deleted.
Support replying to messages with media, by typing /upload in the reply text.
-Instead of doing a GET for the first N bytes to check if a video is streamable, start streaming the video and if the first bytes doesn't contain MOOV then wait until the whole video has downloaded before playing it. \ No newline at end of file
+Instead of doing a GET for the first N bytes to check if a video is streamable, start streaming the video and if the first bytes doesn't contain MOOV then wait until the whole video has downloaded before playing it.
+Create thumbnail when uploading an image in matrix.
+If a message reply is edited and its a reply to us, then we want the text to be red even if its edited. \ No newline at end of file
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 &timestamp_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 &timestamp_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");