diff options
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 3 | ||||
-rw-r--r-- | src/plugins/Matrix.cpp | 16 |
3 files changed, 19 insertions, 5 deletions
@@ -57,4 +57,7 @@ When deleting an edited message on matrix, delete the original message instead o Implement mentions in matrix with an autofill list, like on element. Also do the same with / commands. Add option to disable autosearch and search when pressing enter instead or something? this would be needed for mobile phones where typing is slow. Sleep when idle, to reduce cpu usage from 1-2% to 0%, important for mobile devices. Also render view to a rendertexture and render that instead of redrawing every time every time. -Show a notification when somebody replies to you on matrix and also provide a way to notify when notifications should be received (using matrix api) and also read the notification config from matrix. Also provide a way to disable notifications globally. Also send read markers to not notify every time we restart QuickMedia.
\ No newline at end of file +Show a notification when somebody replies to you on matrix and also provide a way to notify when notifications should be received (using matrix api) and also read the notification config from matrix. Also provide a way to disable notifications globally. Also send read markers to not notify every time we restart QuickMedia. +Direct message room name should always be the name of the other peer, or in an anonymous room the room name should be some of their names and "X others". +Add room search. +Use quickmedia to show image in matrix rooms, instead of mpv.
\ No newline at end of file diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 4234d1c..9460ec6 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1331,7 +1331,6 @@ namespace QuickMedia { return false; } - static int watch_history_get_item_by_id(const Json::Value &video_history_json, const char *id) { assert(video_history_json.isArray()); @@ -3288,7 +3287,7 @@ namespace QuickMedia { else if(index == 0) return ""; else - return str.substr(0, index - 1); + return str.substr(0, index); } void Program::chat_page() { diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index ed3b0af..257feb4 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -771,14 +771,26 @@ namespace QuickMedia { return PluginResult::OK; } + static std::string remove_reply_formatting(const std::string &str) { + if(strncmp(str.c_str(), "> <@", 4) == 0) { + size_t index = str.find("> ", 4); + if(index != std::string::npos) { + size_t msg_begin = str.find("\n\n", index + 2); + if(msg_begin != std::string::npos) + return str.substr(msg_begin + 2); + } + } + return str; + } + static std::string create_body_for_message_reply(const RoomData *room_data, const Message *message, const std::string &body) { std::string related_to_body; switch(message->type) { case MessageType::TEXT: { if(!message->replaces_event_id.empty() && strncmp(message->body.c_str(), " * ", 3) == 0) - related_to_body = message->body.substr(3); + related_to_body = remove_reply_formatting(message->body.substr(3)); else - related_to_body = message->body; + related_to_body = remove_reply_formatting(message->body); break; } case MessageType::IMAGE: |