summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorGravatar default2023-06-15 04:11:39 +0200
committerGravatar default2023-06-15 04:11:39 +0200
commite97092cf0c35fb51c2900c8001d89daf32a07ba1 (patch)
tree83936805fe7a3e69f161d9c43cf31f5b7d1b6d95 /data.c
parentUse utimes() to 'touch' the actor file in actor_get(). (diff)
downloadsnac2-e97092cf0c35fb51c2900c8001d89daf32a07ba1.tar.gz
snac2-e97092cf0c35fb51c2900c8001d89daf32a07ba1.tar.xz
snac2-e97092cf0c35fb51c2900c8001d89daf32a07ba1.zip
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)
1169 1169
1170 fwrite(j, 1, strlen(j), f); 1170 fwrite(j, 1, strlen(j), f);
1171 fclose(f); 1171 fclose(f);
1172
1173 /* get the filename of the actor object */
1174 xs *actor_fn = _object_fn(actor);
1175
1176 /* increase its reference count */
1177 fn = xs_replace_i(fn, ".json", "");
1178 link(actor_fn, fn);
1172 } 1179 }
1173 else 1180 else
1174 ret = 500; 1181 ret = 500;
@@ -1184,9 +1191,13 @@ int following_del(snac *snac, const char *actor)
1184{ 1191{
1185 xs *fn = _following_fn(snac, actor); 1192 xs *fn = _following_fn(snac, actor);
1186 1193
1194 snac_debug(snac, 2, xs_fmt("following_del %s %s", actor, fn));
1195
1187 unlink(fn); 1196 unlink(fn);
1188 1197
1189 snac_debug(snac, 2, xs_fmt("following_del %s %s", actor, fn)); 1198 /* also delete the reference to the author */
1199 fn = xs_replace_i(fn, ".json", "");
1200 unlink(fn);
1190 1201
1191 return 200; 1202 return 200;
1192} 1203}