diff options
author | default <nobody@localhost> | 2022-11-02 10:49:16 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2022-11-02 10:49:16 +0100 |
commit | 773be130ed4557c95fef2d54799a170ffea9e0de (patch) | |
tree | 4144e8c5b13108efc851dc5465718bf168074982 /data.c | |
parent | 1fd14a850dd1100429fd38023666b6d53fb6c9af (diff) |
More work in the people page.
Diffstat (limited to 'data.c')
-rw-r--r-- | data.c | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -699,6 +699,41 @@ int following_get(snac *snac, char *actor, d_char **data) } +d_char *following_list(snac *snac) +/* returns the list of people being followed */ +{ + xs *spec = xs_fmt("%s/following/" "*.json", snac->basedir); + xs *glist = xs_glob(spec, 0, 0); + char *p, *v; + d_char *list = xs_list_new(); + + /* iterate the list of files */ + p = glist; + while (xs_list_iter(&p, &v)) { + FILE *f; + + /* load the follower data */ + if ((f = fopen(v, "r")) != NULL) { + xs *j = xs_readall(f); + fclose(f); + + if (j != NULL) { + xs *o = xs_json_loads(j); + + if (o != NULL) { + char *type = xs_dict_get(o, "type"); + + if (!xs_is_null(type) && strcmp(type, "Accept") == 0) + list = xs_list_append(list, o); + } + } + } + } + + return list; +} + + d_char *_muted_fn(snac *snac, char *actor) { xs *md5 = xs_md5_hex(actor, strlen(actor)); |