mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-27 07:13:36 +00:00
New function pending_check() and pending_del().
This commit is contained in:
parent
b91177cb46
commit
129049edf4
2 changed files with 22 additions and 0 deletions
20
data.c
20
data.c
|
@ -1224,6 +1224,16 @@ int pending_add(snac *user, const char *actor, const xs_dict *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int pending_check(snac *user, const char *actor)
|
||||||
|
/* checks if there is a pending follow confirmation for the actor */
|
||||||
|
{
|
||||||
|
xs *md5 = xs_md5_hex(actor, strlen(actor));
|
||||||
|
xs *fn = xs_fmt("%s/pending/%s.json", user->basedir, md5);
|
||||||
|
|
||||||
|
return mtime(fn) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
xs_dict *pending_get(snac *user, const char *actor)
|
xs_dict *pending_get(snac *user, const char *actor)
|
||||||
/* returns the pending follow confirmation for the actor */
|
/* returns the pending follow confirmation for the actor */
|
||||||
{
|
{
|
||||||
|
@ -1241,6 +1251,16 @@ xs_dict *pending_get(snac *user, const char *actor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pending_del(snac *user, const char *actor)
|
||||||
|
/* deletes a pending follow confirmation for the actor */
|
||||||
|
{
|
||||||
|
xs *md5 = xs_md5_hex(actor, strlen(actor));
|
||||||
|
xs *fn = xs_fmt("%s/pending/%s.json", user->basedir, md5);
|
||||||
|
|
||||||
|
unlink(fn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
xs_list *pending_list(snac *user)
|
xs_list *pending_list(snac *user)
|
||||||
/* returns a list of pending follow confirmations */
|
/* returns a list of pending follow confirmations */
|
||||||
{
|
{
|
||||||
|
|
2
snac.h
2
snac.h
|
@ -142,7 +142,9 @@ int follower_check(snac *snac, const char *actor);
|
||||||
xs_list *follower_list(snac *snac);
|
xs_list *follower_list(snac *snac);
|
||||||
|
|
||||||
int pending_add(snac *user, const char *actor, const xs_dict *msg);
|
int pending_add(snac *user, const char *actor, const xs_dict *msg);
|
||||||
|
int pending_check(snac *user, const char *actor);
|
||||||
xs_dict *pending_get(snac *user, const char *actor);
|
xs_dict *pending_get(snac *user, const char *actor);
|
||||||
|
void pending_del(snac *user, const char *actor);
|
||||||
xs_list *pending_list(snac *user);
|
xs_list *pending_list(snac *user);
|
||||||
|
|
||||||
double timeline_mtime(snac *snac);
|
double timeline_mtime(snac *snac);
|
||||||
|
|
Loading…
Reference in a new issue