diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 4 | ||||
-rw-r--r-- | src/plugins/Matrix.cpp | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 3a2f2f5..d702fc9 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -7479,6 +7479,10 @@ namespace QuickMedia { } else { RoomExtraData &room_extra_data = matrix->get_room_extra_data(current_room); std::string body_text_unformatted = Text::to_printable_string(selected->get_description()); + MatrixChatBodyItemData *matrix_chat_body_item = static_cast<MatrixChatBodyItemData*>(selected->extra.get()); + const char *encrypt_prefix = "🔒 "; + if(string_starts_with(body_text_unformatted, encrypt_prefix) && matrix_chat_body_item) + body_text_unformatted.replace(0, strlen(encrypt_prefix), "/encrypt "); chat_state = ChatState::EDITING; currently_operating_on_item = selected; diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 5817fe3..c810d88 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -5101,7 +5101,10 @@ namespace QuickMedia { remote_homeserver_url = get_remote_homeserver_url(); char url[512]; - snprintf(url, sizeof(url), "%s/_matrix/media/r0/upload?filename=%s", remote_homeserver_url.c_str(), filename_escaped.c_str()); + snprintf(url, sizeof(url), "%s%s_matrix/media/r0/upload?filename=%s", + remote_homeserver_url.c_str(), + !remote_homeserver_url.empty() && remote_homeserver_url.back() == '/' ? "" : "/", + filename_escaped.c_str()); rapidjson::Document json_root; DownloadResult download_result = download_json(json_root, url, std::move(additional_args), true, &err_msg); |