summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-06-29 08:11:41 +0200
committerdefault <nobody@localhost>2023-06-29 08:11:41 +0200
commit057827eaa34d390cc59f3b2821786c10156a1dc5 (patch)
treeb1b9bf6472f4334c8db51ccfc7d94c181a31c3fb /main.c
parent61957a86da212cb0784dfc3de7bfcafe3dc7589b (diff)
Added command-line interface for [un]blocking full instances.
Diffstat (limited to 'main.c')
-rw-r--r--main.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/main.c b/main.c
index f33ad2f..e1122b7 100644
--- a/main.c
+++ b/main.c
@@ -33,6 +33,9 @@ int usage(void)
printf("webfinger_s {basedir} {uid} {actor} Queries about an actor (@user@host or actor url)\n");
printf("pin {basedir} {uid} {msg_url} Pins a message\n");
printf("unpin {basedir} {uid} {msg_url} Unpins a message\n");
+ printf("block {basedir} {instance_url} Blocks a full instance\n");
+ printf("unblock {basedir} {instance_url} Unblocks a full instance\n");
+
/* printf("question {basedir} {uid} 'opts' Generates a poll (;-separated opts)\n");*/
return 1;
@@ -127,6 +130,28 @@ int main(int argc, char *argv[])
if ((user = GET_ARGV()) == NULL)
return usage();
+ if (strcmp(cmd, "block") == 0) { /** **/
+ int ret = instance_block(user);
+
+ if (ret < 0) {
+ fprintf(stderr, "Error blocking instance %s: %d\n", user, ret);
+ return 1;
+ }
+
+ return 0;
+ }
+
+ if (strcmp(cmd, "unblock") == 0) { /** **/
+ int ret = instance_unblock(user);
+
+ if (ret < 0) {
+ fprintf(stderr, "Error unblocking instance %s: %d\n", user, ret);
+ return 1;
+ }
+
+ return 0;
+ }
+
if (strcmp(cmd, "webfinger") == 0) { /** **/
xs *actor = NULL;
xs *uid = NULL;