diff options
| author | 2025-08-14 09:58:21 +0200 | |
|---|---|---|
| committer | 2025-08-14 09:58:21 +0200 | |
| commit | 7f18d1c7d762d76b28b6828c2f76bb7edf9e1577 (patch) | |
| tree | 987203dab03fe566a88829a45716c2e66ba5089d /mastoapi.c | |
| parent | content_search() also looks in the attributedTo field. (diff) | |
| download | penes-snac2-7f18d1c7d762d76b28b6828c2f76bb7edf9e1577.tar.gz penes-snac2-7f18d1c7d762d76b28b6828c2f76bb7edf9e1577.tar.xz penes-snac2-7f18d1c7d762d76b28b6828c2f76bb7edf9e1577.zip | |
mastoapi: avoid repeating entries.
Diffstat (limited to 'mastoapi.c')
| -rw-r--r-- | mastoapi.c | 7 |
1 files changed, 6 insertions, 1 deletions
| @@ -1397,6 +1397,9 @@ xs_list *mastoapi_timeline(snac *user, const xs_dict *args, const char *index_fn | |||
| 1397 | initial_status = index_desc_first(f, md5, 0); | 1397 | initial_status = index_desc_first(f, md5, 0); |
| 1398 | } | 1398 | } |
| 1399 | 1399 | ||
| 1400 | xs_set entries; | ||
| 1401 | xs_set_init(&entries); | ||
| 1402 | |||
| 1400 | if (initial_status) { | 1403 | if (initial_status) { |
| 1401 | do { | 1404 | do { |
| 1402 | xs *msg = NULL; | 1405 | xs *msg = NULL; |
| @@ -1488,7 +1491,7 @@ xs_list *mastoapi_timeline(snac *user, const xs_dict *args, const char *index_fn | |||
| 1488 | /* convert the Note into a Mastodon status */ | 1491 | /* convert the Note into a Mastodon status */ |
| 1489 | xs *st = mastoapi_status(user, msg); | 1492 | xs *st = mastoapi_status(user, msg); |
| 1490 | 1493 | ||
| 1491 | if (st != NULL) { | 1494 | if (st != NULL && xs_set_add(&entries, md5) == 1) { |
| 1492 | if (ascending) | 1495 | if (ascending) |
| 1493 | out = xs_list_insert(out, 0, st); | 1496 | out = xs_list_insert(out, 0, st); |
| 1494 | else | 1497 | else |
| @@ -1499,6 +1502,8 @@ xs_list *mastoapi_timeline(snac *user, const xs_dict *args, const char *index_fn | |||
| 1499 | } while ((cnt < limit) && (*iterator)(f, md5)); | 1502 | } while ((cnt < limit) && (*iterator)(f, md5)); |
| 1500 | } | 1503 | } |
| 1501 | 1504 | ||
| 1505 | xs_set_free(&entries); | ||
| 1506 | |||
| 1502 | int more = index_desc_next(f, md5); | 1507 | int more = index_desc_next(f, md5); |
| 1503 | 1508 | ||
| 1504 | fclose(f); | 1509 | fclose(f); |