mirror of
https://gitlab.com/niansa/qcommsy.git
synced 2025-03-06 20:53:33 +01:00
Fixed max_posts
This commit is contained in:
parent
83b2ec15fa
commit
e1c1f26cce
2 changed files with 5 additions and 4 deletions
|
@ -352,9 +352,8 @@ libCommsy::libCommsy(const std::string& _server_url, const std::string& _server_
|
|||
throw connectionFailError();
|
||||
}
|
||||
|
||||
// Do some stuff XD
|
||||
// Initialise document
|
||||
document = gumbo_parse(httpcontent.str().c_str());
|
||||
httpcontent.str(std::string()); // Clear buffer just in case we need it later
|
||||
|
||||
// Get posts
|
||||
auto gumboPosts = get_posts(document->root);
|
||||
|
@ -401,10 +400,12 @@ libCommsy::libCommsy(const std::string& _server_url, const std::string& _server_
|
|||
// Get lastID
|
||||
lastID = posts.back().id;
|
||||
// Check if maximum amount of posts to load was exceeded
|
||||
if (numposts >= max_posts) {
|
||||
if (max_posts != 0 and numposts >= max_posts) {
|
||||
// Stop loading more posts
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Clear buffer just in case we need it later
|
||||
httpcontent.str(std::string());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ struct commsyPost {
|
|||
|
||||
|
||||
#define libCommsy_NAME "libcommsy"
|
||||
#define libCommsy_VERSION "1.4-stable"
|
||||
#define libCommsy_VERSION "1.3-stable"
|
||||
class libCommsy {
|
||||
public:
|
||||
std::vector<commsyPost> posts;
|
||||
|
|
Loading…
Add table
Reference in a new issue