summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-10-04 18:46:12 +0200
committerdefault <nobody@localhost>2022-10-04 18:46:12 +0200
commitae06064e4d77d10b82c6061427dcc01d942b1dd8 (patch)
tree6da9cbb635f377f908e2a442cb122dc6a8f42b8a /main.c
parent5192e28444a3e1a613440ef6813cb978c36d2948 (diff)
New command-line option purge.
Diffstat (limited to 'main.c')
-rw-r--r--main.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/main.c b/main.c
index 18c7c22..52eca27 100644
--- a/main.c
+++ b/main.c
@@ -18,12 +18,12 @@ int usage(void)
printf("init [{basedir}] Initializes the database\n");
printf("adduser {basedir} [{uid}] Adds a new user\n");
printf("httpd {basedir} Starts the HTTPD daemon\n");
+ printf("purge {basedir} Purges old data\n");
printf("webfinger {basedir} {user} Queries about a @user@host or actor\n");
printf("queue {basedir} {uid} Processes a user queue\n");
printf("follow {basedir} {uid} {actor} Follows an actor\n");
// printf("check {basedir} [{uid}] Checks the database\n");
-// printf("purge {basedir} [{uid}] Purges old data\n");
// printf("update {basedir} {uid} Sends a user update to followers\n");
// printf("passwd {basedir} {uid} Sets the password for {uid}\n");
@@ -95,6 +95,22 @@ int main(int argc, char *argv[])
return 0;
}
+ if (strcmp(cmd, "purge") == 0) {
+ /* iterate all users */
+ xs *list = user_list();
+ char *p, *uid;
+
+ p = list;
+ while (xs_list_iter(&p, &uid)) {
+ if (user_open(&snac, uid)) {
+ purge(&snac);
+ user_free(&snac);
+ }
+ }
+
+ return 0;
+ }
+
if ((user = GET_ARGV()) == NULL)
return usage();