From 3e575ac920e87c47805eb2f0a603dfbbfcbc3e9e Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 24 Nov 2020 19:38:07 +0100 Subject: Start on mastodon/pleroma --- plugins/Pleroma.hpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 plugins/Pleroma.hpp (limited to 'plugins/Pleroma.hpp') diff --git a/plugins/Pleroma.hpp b/plugins/Pleroma.hpp new file mode 100644 index 0000000..c2518e2 --- /dev/null +++ b/plugins/Pleroma.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include "Page.hpp" + +namespace QuickMedia { + class Pleroma { + public: + // Either get all home posts or only the new ones if we have already fetched posts once. TODO: Cache + PluginResult get_home_posts(BodyItems &results, const std::string &max_id = ""); + private: + std::string auth_token = ""; + std::string instance = ""; + }; + + class PleromaHomePage : public LazyFetchPage { + public: + PleromaHomePage(Program *program, std::shared_ptr pleroma) : LazyFetchPage(program), pleroma(pleroma) {} + const char* get_title() const override { return "Home"; } + PluginResult submit(const std::string &title, const std::string &url, std::vector &result_tabs) override { + return PluginResult::ERR; + } + PluginResult lazy_fetch(BodyItems &result_items) override; + PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override; + private: + std::shared_ptr pleroma; + int current_page = 0; + std::string last_item_id; + }; +} \ No newline at end of file -- cgit v1.2.3