mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 05:15:04 +00:00
More follower data code.
This commit is contained in:
parent
839cb552f4
commit
acff91e0ad
3 changed files with 25 additions and 1 deletions
7
data.c
7
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
12
main.c
12
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();
|
||||
|
|
7
snac.h
7
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);
|
||||
|
|
Loading…
Reference in a new issue