aboutsummaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-11-24 08:37:19 +0100
committerdefault <nobody@localhost>2024-11-24 08:37:19 +0100
commit129049edf4752495f768b247253cb7ffc848b0cc (patch)
tree176241029e4a541d5b1be40f4c6e27155126c518 /data.c
parentb91177cb464ffdb118d50569592be3f9789dbef6 (diff)
New function pending_check() and pending_del().
Diffstat (limited to 'data.c')
-rw-r--r--data.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/data.c b/data.c
index 79c7001..8bc35aa 100644
--- a/data.c
+++ b/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)
/* 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)
/* returns a list of pending follow confirmations */
{