From f02c8b967ec936b9dca4ce2dce010301ab8b72bf Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 1 Dec 2019 09:51:14 +0100 Subject: Add image board author name and replies --- src/plugins/Fourchan.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/plugins/Fourchan.cpp') diff --git a/src/plugins/Fourchan.cpp b/src/plugins/Fourchan.cpp index dd2099b..4df77c4 100644 --- a/src/plugins/Fourchan.cpp +++ b/src/plugins/Fourchan.cpp @@ -575,8 +575,10 @@ namespace QuickMedia { if(!post_num.isNumeric()) continue; - comment_by_postno[post_num.asInt64()] = result_items.size(); + int64_t post_num_int = post_num.asInt64(); + comment_by_postno[post_num_int] = result_items.size(); result_items.push_back(std::make_unique("")); + result_items.back()->post_number = std::to_string(post_num_int); } } @@ -595,6 +597,11 @@ namespace QuickMedia { if(!post_num.isNumeric()) continue; + const Json::Value &author = post["name"]; + std::string author_str = "Anonymous"; + if(author.isString()) + author_str = author.asString(); + std::string comment_text; extract_comment_pieces(comment_begin, comment_end - comment_begin, [&comment_text, &comment_by_postno, &result_items, body_item_index](const CommentPiece &cp) { @@ -630,6 +637,7 @@ namespace QuickMedia { html_unescape_sequences(comment_text); BodyItem *body_item = result_items[body_item_index].get(); body_item->set_title(std::move(comment_text)); + body_item->author = std::move(author_str); const Json::Value &ext = post["ext"]; const Json::Value &tim = post["tim"]; -- cgit v1.2.3