aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp6
-rw-r--r--src/plugins/Matrix.cpp9
2 files changed, 7 insertions, 8 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 92eb03c..57b6162 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -5277,7 +5277,11 @@ namespace QuickMedia {
homeserver = "https://" + homeserver;
std::string err_msg;
- if(matrix->login(login_inputs->inputs[0]->get_text(), login_inputs->inputs[1]->get_text(), homeserver, err_msg) == PluginResult::OK) {
+ std::string username = login_inputs->inputs[0]->get_text();
+ size_t at_index = username.find('@');
+ if(at_index != std::string::npos)
+ username.erase(username.begin() + at_index, username.end());
+ if(matrix->login(username, login_inputs->inputs[1]->get_text(), homeserver, err_msg) == PluginResult::OK) {
login_finish();
return PluginResult::OK;
} else {
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 2452548..688e16e 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -4877,13 +4877,8 @@ namespace QuickMedia {
filename = file_get_filename(filepath);
int64_t upload_limit;
- PluginResult config_result = get_config(&upload_limit);
- if(config_result != PluginResult::OK) {
- err_msg = "Failed to get file size limit from server";
- return config_result;
- }
-
- if(file_analyzer.get_file_size() > upload_limit) {
+ PluginResult config_result = get_config(&upload_limit); // get_config can fail sometimes??? happened on plan9.rocks, why? is /r0/config optional?
+ if(config_result == PluginResult::OK && file_analyzer.get_file_size() > upload_limit) {
err_msg = "File is too large! max upload size on your homeserver is " + std::to_string((double)upload_limit / 1024.0 / 1024.0) + " mb, the file you tried to upload is " + std::to_string((double)file_analyzer.get_file_size() / 1024.0 / 1024.0) + " mb";
return PluginResult::ERR;
}