summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-06-15 04:11:39 +0200
committerdefault <nobody@localhost>2023-06-15 04:11:39 +0200
commite97092cf0c35fb51c2900c8001d89daf32a07ba1 (patch)
tree83936805fe7a3e69f161d9c43cf31f5b7d1b6d95 /data.c
parent1307b6203cd9e963514a3a2808f569f6d0e69a7e (diff)
Maintain a link to the author object in the following/ subdirectory.
Diffstat (limited to 'data.c')
-rw-r--r--data.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/data.c b/data.c
index 2748cce..0a7898b 100644
--- a/data.c
+++ b/data.c
@@ -1169,6 +1169,13 @@ int following_add(snac *snac, const char *actor, const xs_dict *msg)
fwrite(j, 1, strlen(j), f);
fclose(f);
+
+ /* get the filename of the actor object */
+ xs *actor_fn = _object_fn(actor);
+
+ /* increase its reference count */
+ fn = xs_replace_i(fn, ".json", "");
+ link(actor_fn, fn);
}
else
ret = 500;
@@ -1184,9 +1191,13 @@ int following_del(snac *snac, const char *actor)
{
xs *fn = _following_fn(snac, actor);
+ snac_debug(snac, 2, xs_fmt("following_del %s %s", actor, fn));
+
unlink(fn);
- snac_debug(snac, 2, xs_fmt("following_del %s %s", actor, fn));
+ /* also delete the reference to the author */
+ fn = xs_replace_i(fn, ".json", "");
+ unlink(fn);
return 200;
}