diff --git a/data.c b/data.c index 72efb17..4486dc6 100644 --- a/data.c +++ b/data.c @@ -252,6 +252,13 @@ d_char *follower_list(snac *snac) FILE *f; if ((f = fopen(p, "r")) != NULL) { + xs *j = xs_readall(f); + xs *o = xs_json_loads(j); + + if (o != NULL) + list = xs_list_append(list, o); + + fclose(f); } } } diff --git a/main.c b/main.c index 3f94931..f6fc5e2 100644 --- a/main.c +++ b/main.c @@ -14,7 +14,17 @@ int main(int argc, char *argv[]) srv_open("/home/angel/lib/snac/comam.es/"); user_open(&snac, "mike"); - snac_log(&snac, xs_str_new("ok")); + + { + xs *list = follower_list(&snac); + char *p, *obj; + + p = list; + while (xs_list_iter(&p, &obj)) { + char *actor = xs_dict_get(obj, "actor"); + printf("%s\n", actor); + } + } { xs *list = user_list(); diff --git a/snac.h b/snac.h index ee33848..2faf3bf 100644 --- a/snac.h +++ b/snac.h @@ -37,3 +37,10 @@ int validate_uid(char *uid); d_char *hash_password(char *uid, char *passwd, char *nonce); int check_password(char *uid, char *passwd, char *hash); + +float mtime(char *fn); + +int follower_add(snac *snac, char *actor, char *msg); +int follower_del(snac *snac, char *actor); +int follower_check(snac *snac, char *actor); +d_char *follower_list(snac *snac);