aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-24 19:38:07 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-24 19:40:37 +0100
commit3e575ac920e87c47805eb2f0a603dfbbfcbc3e9e (patch)
tree6ea7a12e20ce1a0c749ef6d4931381a89d46fc96 /plugins
parent97e9fcb00af17d0fd1220ce2a5b4f264bf83e8cf (diff)
Start on mastodon/pleroma
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Matrix.hpp1
-rw-r--r--plugins/Pleroma.hpp29
2 files changed, 29 insertions, 1 deletions
diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp
index bae6e40..f0fe840 100644
--- a/plugins/Matrix.hpp
+++ b/plugins/Matrix.hpp
@@ -525,7 +525,6 @@ namespace QuickMedia {
void clear_sync_cache_for_new_sync();
std::shared_ptr<UserInfo> get_user_by_id(RoomData *room, const std::string &user_id);
std::string get_filter_cached();
- DownloadResult download_json(rapidjson::Document &result, const std::string &url, std::vector<CommandArg> additional_args, bool use_browser_useragent = false, std::string *err_msg = nullptr) const;
private:
std::vector<std::unique_ptr<RoomData>> rooms;
std::unordered_map<std::string, size_t> room_data_by_id; // value is an index into |rooms|
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> 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<Tab> &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> pleroma;
+ int current_page = 0;
+ std::string last_item_id;
+ };
+} \ No newline at end of file