mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 14:35:04 +00:00
Don't repeat accounts when searching.
This commit is contained in:
parent
d3c1b3127a
commit
bd8886f8a6
1 changed files with 10 additions and 0 deletions
10
mastoapi.c
10
mastoapi.c
|
@ -10,6 +10,7 @@
|
|||
#include "xs_io.h"
|
||||
#include "xs_time.h"
|
||||
#include "xs_glob.h"
|
||||
#include "xs_set.h"
|
||||
|
||||
#include "snac.h"
|
||||
|
||||
|
@ -966,6 +967,9 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
|||
xs *wing = following_list(&snac1);
|
||||
xs *wers = follower_list(&snac1);
|
||||
xs_list *p;
|
||||
xs_set seen;
|
||||
|
||||
xs_set_init(&seen);
|
||||
|
||||
xs_list *lsts[] = { wing, wers, NULL };
|
||||
int n;
|
||||
|
@ -973,6 +977,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
|||
xs_str *v;
|
||||
|
||||
while (xs_list_iter(&p, &v)) {
|
||||
/* already seen? skip */
|
||||
if (xs_set_add(&seen, v) == 0)
|
||||
continue;
|
||||
|
||||
xs *actor = NULL;
|
||||
|
||||
if (valid_status(object_get(v, &actor))) {
|
||||
|
@ -986,6 +994,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
xs_set_free(&seen);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue