aboutsummaryrefslogtreecommitdiff
path: root/plugins/Fourchan.hpp
blob: 8c608a116ba92989f366ab6593ebefa9a8531080 (plain)
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
#pragma once

#include "ImageBoard.hpp"

namespace QuickMedia {
    class FourchanBoardsPage : public Page {
    public:
        FourchanBoardsPage(Program *program, std::string resources_root) : Page(program), resources_root(std::move(resources_root)) {}
        const char* get_title() const override { return "Select board"; }
        PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
        void get_boards(BodyItems &result_items);

        const std::string resources_root;
    };

    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)) {}
        const char* get_title() const override { return title.c_str(); }
        PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
        PluginResult lazy_fetch(BodyItems &result_items) override;

        const std::string title;
        const std::string board_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)) {}

        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;
    private:
        std::string pass_id;
    };
}