Răsfoiți Sursa

mastoapi: implemented the followers entrypoint.

Uilebheist 7 ore în urmă
părinte
comite
475525355e
1 a modificat fișierele cu 12 adăugiri și 0 ștergeri
  1. 12 0
      mastoapi.c

+ 12 - 0
mastoapi.c

@@ -2118,7 +2118,19 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
                 }
                 else
                 if (strcmp(opt, "followers") == 0) {
+                    xs *wing = follower_list(&snac1);
                     out = xs_list_new();
+                    int c = 0;
+                    const char *v;
+
+                    while (xs_list_next(wing, &v, &c)) {
+                        xs *actor = NULL;
+
+                        if (valid_status(object_get(v, &actor))) {
+                            xs *acct = mastoapi_account(NULL, actor);
+                            out = xs_list_append(out, acct);
+                        }
+                    }
                 }
                 else
                 if (strcmp(opt, "lists") == 0) {