aboutsummaryrefslogtreecommitdiff
path: root/plugins/Matrix.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Matrix.hpp')
-rw-r--r--plugins/Matrix.hpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp
index 4d7bc11..5819420 100644
--- a/plugins/Matrix.hpp
+++ b/plugins/Matrix.hpp
@@ -2,10 +2,27 @@
#include "../include/FileAnalyzer.hpp"
#include "Plugin.hpp"
+#include "Page.hpp"
+#include <SFML/Graphics/Color.hpp>
#include <unordered_map>
+#include <mutex>
#include <json/value.h>
namespace QuickMedia {
+ // Dummy, only play one video. TODO: Play all videos in room, as related videos?
+ class MatrixVideoPage : public Page {
+ public:
+ MatrixVideoPage(Program *program) : Page(program) {}
+ const char* get_title() const override { return ""; }
+ PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override {
+ (void)title;
+ (void)url;
+ (void)result_tabs;
+ return PluginResult::ERR;
+ }
+ bool is_video_page() const override { return true; }
+ };
+
struct RoomData;
struct UserInfo {
@@ -91,22 +108,13 @@ namespace QuickMedia {
using RoomSyncMessages = std::unordered_map<std::shared_ptr<RoomData>, std::vector<std::shared_ptr<Message>>>;
- class Matrix : public Plugin {
+ class Matrix {
public:
- Matrix();
- virtual ~Matrix() = default;
- bool search_is_filter() override { return true; }
- bool search_suggestions_has_thumbnails() const override { return true; }
- bool search_results_has_thumbnails() const override { return false; }
- int get_search_delay() const override { return 0; }
- bool search_suggestion_is_search() const override { return true; }
- Page get_page_after_search() const override { return Page::EXIT; }
PluginResult sync(RoomSyncMessages &room_messages);
PluginResult get_joined_rooms(BodyItems &result_items);
PluginResult get_all_synced_room_messages(const std::string &room_id, BodyItems &result_items);
PluginResult get_new_room_messages(const std::string &room_id, BodyItems &result_items);
PluginResult get_previous_room_messages(const std::string &room_id, BodyItems &result_items);
- SearchResult search(const std::string &text, BodyItems &result_items) override;
// |url| should only be set when uploading media.
// TODO: Make api better.
@@ -139,6 +147,8 @@ namespace QuickMedia {
PluginResult get_config(int *upload_size);
std::shared_ptr<UserInfo> get_me(const std::string &room_id);
+
+ bool use_tor = false;
private:
PluginResult sync_response_to_body_items(const Json::Value &root, RoomSyncMessages &room_messages);
PluginResult get_previous_room_messages(std::shared_ptr<RoomData> &room_data);
@@ -152,6 +162,7 @@ namespace QuickMedia {
std::shared_ptr<RoomData> get_room_by_id(const std::string &id);
void add_room(std::shared_ptr<RoomData> room);
+ DownloadResult download_json(Json::Value &result, const std::string &url, std::vector<CommandArg> additional_args, bool use_browser_useragent = false, std::string *err_msg = nullptr) const;
private:
std::unordered_map<std::string, std::shared_ptr<RoomData>> room_data_by_id;
std::mutex room_data_mutex;