aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-11-05 15:53:28 +0100
committerdec05eba <dec05eba@protonmail.com>2022-11-05 15:53:28 +0100
commit4daa57f6d139f51a62ea4bcffa738bd5035df33a (patch)
treeba767bbbf1c7153a12e3d9e866a079c30d1c69e0 /src/plugins
parentf89117b5cf36797b04291942b2f2494895fc58dd (diff)
Support as many emoji as possible, using separate emoji images in text
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Youtube.cpp17
1 files changed, 15 insertions, 2 deletions
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<Tab> &result_tabs) {
if(args.url.empty())
return PluginResult::OK;
- result_tabs.push_back(Tab{create_body(), std::make_unique<YoutubeCommentRepliesPage>(program, video_url, args.url), nullptr});
+
+ const BodyItem *body_item = (BodyItem*)args.userdata;
+ result_tabs.push_back(Tab{create_body(), std::make_unique<YoutubeCommentRepliesPage>(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);
}