diff options
| author | 2024-12-24 20:35:58 +0000 | |
|---|---|---|
| committer | 2024-12-26 16:51:27 +0000 | |
| commit | 655a448adb0d861a15f6e7443c879928fd654f20 (patch) | |
| tree | a9ecbcfb5da56d8f3cebdec781a52330ea8a38d9 /mastoapi.c | |
| parent | Make xmpp and mailto URLs clickable. (diff) | |
| download | penes-snac2-655a448adb0d861a15f6e7443c879928fd654f20.tar.gz penes-snac2-655a448adb0d861a15f6e7443c879928fd654f20.tar.xz penes-snac2-655a448adb0d861a15f6e7443c879928fd654f20.zip | |
mastoapi: implement timeline min_id
Diffstat (limited to 'mastoapi.c')
| -rw-r--r-- | mastoapi.c | 15 |
1 files changed, 13 insertions, 2 deletions
| @@ -1348,7 +1348,7 @@ xs_list *mastoapi_timeline(snac *user, const xs_dict *args, const char *index_fn | |||
| 1348 | if (limit == 0) | 1348 | if (limit == 0) |
| 1349 | limit = 20; | 1349 | limit = 20; |
| 1350 | 1350 | ||
| 1351 | if (min_id == NULL && index_desc_first(f, md5, 0)) { | 1351 | if (index_desc_first(f, md5, 0)) { |
| 1352 | do { | 1352 | do { |
| 1353 | xs *msg = NULL; | 1353 | xs *msg = NULL; |
| 1354 | 1354 | ||
| @@ -1366,6 +1366,11 @@ xs_list *mastoapi_timeline(snac *user, const xs_dict *args, const char *index_fn | |||
| 1366 | break; | 1366 | break; |
| 1367 | } | 1367 | } |
| 1368 | 1368 | ||
| 1369 | if (min_id) { | ||
| 1370 | if (strcmp(md5, MID_TO_MD5(min_id)) == 0) | ||
| 1371 | break; | ||
| 1372 | } | ||
| 1373 | |||
| 1369 | /* get the entry */ | 1374 | /* get the entry */ |
| 1370 | if (user) { | 1375 | if (user) { |
| 1371 | if (!valid_status(timeline_get_by_md5(user, md5, &msg))) | 1376 | if (!valid_status(timeline_get_by_md5(user, md5, &msg))) |
| @@ -1435,8 +1440,14 @@ xs_list *mastoapi_timeline(snac *user, const xs_dict *args, const char *index_fn | |||
| 1435 | out = xs_list_append(out, st); | 1440 | out = xs_list_append(out, st); |
| 1436 | cnt++; | 1441 | cnt++; |
| 1437 | } | 1442 | } |
| 1443 | if (min_id) { | ||
| 1444 | while (cnt > limit) { | ||
| 1445 | out = xs_list_del(out, 0); | ||
| 1446 | cnt--; | ||
| 1447 | } | ||
| 1448 | } | ||
| 1438 | 1449 | ||
| 1439 | } while (cnt < limit && index_desc_next(f, md5)); | 1450 | } while ((min_id || (cnt < limit)) && index_desc_next(f, md5)); |
| 1440 | } | 1451 | } |
| 1441 | 1452 | ||
| 1442 | int more = index_desc_next(f, md5); | 1453 | int more = index_desc_next(f, md5); |