snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit e121aeb948280d3c519d2ae276dc71df88b90e4d
parent d215f8ce4634ab769f52d70119fed2dd0d8124f9
Author: default <nobody@localhost>
Date:   Thu, 24 Nov 2022 09:58:37 +0100

New function object_children().

Diffstat:
Mdata.c | 19+++++++++++++++++++
1 file changed, 19 insertions(+), 0 deletions(-)

diff --git a/data.c b/data.c @@ -452,6 +452,17 @@ int object_del(const char *id) } +d_char *object_children(const char *id) +/* returns the list of an object's children */ +{ + xs *fn = _object_fn(id); + + fn = xs_replace_i(fn, ".json", "_c.idx"); + + return index_list(fn, XS_ALL); +} + + d_char *_follower_fn(snac *snac, char *actor) { xs *md5 = xs_md5_hex(actor, strlen(actor)); @@ -1080,6 +1091,14 @@ void hide(snac *snac, const char *id) fclose(f); snac_debug(snac, 2, xs_fmt("hidden %s %s", id, fn)); + + /* hide all the children */ + xs *chld = object_children(id); + char *p, *v; + + p = chld; + while (xs_list_iter(&p, &v)) + hide(snac, v); } }