aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Fourchan.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-10-03 11:07:11 +0200
committerdec05eba <dec05eba@protonmail.com>2020-10-03 11:07:11 +0200
commit769000b8f979fd2c4d7cd87fb83cf08912eb90dc (patch)
tree5950d0bd83a2a4b876b8e534329c87353798285b /src/plugins/Fourchan.cpp
parent27e748dec4792ac8612fb77e21a6d857a41a816c (diff)
Matrix: use correct name for private chat rooms, move 4chan comment input to the top
Diffstat (limited to 'src/plugins/Fourchan.cpp')
-rw-r--r--src/plugins/Fourchan.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/plugins/Fourchan.cpp b/src/plugins/Fourchan.cpp
index 111aca1..757a0e1 100644
--- a/src/plugins/Fourchan.cpp
+++ b/src/plugins/Fourchan.cpp
@@ -251,31 +251,36 @@ namespace QuickMedia {
if(!thread_num.isNumeric())
continue;
- std::string comment_text;
+ std::string title_text;
extract_comment_pieces(sub_begin, sub_end - sub_begin,
- [&comment_text](const CommentPiece &cp) {
+ [&title_text](const CommentPiece &cp) {
switch(cp.type) {
case CommentPiece::Type::TEXT:
- comment_text.append(cp.text.data, cp.text.size);
+ title_text.append(cp.text.data, cp.text.size);
break;
case CommentPiece::Type::QUOTE:
- comment_text += '>';
- comment_text.append(cp.text.data, cp.text.size);
+ title_text += '>';
+ title_text.append(cp.text.data, cp.text.size);
//comment_text += '\n';
break;
case CommentPiece::Type::QUOTELINK: {
- comment_text.append(cp.text.data, cp.text.size);
+ title_text.append(cp.text.data, cp.text.size);
break;
}
case CommentPiece::Type::LINE_CONTINUE: {
- if(!comment_text.empty() && comment_text.back() == '\n') {
- comment_text.pop_back();
+ if(!title_text.empty() && title_text.back() == '\n') {
+ title_text.pop_back();
}
break;
}
}
}
);
+ if(!title_text.empty() && title_text.back() == '\n')
+ title_text.back() = ' ';
+ html_unescape_sequences(title_text);
+
+ std::string comment_text;
extract_comment_pieces(comment_begin, comment_end - comment_begin,
[&comment_text](const CommentPiece &cp) {
switch(cp.type) {
@@ -300,8 +305,6 @@ namespace QuickMedia {
}
}
);
- if(!comment_text.empty() && comment_text.back() == '\n')
- comment_text.back() = ' ';
html_unescape_sequences(comment_text);
// TODO: Do the same when wrapping is implemented
// TODO: Remove this
@@ -316,6 +319,7 @@ namespace QuickMedia {
}
}
auto body_item = BodyItem::create(std::move(comment_text));
+ body_item->set_author(std::move(title_text));
body_item->url = std::to_string(thread_num.asInt64());
const Json::Value &ext = thread["ext"];
@@ -395,6 +399,7 @@ namespace QuickMedia {
return PluginResult::OK;
}
+ // TODO: Merge with get_threads_internal
PluginResult Fourchan::get_thread_comments(const std::string &list_url, const std::string &url, BodyItems &result_items) {
cached_media_urls.clear();
std::string server_response;