diff --git a/libcommsy.cpp b/libcommsy.cpp index bf31a00..71dff43 100644 --- a/libcommsy.cpp +++ b/libcommsy.cpp @@ -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()); } } diff --git a/libcommsy.hpp b/libcommsy.hpp index 076197a..771ed9a 100644 --- a/libcommsy.hpp +++ b/libcommsy.hpp @@ -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 posts;