From 0ea083cbd4013cf2e709a3e3810ae96167585a74 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 10 Sep 2022 22:17:34 +0200 Subject: Matrix: better name for clipboard file (with extension), give pantalaimon files proper filenames when downloading --- plugins/Matrix.hpp | 10 +++++++--- plugins/Page.hpp | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp index 0c12831..45dd1f7 100644 --- a/plugins/Matrix.hpp +++ b/plugins/Matrix.hpp @@ -412,11 +412,14 @@ namespace QuickMedia { const std::string title; }; - // Dummy, only play one video. TODO: Play all videos in room, as related videos? + // Only play one video. TODO: Play all videos in room, as related videos? class MatrixVideoPage : public VideoPage { public: - MatrixVideoPage(Program *program) : VideoPage(program, "") {} + MatrixVideoPage(Program *program, std::string filename) : VideoPage(program, ""), filename(std::move(filename)) {} const char* get_title() const override { return ""; } + std::string get_filename() override { return filename; } + private: + std::string filename; }; class MatrixChatPage : public Page { @@ -543,7 +546,8 @@ namespace QuickMedia { // |relates_to| is from |BodyItem.userdata| and is of type |Message*| PluginResult post_reaction(RoomData *room, const std::string &body, void *relates_to, std::string &event_id_response); - PluginResult post_file(RoomData *room, const std::string &filepath, std::string &event_id_response, std::string &err_msg); + // If filename is empty then the filename is extracted from filepath + PluginResult post_file(RoomData *room, const std::string &filepath, std::string filename, std::string &event_id_response, std::string &err_msg); PluginResult login(const std::string &username, const std::string &password, const std::string &homeserver, std::string &err_msg); PluginResult logout(); diff --git a/plugins/Page.hpp b/plugins/Page.hpp index 2fa2b6c..97b0340 100644 --- a/plugins/Page.hpp +++ b/plugins/Page.hpp @@ -184,6 +184,7 @@ namespace QuickMedia { virtual void mark_watched() {}; // Should not do any network request to not slow down video loading virtual void get_subtitles(SubtitleData &subtitle_data) { (void)subtitle_data; } + virtual std::string get_filename() { return ""; } virtual bool is_local() const { return false; } -- cgit v1.2.3