From 6b347e7310c501b826785e9639d962ba1d448b4b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 23 Sep 2020 00:56:54 +0200 Subject: Add matrix image upload --- plugins/Matrix.hpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp index b2e1711..50f8c6b 100644 --- a/plugins/Matrix.hpp +++ b/plugins/Matrix.hpp @@ -25,6 +25,13 @@ namespace QuickMedia { MessageType type; }; + struct MessageInfo { + int size = 0; + int w = 0; + int h = 0; + const char* mimetype = nullptr; + }; + struct RoomData { // Each room has its own list of user data, even if multiple rooms has the same user // because users can have different display names and avatars in different rooms. @@ -59,7 +66,10 @@ namespace QuickMedia { PluginResult get_room_messages(const std::string &room_id, size_t start_index, BodyItems &result_items, size_t &num_new_messages); SearchResult search(const std::string &text, BodyItems &result_items) override; - PluginResult post_message(const std::string &room_id, const std::string &text); + // |url| should only be set when uploading media. + // TODO: Make api better. + PluginResult post_message(const std::string &room_id, const std::string &body, const std::string &url = "", MessageType msgtype = MessageType::TEXT, MessageInfo *info = nullptr); + PluginResult post_file(const std::string &room_id, const std::string &filepath); PluginResult login(const std::string &username, const std::string &password, const std::string &homeserver, std::string &err_msg); PluginResult load_and_verify_cached_session(); -- cgit v1.2.3