mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 21:35:04 +00:00
Limit the number of entries returned using the max_id.
This commit is contained in:
parent
02a5006857
commit
a65f1911d4
1 changed files with 9 additions and 4 deletions
11
mastoapi.c
11
mastoapi.c
|
@ -420,15 +420,20 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
||||||
limit = atoi(limit_s);
|
limit = atoi(limit_s);
|
||||||
|
|
||||||
xs *out = xs_list_new();
|
xs *out = xs_list_new();
|
||||||
xs *timeline = timeline_list(&snac, "private", 0, limit);
|
xs *timeline = timeline_list(&snac, "private", 0, XS_ALL);
|
||||||
xs_list *p = timeline;
|
xs_list *p = timeline;
|
||||||
xs_str *v;
|
xs_str *v;
|
||||||
|
|
||||||
while (xs_list_iter(&p, &v) && cnt < limit) {
|
while (xs_list_iter(&p, &v) && cnt < limit) {
|
||||||
xs *msg = NULL;
|
xs *msg = NULL;
|
||||||
|
|
||||||
if (max_id)
|
/* only return entries older that max_id */
|
||||||
break;
|
if (max_id) {
|
||||||
|
if (strcmp(v, max_id) == 0)
|
||||||
|
max_id = NULL;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* get the entry */
|
/* get the entry */
|
||||||
if (!valid_status(timeline_get_by_md5(&snac, v, &msg)))
|
if (!valid_status(timeline_get_by_md5(&snac, v, &msg)))
|
||||||
|
|
Loading…
Reference in a new issue