aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Fourchan.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-12-01 09:51:14 +0100
committerdec05eba <dec05eba@protonmail.com>2019-12-01 09:51:14 +0100
commitf02c8b967ec936b9dca4ce2dce010301ab8b72bf (patch)
treee2733a6eb1e96585d13a69311b917addb4cd6b54 /src/plugins/Fourchan.cpp
parent312881ac12e1f5d8d6981e4bcea922de1defd643 (diff)
Add image board author name and replies
Diffstat (limited to 'src/plugins/Fourchan.cpp')
-rw-r--r--src/plugins/Fourchan.cpp10
1 files changed, 9 insertions, 1 deletions
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<BodyItem>(""));
+ 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"];