aboutsummaryrefslogtreecommitdiff
path: root/plugins/Fourchan.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Fourchan.hpp')
-rw-r--r--plugins/Fourchan.hpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/plugins/Fourchan.hpp b/plugins/Fourchan.hpp
index 6534cfd..7b76f83 100644
--- a/plugins/Fourchan.hpp
+++ b/plugins/Fourchan.hpp
@@ -1,11 +1,15 @@
#pragma once
#include "ImageBoard.hpp"
+#include <thread>
+#include <mutex>
+#include <condition_variable>
namespace QuickMedia {
class Fourchan : public ImageBoard {
public:
- Fourchan() : ImageBoard("4chan") {}
+ Fourchan();
+ ~Fourchan() override;
PluginResult get_front_page(BodyItems &result_items) override;
SearchResult search(const std::string &url, BodyItems &result_items) override;
SuggestionResult update_search_suggestions(const std::string &text, BodyItems &result_items) override;
@@ -17,5 +21,22 @@ namespace QuickMedia {
int get_search_delay() const override { return 150; }
Page get_page_after_search() const override { return Page::IMAGE_BOARD_THREAD_LIST; }
bool search_is_filter() override { return true; }
+ private:
+ PluginResult get_threads_internal(const std::string &url, BodyItems &result_items);
+ void set_board_url(const std::string &new_url);
+ std::string get_board_url();
+ void set_board_thread_list(BodyItems body_items);
+ BodyItems get_board_thread_list();
+ private:
+ std::string current_board_url;
+ std::thread thread_list_update_thread;
+ BodyItems cached_thread_list_items;
+ std::mutex board_url_mutex;
+ std::mutex board_list_mutex;
+ std::condition_variable thread_list_cached_cv;
+ std::mutex thread_list_cache_mutex;
+ std::condition_variable thread_list_update_cv;
+ bool thread_list_cached = false;
+ bool running = true;
};
} \ No newline at end of file