diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-09-23 00:56:54 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-09-23 01:00:37 +0200 |
commit | 6b347e7310c501b826785e9639d962ba1d448b4b (patch) | |
tree | 6d84b547078d009565a75ac2df42423c06c578b7 /plugins | |
parent | a8e0846a7c111a8d5b5cf8592ecb9b9bbd15ce26 (diff) |
Add matrix image upload
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Matrix.hpp | 12 |
1 files changed, 11 insertions, 1 deletions
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(); |