snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit a65f1911d4bb3fc31adec52b61f2c6d264172610
parent 02a5006857b490c19169e6431bae4eabd8f01a32
Author: default <nobody@localhost>
Date:   Mon, 10 Apr 2023 00:40:48 +0200

Limit the number of entries returned using the max_id.

Diffstat:
Mmastoapi.c | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/mastoapi.c b/mastoapi.c @@ -420,15 +420,20 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, limit = atoi(limit_s); xs *out = xs_list_new(); - xs *timeline = timeline_list(&snac, "private", 0, limit); - xs_list *p = timeline; + xs *timeline = timeline_list(&snac, "private", 0, XS_ALL); + xs_list *p = timeline; xs_str *v; while (xs_list_iter(&p, &v) && cnt < limit) { xs *msg = NULL; - if (max_id) - break; + /* only return entries older that max_id */ + if (max_id) { + if (strcmp(v, max_id) == 0) + max_id = NULL; + + continue; + } /* get the entry */ if (!valid_status(timeline_get_by_md5(&snac, v, &msg)))