summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorGravatar default2022-11-02 10:49:16 +0100
committerGravatar default2022-11-02 10:49:16 +0100
commit773be130ed4557c95fef2d54799a170ffea9e0de (patch)
tree4144e8c5b13108efc851dc5465718bf168074982 /data.c
parentPeople page started. (diff)
downloadsnac2-773be130ed4557c95fef2d54799a170ffea9e0de.tar.gz
snac2-773be130ed4557c95fef2d54799a170ffea9e0de.tar.xz
snac2-773be130ed4557c95fef2d54799a170ffea9e0de.zip
More work in the people page.
Diffstat (limited to '')
-rw-r--r--data.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/data.c b/data.c
index 5e1be8e..e8e4f9f 100644
--- a/data.c
+++ b/data.c
@@ -699,6 +699,41 @@ int following_get(snac *snac, char *actor, d_char **data)
699} 699}
700 700
701 701
702d_char *following_list(snac *snac)
703/* returns the list of people being followed */
704{
705 xs *spec = xs_fmt("%s/following/" "*.json", snac->basedir);
706 xs *glist = xs_glob(spec, 0, 0);
707 char *p, *v;
708 d_char *list = xs_list_new();
709
710 /* iterate the list of files */
711 p = glist;
712 while (xs_list_iter(&p, &v)) {
713 FILE *f;
714
715 /* load the follower data */
716 if ((f = fopen(v, "r")) != NULL) {
717 xs *j = xs_readall(f);
718 fclose(f);
719
720 if (j != NULL) {
721 xs *o = xs_json_loads(j);
722
723 if (o != NULL) {
724 char *type = xs_dict_get(o, "type");
725
726 if (!xs_is_null(type) && strcmp(type, "Accept") == 0)
727 list = xs_list_append(list, o);
728 }
729 }
730 }
731 }
732
733 return list;
734}
735
736
702d_char *_muted_fn(snac *snac, char *actor) 737d_char *_muted_fn(snac *snac, char *actor)
703{ 738{
704 xs *md5 = xs_md5_hex(actor, strlen(actor)); 739 xs *md5 = xs_md5_hex(actor, strlen(actor));