From e1a8d10b61c5f8ca092ba3aa458b661da29ba447 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 30 Sep 2020 19:07:05 +0200 Subject: Matrix: add message replying with ctrl+r, also use shared_ptr for BodyItem --- src/plugins/NyaaSi.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/plugins/NyaaSi.cpp') diff --git a/src/plugins/NyaaSi.cpp b/src/plugins/NyaaSi.cpp index 04a71f2..186852b 100644 --- a/src/plugins/NyaaSi.cpp +++ b/src/plugins/NyaaSi.cpp @@ -26,8 +26,8 @@ namespace QuickMedia { } - static std::unique_ptr create_front_page_item(const std::string &title, const std::string &category) { - auto body_item = std::make_unique(title); + static std::shared_ptr create_front_page_item(const std::string &title, const std::string &category) { + auto body_item = BodyItem::create(title); body_item->url = category; return body_item; } @@ -120,7 +120,7 @@ namespace QuickMedia { return SearchResult::ERR; } - auto body_item = std::make_unique(std::move(title)); + auto body_item = BodyItem::create(std::move(title)); body_item->url = std::move(link); body_item->thumbnail_url = "https://nyaa.si/static/img/icons/nyaa/" + category_id + ".png"; body_item->set_description("Published: " + pub_date + "\nSeeders: " + seeders + "\nLeechers: " + leechers + "\nDownloads: " + downloads + "\nSize: " + size + "\nComments: " + comments); @@ -171,9 +171,9 @@ namespace QuickMedia { // } // std::string torrent_url = "https://nyaa.si/download/" + id + ".torrent"; - // auto torrent_item = std::make_unique("Download torrent"); + // auto torrent_item = BodyItem::create("Download torrent"); // torrent_item->url = "https://nyaa.si/download/" + id + ".torrent"; - auto torrent_item = std::make_unique("Download magnet"); + auto torrent_item = BodyItem::create("Download magnet"); std::string magnet_url; std::string description; @@ -192,7 +192,7 @@ namespace QuickMedia { const char *href = quickmedia_html_node_get_attribute_value(node, "href"); const char *text = quickmedia_html_node_get_text(node); if(item_data->empty() && href && text && strncmp(href, "/user/", 6) == 0) { - auto body_item = std::make_unique("Submitter: " + strip(text)); + auto body_item = BodyItem::create("Submitter: " + strip(text)); body_item->url = "https://nyaa.si/" + std::string(href); item_data->push_back(std::move(body_item)); } @@ -250,7 +250,7 @@ namespace QuickMedia { const char *href = quickmedia_html_node_get_attribute_value(node, "href"); const char *text = quickmedia_html_node_get_text(node); if(href && text && strncmp(href, "/user/", 6) == 0) { - auto body_item = std::make_unique(strip(text)); + auto body_item = BodyItem::create(strip(text)); //body_item->url = "https://nyaa.si/" + std::string(href); item_data->push_back(std::move(body_item)); } -- cgit v1.2.3