fix something
This commit is contained in:
parent
7c2cc5e8d3
commit
6a21c7f54f
@ -470,7 +470,8 @@ bool RepostManager::drop_posts_older_than(std::vector<AbstractPost> &posts, long
|
||||
}
|
||||
|
||||
std::optional<AbstractPost> RepostManager::to_abstract_post(const vk::Post &post, int sourceIndex) {
|
||||
return { AbstractPost(posts::SRC_VK, sourceIndex, post.id, post.date, post.text) };
|
||||
if (post.text.empty()) return {};
|
||||
else return { AbstractPost(posts::SRC_VK, sourceIndex, post.id, post.date, post.text) };
|
||||
}
|
||||
|
||||
std::optional<AbstractPost> RepostManager::to_abstract_post(const td_api::message &post, int sourceIndex) {
|
||||
@ -486,6 +487,7 @@ std::vector<AbstractPost> RepostManager::to_abstract_posts(std::vector<vk::Post>
|
||||
std::vector<AbstractPost> result;
|
||||
result.reserve(posts.size());
|
||||
for (auto &post : posts) {
|
||||
if (post.text.empty()) continue;
|
||||
result.emplace_back(posts::SRC_VK, sourceIndex, post.id, post.date, post.text);
|
||||
}
|
||||
return result;
|
||||
@ -555,6 +557,10 @@ bool RepostManager::recheck_vk_posts(std::function<void()> onDone) {
|
||||
}
|
||||
|
||||
void RepostManager::repost(AbstractPost &post) {
|
||||
if (post.text.length() == 0) {
|
||||
spdlog::error("repost(): zero post length (post id {} date {})", post.id, post.date);
|
||||
return;
|
||||
}
|
||||
spdlog::debug("reposting (post length {})", post.text.length());
|
||||
std::string_view signature = posts::add_signature(post, m_appConfig);
|
||||
int signatureStart = post.text.length() - signature.length();
|
||||
|
Loading…
Reference in New Issue
Block a user