diff options
author | default <nobody@localhost> | 2022-10-04 18:46:12 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2022-10-04 18:46:12 +0200 |
commit | ae06064e4d77d10b82c6061427dcc01d942b1dd8 (patch) | |
tree | 6da9cbb635f377f908e2a442cb122dc6a8f42b8a /main.c | |
parent | 5192e28444a3e1a613440ef6813cb978c36d2948 (diff) |
New command-line option purge.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -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(); |