aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-11-30 20:23:07 +0100
committerdec05eba <dec05eba@protonmail.com>2019-11-30 20:23:07 +0100
commite67b9899feb72027b246e3b63ce5aa0ccae2dd16 (patch)
treef13feac1d176fe12a68d685ab2894da72abe905b /plugins
parente2ef465bb606a18e097fd143953e24b4f927241d (diff)
Add image board (4chan) comment navigation
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Fourchan.hpp12
-rw-r--r--plugins/ImageBoard.hpp16
-rw-r--r--plugins/Plugin.hpp2
3 files changed, 24 insertions, 6 deletions
diff --git a/plugins/Fourchan.hpp b/plugins/Fourchan.hpp
index 7f9ad13..5011cd9 100644
--- a/plugins/Fourchan.hpp
+++ b/plugins/Fourchan.hpp
@@ -1,19 +1,19 @@
#pragma once
-#include "Plugin.hpp"
+#include "ImageBoard.hpp"
namespace QuickMedia {
- class Fourchan : public Plugin {
+ class Fourchan : public ImageBoard {
public:
- Fourchan() : Plugin("4chan") {}
+ Fourchan() : ImageBoard("4chan") {}
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;
- PluginResult get_content_list(const std::string &url, BodyItems &result_items) override;
- PluginResult get_content_details(const std::string &list_url, const std::string &url, BodyItems &result_items) override;
+ PluginResult get_threads(const std::string &url, BodyItems &result_items) override;
+ PluginResult get_thread_comments(const std::string &list_url, const std::string &url, BodyItems &result_items) override;
bool search_suggestions_has_thumbnails() const override { return false; }
bool search_results_has_thumbnails() const override { return false; }
int get_search_delay() const override { return 150; }
- Page get_page_after_search() const override { return Page::CONTENT_LIST; }
+ Page get_page_after_search() const override { return Page::IMAGE_BOARD_THREAD_LIST; }
};
} \ No newline at end of file
diff --git a/plugins/ImageBoard.hpp b/plugins/ImageBoard.hpp
new file mode 100644
index 0000000..090f775
--- /dev/null
+++ b/plugins/ImageBoard.hpp
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "Plugin.hpp"
+
+namespace QuickMedia {
+ class ImageBoard : public Plugin {
+ public:
+ ImageBoard(const std::string &name) : Plugin(name) {}
+ virtual ~ImageBoard() = default;
+
+ bool is_image_board() override { return true; }
+
+ virtual PluginResult get_threads(const std::string &url, BodyItems &result_items) = 0;
+ virtual PluginResult get_thread_comments(const std::string &list_url, const std::string &url, BodyItems &result_items) = 0;
+ };
+} \ No newline at end of file
diff --git a/plugins/Plugin.hpp b/plugins/Plugin.hpp
index cfa235c..47f0864 100644
--- a/plugins/Plugin.hpp
+++ b/plugins/Plugin.hpp
@@ -52,6 +52,8 @@ namespace QuickMedia {
Plugin(const std::string &name) : name(name) {}
virtual ~Plugin() = default;
+ virtual bool is_image_board() { return false; }
+
virtual PluginResult get_front_page(BodyItems &result_items) {
(void)result_items; return PluginResult::OK;
}