mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-15 01:55:03 +00:00
Maintain a link to the author object in the following/ subdirectory.
This commit is contained in:
parent
1307b6203c
commit
e97092cf0c
2 changed files with 12 additions and 3 deletions
13
data.c
13
data.c
|
@ -1169,6 +1169,13 @@ int following_add(snac *snac, const char *actor, const xs_dict *msg)
|
||||||
|
|
||||||
fwrite(j, 1, strlen(j), f);
|
fwrite(j, 1, strlen(j), f);
|
||||||
fclose(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
|
else
|
||||||
ret = 500;
|
ret = 500;
|
||||||
|
@ -1184,9 +1191,13 @@ int following_del(snac *snac, const char *actor)
|
||||||
{
|
{
|
||||||
xs *fn = _following_fn(snac, actor);
|
xs *fn = _following_fn(snac, actor);
|
||||||
|
|
||||||
|
snac_debug(snac, 2, xs_fmt("following_del %s %s", actor, fn));
|
||||||
|
|
||||||
unlink(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;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,6 @@ xs_str *xs_str_time(time_t t, const char *fmt, int local)
|
||||||
|
|
||||||
strftime(tmp, sizeof(tmp), fmt, &tm);
|
strftime(tmp, sizeof(tmp), fmt, &tm);
|
||||||
|
|
||||||
// printf("%d %d\n", local, t - xs_parse_time(tmp, fmt, local));
|
|
||||||
|
|
||||||
return xs_str_new(tmp);
|
return xs_str_new(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue