diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-09-30 19:07:05 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-09-30 19:08:05 +0200 |
commit | e1a8d10b61c5f8ca092ba3aa458b661da29ba447 (patch) | |
tree | 4de5ca75c3d19e4bd4c5c25a4362768b3e994326 /src/plugins/NyaaSi.cpp | |
parent | 86d228bfc3e9c81c011c31bc81a908a21f975bfb (diff) |
Matrix: add message replying with ctrl+r, also use shared_ptr for BodyItem
Diffstat (limited to 'src/plugins/NyaaSi.cpp')
-rw-r--r-- | src/plugins/NyaaSi.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
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<BodyItem> create_front_page_item(const std::string &title, const std::string &category) { - auto body_item = std::make_unique<BodyItem>(title); + static std::shared_ptr<BodyItem> 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<BodyItem>(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<BodyItem>("Download torrent"); + // auto torrent_item = BodyItem::create("Download torrent"); // torrent_item->url = "https://nyaa.si/download/" + id + ".torrent"; - auto torrent_item = std::make_unique<BodyItem>("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<BodyItem>("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<BodyItem>(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)); } |