aboutsummaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorgreen <dandelions@disroot.org>2025-03-29 01:27:46 +0100
committergreen <dandelions@disroot.org>2025-05-19 15:19:38 +0200
commit00fd1a1c3eb99c9e441276a7ce8697a1582152b7 (patch)
treea0431b0db7e73508ea2c02190fd0dbe9af961601 /data.c
parent072ae21013dc924c6bb3378a2480b571a66aba98 (diff)
performance: functions to get the number of followers
Diffstat (limited to 'data.c')
-rw-r--r--data.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/data.c b/data.c
index e3fa52d..482a29c 100644
--- a/data.c
+++ b/data.c
@@ -1215,6 +1215,14 @@ int follower_check(snac *snac, const char *actor)
}
+int follower_list_len(snac *snac)
+/* returns the number followers */
+{
+ xs *list = object_user_cache_list(snac, "followers", XS_ALL, 0);
+ return xs_list_len(list);
+}
+
+
xs_list *follower_list(snac *snac)
/* returns the list of followers */
{
@@ -1709,6 +1717,15 @@ int following_get(snac *snac, const char *actor, xs_dict **data)
}
+int following_list_len(snac *snac)
+/* returns number of people being followed */
+{
+ xs *spec = xs_fmt("%s/following/" "*_a.json", snac->basedir);
+ xs *glist = xs_glob(spec, 0, 0);
+ return xs_list_len(glist);
+}
+
+
xs_list *following_list(snac *snac)
/* returns the list of people being followed */
{