summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 062fb7e..93c4d5a 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -10,6 +10,7 @@
10#include "xs_io.h" 10#include "xs_io.h"
11#include "xs_time.h" 11#include "xs_time.h"
12#include "xs_glob.h" 12#include "xs_glob.h"
13#include "xs_set.h"
13 14
14#include "snac.h" 15#include "snac.h"
15 16
@@ -966,6 +967,9 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
966 xs *wing = following_list(&snac1); 967 xs *wing = following_list(&snac1);
967 xs *wers = follower_list(&snac1); 968 xs *wers = follower_list(&snac1);
968 xs_list *p; 969 xs_list *p;
970 xs_set seen;
971
972 xs_set_init(&seen);
969 973
970 xs_list *lsts[] = { wing, wers, NULL }; 974 xs_list *lsts[] = { wing, wers, NULL };
971 int n; 975 int n;
@@ -973,6 +977,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
973 xs_str *v; 977 xs_str *v;
974 978
975 while (xs_list_iter(&p, &v)) { 979 while (xs_list_iter(&p, &v)) {
980 /* already seen? skip */
981 if (xs_set_add(&seen, v) == 0)
982 continue;
983
976 xs *actor = NULL; 984 xs *actor = NULL;
977 985
978 if (valid_status(object_get(v, &actor))) { 986 if (valid_status(object_get(v, &actor))) {
@@ -986,6 +994,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
986 } 994 }
987 } 995 }
988 } 996 }
997
998 xs_set_free(&seen);
989 } 999 }
990 } 1000 }
991 else 1001 else