aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Fourchan.hpp1
-rw-r--r--plugins/ImageBoard.hpp8
-rw-r--r--plugins/Plugin.hpp17
3 files changed, 11 insertions, 15 deletions
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 <string>
#include <vector>
#include <memory>
@@ -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<CommandArg> &additional_args = {});
-
const std::string name;
bool use_tor = false;
protected: