aboutsummaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authorgrunfink <grunfink@comam.es>2025-08-14 09:58:21 +0200
committergrunfink <grunfink@comam.es>2025-08-14 09:58:21 +0200
commit7f18d1c7d762d76b28b6828c2f76bb7edf9e1577 (patch)
tree987203dab03fe566a88829a45716c2e66ba5089d /mastoapi.c
parent5885589e5896d8d15be03364826aab45f04fb830 (diff)
mastoapi: avoid repeating entries.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 08bb5f7..42f3a47 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -1397,6 +1397,9 @@ xs_list *mastoapi_timeline(snac *user, const xs_dict *args, const char *index_fn
initial_status = index_desc_first(f, md5, 0);
}
+ xs_set entries;
+ xs_set_init(&entries);
+
if (initial_status) {
do {
xs *msg = NULL;
@@ -1488,7 +1491,7 @@ xs_list *mastoapi_timeline(snac *user, const xs_dict *args, const char *index_fn
/* convert the Note into a Mastodon status */
xs *st = mastoapi_status(user, msg);
- if (st != NULL) {
+ if (st != NULL && xs_set_add(&entries, md5) == 1) {
if (ascending)
out = xs_list_insert(out, 0, st);
else
@@ -1499,6 +1502,8 @@ xs_list *mastoapi_timeline(snac *user, const xs_dict *args, const char *index_fn
} while ((cnt < limit) && (*iterator)(f, md5));
}
+ xs_set_free(&entries);
+
int more = index_desc_next(f, md5);
fclose(f);