commit e121aeb

default  ·  2022-11-24 08:58:37 +0000 UTC
parent d215f8c
New function object_children().
1 files changed,  +19, -0
M data.c
M data.c
+19, -0
 1@@ -452,6 +452,17 @@ int object_del(const char *id)
 2 }
 3 
 4 
 5+d_char *object_children(const char *id)
 6+/* returns the list of an object's children */
 7+{
 8+    xs *fn = _object_fn(id);
 9+
10+    fn = xs_replace_i(fn, ".json", "_c.idx");
11+
12+    return index_list(fn, XS_ALL);
13+}
14+
15+
16 d_char *_follower_fn(snac *snac, char *actor)
17 {
18     xs *md5 = xs_md5_hex(actor, strlen(actor));
19@@ -1080,6 +1091,14 @@ void hide(snac *snac, const char *id)
20         fclose(f);
21 
22         snac_debug(snac, 2, xs_fmt("hidden %s %s", id, fn));
23+
24+        /* hide all the children */
25+        xs *chld = object_children(id);
26+        char *p, *v;
27+
28+        p = chld;
29+        while (xs_list_iter(&p, &v))
30+            hide(snac, v);
31     }
32 }
33