From 4daa57f6d139f51a62ea4bcffa738bd5035df33a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 5 Nov 2022 15:53:28 +0100 Subject: Support as many emoji as possible, using separate emoji images in text --- src/plugins/Youtube.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index 23e95c6..d3d498e 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -1139,7 +1139,9 @@ namespace QuickMedia { PluginResult YoutubeCommentsPage::submit(const SubmitArgs &args, std::vector &result_tabs) { if(args.url.empty()) return PluginResult::OK; - result_tabs.push_back(Tab{create_body(), std::make_unique(program, video_url, args.url), nullptr}); + + const BodyItem *body_item = (BodyItem*)args.userdata; + result_tabs.push_back(Tab{create_body(), std::make_unique(program, video_url, args.url, body_item), nullptr}); return PluginResult::OK; } @@ -1266,6 +1268,7 @@ namespace QuickMedia { } body_item->set_description(std::move(description)); + body_item->userdata = body_item.get(); return body_item; } @@ -1458,7 +1461,7 @@ namespace QuickMedia { PluginResult YoutubeCommentRepliesPage::get_page(const std::string&, int page, BodyItems &result_items) { while(current_page < page) { - PluginResult plugin_result = lazy_fetch(result_items); + PluginResult plugin_result = lazy_fetch(result_items, false); if(plugin_result != PluginResult::OK) return plugin_result; ++current_page; } @@ -1470,6 +1473,16 @@ namespace QuickMedia { } PluginResult YoutubeCommentRepliesPage::lazy_fetch(BodyItems &result_items) { + return lazy_fetch(result_items, true); + } + + PluginResult YoutubeCommentRepliesPage::lazy_fetch(BodyItems &result_items, bool first_fetch) { + if(first_fetch) { + auto body_item = BodyItem::create(""); + *body_item = *replied_to_body_item; + body_item->set_author("(OP) " + body_item->get_author()); + result_items.push_back(std::move(body_item)); + } return fetch_comments(this, video_url, continuation_token, result_items); } -- cgit v1.2.3