From 4e3a32ea4478e547215c6775313aaded3bc16b08 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 16 Nov 2020 14:48:26 +0100 Subject: Matrix: do not continuously fetch messages when currently showing pinned messages tab --- README.md | 2 ++ TODO | 3 ++- images/sprites-small.png | Bin 0 -> 1566335 bytes src/QuickMedia.cpp | 3 ++- src/plugins/Matrix.cpp | 5 ++++- 5 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 images/sprites-small.png diff --git a/README.md b/README.md index 93144ec..c5554f2 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,8 @@ See project.conf \[dependencies]. `waifu2x-ncnn-vulkan` needs to be installed when using the `--upscale-images` or `--upscale-images-always` option.\ `xdg-utils` which provides `xdg-open` needs to be installed when downloading torrents with `nyaa.si` plugin.\ `ffmpeg (and ffprobe which is included in ffmpeg)` needs to be installed to upload videos with thumbnails on matrix. +## License +QuickMedia is free software licensed under GPL 3.0. `images/sprites-small.png` is licensed under CC BY 4.0. Source for that image is available at https://github.com/EmojiTwo/emojitwo/ # Screenshots ## Youtube search ![](https://www.dec05eba.com/images/youtube.jpg) diff --git a/TODO b/TODO index ad7383f..9f95a34 100644 --- a/TODO +++ b/TODO @@ -130,4 +130,5 @@ Scroll tabs if there are more than 3 tab items and show arrow on left/right side Make a shader for Text for changing color instead of updating the text geometry. Or loop vertices and set their color to the new color without updating the text geometry. Automatically retry sending messages that fails to send (after timeout). Also make message deletion provisional (make it gray while its deleting the message). -Continue matrix requests when switching room, instead of resetting them when going from chat page to room list page (such as post message request). \ No newline at end of file +Continue matrix requests when switching room, instead of resetting them when going from chat page to room list page (such as post message request). +Pinned messages authors doesn't seem to be updated when fetching users, if the pinned messages are fetched before the users (by navigating to the pending messages tab quickly). \ No newline at end of file diff --git a/images/sprites-small.png b/images/sprites-small.png new file mode 100644 index 0000000..341a861 Binary files /dev/null and b/images/sprites-small.png differ diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index df2d63e..315fef0 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -4569,7 +4569,8 @@ namespace QuickMedia { window.display(); - fetch_more_previous_messages_if_needed(); + if(selected_tab == MESSAGES_TAB_INDEX) + fetch_more_previous_messages_if_needed(); if(matrix_chat_page->should_clear_data) { matrix_chat_page->should_clear_data = false; diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index b102cfa..9da6185 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -274,6 +274,7 @@ namespace QuickMedia { void RoomData::clear_data() { std::lock_guard lock(room_mutex); //fetched_messages_by_event_id.clear(); + userdata = nullptr; user_info_by_user_id.clear(); messages.clear(); messages_read_index = 0; @@ -460,7 +461,9 @@ namespace QuickMedia { last_unread_message = last_new_message.get(); BodyItem *room_body_item = static_cast(room->userdata); - assert(room_body_item); + //assert(room_body_item); + if(!room_body_item) + return; if(last_unread_message) { std::string room_desc = "Unread: " + matrix->message_get_author_displayname(last_unread_message) + ": " + extract_first_line_elipses(last_unread_message->body, 150); -- cgit v1.2.3