aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-04-01 18:51:25 +0200
committerdec05eba <dec05eba@protonmail.com>2021-04-01 18:51:25 +0200
commit57ab6b22b37ff133128ad16a5c1882e627243461 (patch)
treedd30b983d3ba971112eb5ca9f4c251a4bd79eb5a /src
parent276395f468c8ee05951401a1d352e0dec3c3a3a8 (diff)
Remove http/https/www from room directory server name
Diffstat (limited to 'src')
-rw-r--r--src/plugins/Matrix.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 5d942ed..bbe9897 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -983,7 +983,17 @@ namespace QuickMedia {
}
PluginResult MatrixRoomDirectoryPage::submit(const std::string &title, const std::string&, std::vector<Tab> &result_tabs) {
- result_tabs.push_back(Tab{create_body(), std::make_unique<MatrixServerRoomListPage>(program, matrix, title), create_search_bar("Search...", 350)});
+ std::string server_name = title;
+
+ if(strncmp(server_name.c_str(), "http://", 7) == 0)
+ server_name.erase(0, 7);
+ else if(strncmp(server_name.c_str(), "https://", 8) == 0)
+ server_name.erase(0, 8);
+
+ if(strncmp(server_name.c_str(), "www.", 4) == 0)
+ server_name.erase(0, 4);
+
+ result_tabs.push_back(Tab{create_body(), std::make_unique<MatrixServerRoomListPage>(program, matrix, server_name), create_search_bar("Search...", 350)});
return PluginResult::OK;
}