aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/FileManager.cpp12
-rw-r--r--src/plugins/Fourchan.cpp4
-rw-r--r--src/plugins/Matrix.cpp14
-rw-r--r--src/plugins/Page.cpp4
-rw-r--r--src/plugins/Youtube.cpp8
5 files changed, 26 insertions, 16 deletions
diff --git a/src/plugins/FileManager.cpp b/src/plugins/FileManager.cpp
index 42c2f9e..04e284a 100644
--- a/src/plugins/FileManager.cpp
+++ b/src/plugins/FileManager.cpp
@@ -34,14 +34,12 @@ namespace QuickMedia {
return last_write_time;
}
- PluginResult FileManagerPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- (void)url;
-
+ PluginResult FileManagerPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
std::filesystem::path new_path;
- if(title == "..")
+ if(url == "..")
new_path = current_dir.parent_path();
else
- new_path = current_dir / title;
+ new_path = current_dir / url;
if(std::filesystem::is_regular_file(new_path)) {
program->select_file(new_path);
@@ -89,7 +87,8 @@ namespace QuickMedia {
});
if(current_dir != "/") {
- auto parent_item = BodyItem::create("..");
+ auto parent_item = BodyItem::create("Go to parent directory");
+ parent_item->url = "..";
result_items.push_back(std::move(parent_item));
}
@@ -114,6 +113,7 @@ namespace QuickMedia {
continue;
auto body_item = BodyItem::create(p.path().filename().string());
+ body_item->url = body_item->get_title();
if(file_mime_type == FILE_MANAGER_MIME_TYPE_IMAGE || file_mime_type == FILE_MANAGER_MIME_TYPE_VIDEO) {
body_item->thumbnail_is_local = true;
body_item->thumbnail_url = p.path().string();
diff --git a/src/plugins/Fourchan.cpp b/src/plugins/Fourchan.cpp
index 07b5425..d2f81a9 100644
--- a/src/plugins/Fourchan.cpp
+++ b/src/plugins/Fourchan.cpp
@@ -167,7 +167,7 @@ namespace QuickMedia {
}
PluginResult FourchanBoardsPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back(Tab{create_body(), std::make_unique<FourchanThreadListPage>(program, title, url), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
+ result_tabs.push_back(Tab{create_body(false), std::make_unique<FourchanThreadListPage>(program, title, url), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
return PluginResult::OK;
}
@@ -353,7 +353,7 @@ namespace QuickMedia {
++body_item_index;
}
- auto body = create_body();
+ auto body = create_body(false);
body->items = std::move(result_items);
result_tabs.push_back(Tab{std::move(body), std::make_unique<FourchanThreadPage>(program, board_id, url), nullptr});
return PluginResult::OK;
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index f9cdab5..1e69bd7 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -728,7 +728,7 @@ namespace QuickMedia {
}
PluginResult MatrixRoomTagsPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- auto body = create_body();
+ auto body = create_body(true);
Body *body_ptr = body.get();
TagData &tag_data = tag_body_items_by_name[url];
body->items = tag_data.room_body_items;
@@ -1008,7 +1008,7 @@ namespace QuickMedia {
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)});
+ result_tabs.push_back(Tab{create_body(), std::make_unique<MatrixServerRoomListPage>(program, matrix, server_name), create_search_bar("Search...", 400)});
return PluginResult::OK;
}
@@ -2174,6 +2174,11 @@ namespace QuickMedia {
message->related_event_type = RelatedEventType::REDACTION;
message->transaction_id = std::move(transaction_id);
+ if(sent_by_somebody_else) {
+ std::string sender_display_name = extract_first_line_remove_newline_elipses(room_data->get_user_display_name(user_sender), AUTHOR_MAX_LENGTH);
+ message->body += " by " + sender_display_name;
+ }
+
const rapidjson::Value &reason_json = GetMember(*content_json, "reason");
if(reason_json.IsString()) {
message->body += ", reason: ";
@@ -3871,7 +3876,7 @@ namespace QuickMedia {
};
std::string server_response;
- DownloadResult download_result = download_to_string(homeserver + "/_matrix/client/r0/join/" + room_id, server_response, std::move(additional_args), true);
+ DownloadResult download_result = download_to_string(homeserver + "/_matrix/client/r0/join/" + url_param_encode(room_id), server_response, std::move(additional_args), true);
if(download_result == DownloadResult::OK) {
std::lock_guard<std::mutex> invite_lock(invite_mutex);
auto invite_it = invites.find(room_id);
@@ -3909,7 +3914,7 @@ namespace QuickMedia {
};
std::string server_response;
- DownloadResult download_result = download_to_string(homeserver + "/_matrix/client/r0/rooms/" + room_id + "/leave", server_response, std::move(additional_args), true);
+ DownloadResult download_result = download_to_string(homeserver + "/_matrix/client/r0/rooms/" + url_param_encode(room_id) + "/leave", server_response, std::move(additional_args), true);
if(download_result == DownloadResult::OK) {
RoomData *room = get_room_by_id(room_id);
if(room) {
@@ -3991,6 +3996,7 @@ namespace QuickMedia {
if(!description.empty())
description += '\n';
description += canonical_alias_json.GetString();
+ room_body_item->url = canonical_alias_json.GetString();
}
const rapidjson::Value &num_joined_members_json = GetMember(chunk_item_json, "num_joined_members");
diff --git a/src/plugins/Page.cpp b/src/plugins/Page.cpp
index 21a33cb..9eb874f 100644
--- a/src/plugins/Page.cpp
+++ b/src/plugins/Page.cpp
@@ -29,8 +29,8 @@ namespace QuickMedia {
return DownloadResult::OK;
}
- std::unique_ptr<Body> Page::create_body() {
- return program->create_body();
+ std::unique_ptr<Body> Page::create_body(bool plain_text_list) {
+ return program->create_body(plain_text_list);
}
std::unique_ptr<SearchBar> Page::create_search_bar(const std::string &placeholder_text, int search_delay) {
diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp
index d164bc5..f7b36d6 100644
--- a/src/plugins/Youtube.cpp
+++ b/src/plugins/Youtube.cpp
@@ -190,7 +190,9 @@ namespace QuickMedia {
if(!desc.empty())
desc += '\n';
desc += '\n';
- desc += description_snippet.value();
+ std::string description_snippet_stripped = strip(description_snippet.value());
+ string_replace_all(description_snippet_stripped, "\n\n", "\n");
+ desc += std::move(description_snippet_stripped);
}
body_item->set_description(std::move(desc));
body_item->set_description_color(sf::Color(179, 179, 179));
@@ -247,7 +249,9 @@ namespace QuickMedia {
if(!desc.empty())
desc += '\n';
desc += '\n';
- desc += description.value();
+ std::string description_snippet_stripped = strip(description.value());
+ string_replace_all(description_snippet_stripped, "\n\n", "\n");
+ desc += std::move(description_snippet_stripped);
}
body_item->set_description(std::move(desc));
body_item->set_description_color(sf::Color(179, 179, 179));