1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#pragma once
#include "../include/Page.hpp"
#include "../include/Body.hpp"
#include "../include/StringUtils.hpp"
#include "../include/DownloadUtils.hpp"
#include <string>
#include <vector>
#include <memory>
namespace QuickMedia {
enum class PluginResult {
OK,
ERR,
NET_ERR
};
enum class SearchResult {
OK,
ERR,
NET_ERR
};
enum class SuggestionResult {
OK,
ERR,
NET_ERR
};
enum class ImageResult {
OK,
END,
ERR,
NET_ERR
};
void html_unescape_sequences(std::string &str);
class Plugin {
public:
Plugin(const std::string &name) : name(name) {}
virtual ~Plugin() = default;
virtual bool is_image_board() { return false; }
virtual bool is_manga() { return false; }
// Return true if searching should update the search result (which could be a remote server search) or filter the existing list locally
virtual bool search_is_filter() { return false; }
virtual PluginResult get_front_page(BodyItems &result_items) {
(void)result_items; return PluginResult::OK;
}
virtual SearchResult search(const std::string &text, BodyItems &result_items);
virtual SuggestionResult update_search_suggestions(const std::string &text, BodyItems &result_items);
virtual BodyItems get_related_media(const std::string &url);
virtual PluginResult get_content_list(const std::string &url, BodyItems &result_items) {
(void)url;
(void)result_items;
return PluginResult::OK;
}
virtual PluginResult get_content_details(const std::string &list_url, const std::string &url, BodyItems &result_items) {
(void)list_url;
(void)url;
(void)result_items;
return PluginResult::OK;
}
virtual bool search_suggestions_has_thumbnails() const = 0;
virtual bool search_results_has_thumbnails() const = 0;
virtual std::string autocomplete_search(const std::string &query) { return query; }
virtual int get_autocomplete_delay() const { return 100; }
virtual int get_search_delay() const = 0;
virtual bool search_suggestion_is_search() const { return false; }
virtual Page get_page_after_search() const = 0;
const std::string name;
bool use_tor = false;
protected:
std::string url_param_encode(const std::string ¶m) const;
};
}
|