diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-10-30 16:47:40 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-10-30 18:30:46 +0100 |
commit | 928f2525c29929de0c2ab520f48c82b5cb882aa7 (patch) | |
tree | e97130909f65e7835e4740824e9f38f58e4c0fbe /src/plugins | |
parent | e422322650f9cb057937182987071438f9c79e84 (diff) |
Matrix: re-add /logout, cancel task immediately
Cancel video download when pressing escape,
other fixes..
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Manga.cpp | 5 | ||||
-rw-r--r-- | src/plugins/Matrix.cpp | 11 | ||||
-rw-r--r-- | src/plugins/NyaaSi.cpp | 2 |
3 files changed, 12 insertions, 6 deletions
diff --git a/src/plugins/Manga.cpp b/src/plugins/Manga.cpp index 323794c..4685cec 100644 --- a/src/plugins/Manga.cpp +++ b/src/plugins/Manga.cpp @@ -1,5 +1,5 @@ #include "../../plugins/Manga.hpp" -#include "../../include/Program.h" +#include "../../include/Program.hpp" namespace QuickMedia { TrackResult MangaChaptersPage::track(const std::string &str) { @@ -10,7 +10,8 @@ namespace QuickMedia { return TrackResult::ERR; } - void MangaChaptersPage::on_navigate_to_page() { + void MangaChaptersPage::on_navigate_to_page(BodyItems &body_items) { + (void)body_items; std::string manga_id; if(extract_id_from_url(content_url, manga_id)) load_manga_content_storage(get_service_name(), content_title, manga_id); diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index a702841..93eb1d6 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -3,6 +3,7 @@ #include "../../include/StringUtils.hpp" #include "../../include/NetUtils.hpp" #include "../../include/Notification.hpp" +#include "../../include/Program.hpp" #include <rapidjson/document.h> #include <rapidjson/writer.h> #include <rapidjson/stringbuffer.h> @@ -521,8 +522,8 @@ namespace QuickMedia { } void Matrix::stop_sync() { - // TODO: Kill the running download in |sync_thread| instead of waiting until sync returns (which can be up to 30 seconds) sync_running = false; + program_kill_in_thread(sync_thread.get_id()); if(sync_thread.joinable()) sync_thread.join(); } @@ -534,8 +535,12 @@ namespace QuickMedia { void Matrix::get_room_sync_data(RoomData *room, SyncData &sync_data) { room->acquire_room_lock(); auto &room_messages = room->get_messages_thread_unsafe(); - sync_data.messages.insert(sync_data.messages.end(), room_messages.begin() + room->messages_read_index, room_messages.end()); - room->messages_read_index = room_messages.size(); + if(room->messages_read_index <= room_messages.size()) { + sync_data.messages.insert(sync_data.messages.end(), room_messages.begin() + room->messages_read_index, room_messages.end()); + room->messages_read_index = room_messages.size(); + } else { + fprintf(stderr, "Unexpected behavior!!!! get_room_sync_data said read index is %zu but we only have %zu messages\n", room->messages_read_index, room_messages.size()); + } if(room->pinned_events_updated) { sync_data.pinned_events = room->get_pinned_events_unsafe(); room->pinned_events_updated = false; diff --git a/src/plugins/NyaaSi.cpp b/src/plugins/NyaaSi.cpp index 8b1efc7..082aaa8 100644 --- a/src/plugins/NyaaSi.cpp +++ b/src/plugins/NyaaSi.cpp @@ -1,5 +1,5 @@ #include "../../plugins/NyaaSi.hpp" -#include "../../include/Program.h" +#include "../../include/Program.hpp" #include "../../include/Storage.hpp" #include "../../include/Notification.hpp" #include "../../include/StringUtils.hpp" |