From 57ab6b22b37ff133128ad16a5c1882e627243461 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 1 Apr 2021 18:51:25 +0200 Subject: Remove http/https/www from room directory server name --- src/plugins/Matrix.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/plugins/Matrix.cpp') 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 &result_tabs) { - result_tabs.push_back(Tab{create_body(), std::make_unique(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(program, matrix, server_name), create_search_bar("Search...", 350)}); return PluginResult::OK; } -- cgit v1.2.3