commit a65f191
default
·
2023-04-09 22:40:48 +0000 UTC
parent 02a5006
Limit the number of entries returned using the max_id.
1 files changed,
+9,
-4
+9,
-4
1@@ -420,15 +420,20 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
2 limit = atoi(limit_s);
3
4 xs *out = xs_list_new();
5- xs *timeline = timeline_list(&snac, "private", 0, limit);
6- xs_list *p = timeline;
7+ xs *timeline = timeline_list(&snac, "private", 0, XS_ALL);
8+ xs_list *p = timeline;
9 xs_str *v;
10
11 while (xs_list_iter(&p, &v) && cnt < limit) {
12 xs *msg = NULL;
13
14- if (max_id)
15- break;
16+ /* only return entries older that max_id */
17+ if (max_id) {
18+ if (strcmp(v, max_id) == 0)
19+ max_id = NULL;
20+
21+ continue;
22+ }
23
24 /* get the entry */
25 if (!valid_status(timeline_get_by_md5(&snac, v, &msg)))