diff options
Diffstat (limited to 'plugins/Fourchan.hpp')
-rw-r--r-- | plugins/Fourchan.hpp | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/plugins/Fourchan.hpp b/plugins/Fourchan.hpp index 05fb784..83fb293 100644 --- a/plugins/Fourchan.hpp +++ b/plugins/Fourchan.hpp @@ -11,24 +11,55 @@ namespace QuickMedia { void get_boards(BodyItems &result_items); const std::string resources_root; + std::string pass_id; + }; + + class FourchanLoginPage : public LazyFetchPage { + public: + FourchanLoginPage(Program *program, std::string title, FourchanBoardsPage *boards_page, std::vector<Tab> *tabs, size_t tab_index) : + LazyFetchPage(program), title(std::move(title)), boards_page(boards_page), tabs(tabs), tab_index(tab_index) {} + const char* get_title() const override { return title.c_str(); } + PluginResult submit(const SubmitArgs&, std::vector<Tab>&) override; + PluginResult lazy_fetch(BodyItems &result_items) override; + + bool submit_is_async() const override { return true; } + bool allow_submit_no_selection() const override { return true; } + bool lazy_fetch_is_loader() override { return true; } + void login_finish(); + + const LoginInputs *login_inputs; + private: + enum class LoggedIn { + Unknown, + Yes, + No + }; + + std::string title; + FourchanBoardsPage *boards_page; + std::vector<Tab> *tabs; + size_t tab_index; + LoggedIn logged_in = LoggedIn::Unknown; }; class FourchanThreadListPage : public LazyFetchPage { public: - FourchanThreadListPage(Program *program, std::string title, std::string board_id) : LazyFetchPage(program), title(std::move(title)), board_id(std::move(board_id)) {} + FourchanThreadListPage(Program *program, std::string title, std::string board_id, std::string pass_id) : + LazyFetchPage(program), title(std::move(title)), board_id(std::move(board_id)), pass_id(std::move(pass_id)) {} const char* get_title() const override { return title.c_str(); } PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override; PluginResult lazy_fetch(BodyItems &result_items) override; const std::string title; const std::string board_id; + std::string pass_id; }; class FourchanThreadPage : public ImageBoardThreadPage { public: - FourchanThreadPage(Program *program, std::string board_id, std::string thread_id) : ImageBoardThreadPage(program, std::move(board_id), std::move(thread_id)) {} + FourchanThreadPage(Program *program, std::string board_id, std::string thread_id, std::string pass_id) : + ImageBoardThreadPage(program, std::move(board_id), std::move(thread_id)), pass_id(std::move(pass_id)) {} - PluginResult login(const std::string &token, const std::string &pin, std::string &response_msg) override; PostResult post_comment(const std::string &captcha_id, const std::string &captcha_solution, const std::string &comment, const std::string &filepath = "") override; const std::string& get_pass_id() override; PluginResult request_captcha_challenge(ImageBoardCaptchaChallenge &challenge_response) override; |