diff options
| author | 2023-06-29 08:11:41 +0200 | |
|---|---|---|
| committer | 2023-06-29 08:11:41 +0200 | |
| commit | 057827eaa34d390cc59f3b2821786c10156a1dc5 (patch) | |
| tree | b1b9bf6472f4334c8db51ccfc7d94c181a31c3fb /main.c | |
| parent | Added instance blocking to data storage. (diff) | |
| download | penes-snac2-057827eaa34d390cc59f3b2821786c10156a1dc5.tar.gz penes-snac2-057827eaa34d390cc59f3b2821786c10156a1dc5.tar.xz penes-snac2-057827eaa34d390cc59f3b2821786c10156a1dc5.zip | |
Added command-line interface for [un]blocking full instances.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 25 |
1 files changed, 25 insertions, 0 deletions
| @@ -33,6 +33,9 @@ int usage(void) | |||
| 33 | printf("webfinger_s {basedir} {uid} {actor} Queries about an actor (@user@host or actor url)\n"); | 33 | printf("webfinger_s {basedir} {uid} {actor} Queries about an actor (@user@host or actor url)\n"); |
| 34 | printf("pin {basedir} {uid} {msg_url} Pins a message\n"); | 34 | printf("pin {basedir} {uid} {msg_url} Pins a message\n"); |
| 35 | printf("unpin {basedir} {uid} {msg_url} Unpins a message\n"); | 35 | printf("unpin {basedir} {uid} {msg_url} Unpins a message\n"); |
| 36 | printf("block {basedir} {instance_url} Blocks a full instance\n"); | ||
| 37 | printf("unblock {basedir} {instance_url} Unblocks a full instance\n"); | ||
| 38 | |||
| 36 | /* printf("question {basedir} {uid} 'opts' Generates a poll (;-separated opts)\n");*/ | 39 | /* printf("question {basedir} {uid} 'opts' Generates a poll (;-separated opts)\n");*/ |
| 37 | 40 | ||
| 38 | return 1; | 41 | return 1; |
| @@ -127,6 +130,28 @@ int main(int argc, char *argv[]) | |||
| 127 | if ((user = GET_ARGV()) == NULL) | 130 | if ((user = GET_ARGV()) == NULL) |
| 128 | return usage(); | 131 | return usage(); |
| 129 | 132 | ||
| 133 | if (strcmp(cmd, "block") == 0) { /** **/ | ||
| 134 | int ret = instance_block(user); | ||
| 135 | |||
| 136 | if (ret < 0) { | ||
| 137 | fprintf(stderr, "Error blocking instance %s: %d\n", user, ret); | ||
| 138 | return 1; | ||
| 139 | } | ||
| 140 | |||
| 141 | return 0; | ||
| 142 | } | ||
| 143 | |||
| 144 | if (strcmp(cmd, "unblock") == 0) { /** **/ | ||
| 145 | int ret = instance_unblock(user); | ||
| 146 | |||
| 147 | if (ret < 0) { | ||
| 148 | fprintf(stderr, "Error unblocking instance %s: %d\n", user, ret); | ||
| 149 | return 1; | ||
| 150 | } | ||
| 151 | |||
| 152 | return 0; | ||
| 153 | } | ||
| 154 | |||
| 130 | if (strcmp(cmd, "webfinger") == 0) { /** **/ | 155 | if (strcmp(cmd, "webfinger") == 0) { /** **/ |
| 131 | xs *actor = NULL; | 156 | xs *actor = NULL; |
| 132 | xs *uid = NULL; | 157 | xs *uid = NULL; |