From 6c7adadf6d5c85d5e280e965d4dee1563bf46821 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 1 Dec 2019 18:05:16 +0100 Subject: Add 4chan posting --- plugins/Fourchan.hpp | 1 + plugins/ImageBoard.hpp | 8 ++++++++ plugins/Plugin.hpp | 17 ++--------------- 3 files changed, 11 insertions(+), 15 deletions(-) (limited to 'plugins') diff --git a/plugins/Fourchan.hpp b/plugins/Fourchan.hpp index 5011cd9..2f3ae4b 100644 --- a/plugins/Fourchan.hpp +++ b/plugins/Fourchan.hpp @@ -11,6 +11,7 @@ namespace QuickMedia { SuggestionResult update_search_suggestions(const std::string &text, 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; + PostResult post_comment(const std::string &board, const std::string &thread, const std::string &captcha_id, const std::string &comment) 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; } diff --git a/plugins/ImageBoard.hpp b/plugins/ImageBoard.hpp index 090f775..e2a43a9 100644 --- a/plugins/ImageBoard.hpp +++ b/plugins/ImageBoard.hpp @@ -3,6 +3,13 @@ #include "Plugin.hpp" namespace QuickMedia { + enum class PostResult { + OK, + TRY_AGAIN, + BANNED, + ERR + }; + class ImageBoard : public Plugin { public: ImageBoard(const std::string &name) : Plugin(name) {} @@ -12,5 +19,6 @@ namespace QuickMedia { 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; + virtual PostResult post_comment(const std::string &board, const std::string &thread, const std::string &captcha_id, const std::string &comment) = 0; }; } \ No newline at end of file diff --git a/plugins/Plugin.hpp b/plugins/Plugin.hpp index 47f0864..e19fbcd 100644 --- a/plugins/Plugin.hpp +++ b/plugins/Plugin.hpp @@ -2,6 +2,8 @@ #include "../include/Page.hpp" #include "../include/Body.hpp" +#include "../include/StringUtils.hpp" +#include "../include/DownloadUtils.hpp" #include #include #include @@ -25,12 +27,6 @@ namespace QuickMedia { NET_ERR }; - enum class DownloadResult { - OK, - ERR, - NET_ERR - }; - enum class ImageResult { OK, END, @@ -38,13 +34,6 @@ namespace QuickMedia { NET_ERR }; - struct CommandArg { - std::string option; - std::string value; - }; - - std::string strip(const std::string &str); - void string_replace_all(std::string &str, const std::string &old_str, const std::string &new_str); void html_unescape_sequences(std::string &str); class Plugin { @@ -77,8 +66,6 @@ namespace QuickMedia { virtual bool search_suggestion_is_search() const { return false; } virtual Page get_page_after_search() const = 0; - DownloadResult download_to_string(const std::string &url, std::string &result, const std::vector &additional_args = {}); - const std::string name; bool use_tor = false; protected: -- cgit v1.2.3