commit e97092c
default
·
2023-06-15 02:11:39 +0000 UTC
parent 1307b62
Maintain a link to the author object in the following/ subdirectory.
M
data.c
+12,
-1
1@@ -1169,6 +1169,13 @@ int following_add(snac *snac, const char *actor, const xs_dict *msg)
2
3 fwrite(j, 1, strlen(j), f);
4 fclose(f);
5+
6+ /* get the filename of the actor object */
7+ xs *actor_fn = _object_fn(actor);
8+
9+ /* increase its reference count */
10+ fn = xs_replace_i(fn, ".json", "");
11+ link(actor_fn, fn);
12 }
13 else
14 ret = 500;
15@@ -1184,9 +1191,13 @@ int following_del(snac *snac, const char *actor)
16 {
17 xs *fn = _following_fn(snac, actor);
18
19+ snac_debug(snac, 2, xs_fmt("following_del %s %s", actor, fn));
20+
21 unlink(fn);
22
23- snac_debug(snac, 2, xs_fmt("following_del %s %s", actor, fn));
24+ /* also delete the reference to the author */
25+ fn = xs_replace_i(fn, ".json", "");
26+ unlink(fn);
27
28 return 200;
29 }
+0,
-2
1@@ -32,8 +32,6 @@ xs_str *xs_str_time(time_t t, const char *fmt, int local)
2
3 strftime(tmp, sizeof(tmp), fmt, &tm);
4
5-// printf("%d %d\n", local, t - xs_parse_time(tmp, fmt, local));
6-
7 return xs_str_new(tmp);
8 }
9