summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/main.c b/main.c
index 54da610..8b8b209 100644
--- a/main.c
+++ b/main.c
@@ -61,6 +61,9 @@ int usage(void)
61 printf("import_block_list {basedir} {uid} {file} Imports a Mastodon CSV block list file\n"); 61 printf("import_block_list {basedir} {uid} {file} Imports a Mastodon CSV block list file\n");
62 printf("lists {basedir} {uid} Returns the names of the lists created by the user\n"); 62 printf("lists {basedir} {uid} Returns the names of the lists created by the user\n");
63 printf("list_members {basedir} {uid} {name} Returns the list of accounts inside a list\n"); 63 printf("list_members {basedir} {uid} {name} Returns the list of accounts inside a list\n");
64 printf("create_list {basedir} {uid} {name} Creates a new list\n");
65 printf("delete_list {basedir} {uid} {name} Deletes an existing list\n");
66 printf("add_to_list {basedir} {uid} {name} {acct} Adds an account (@user@host or actor url) to a list\n");
64 67
65 return 1; 68 return 1;
66} 69}
@@ -345,6 +348,33 @@ int main(int argc, char *argv[])
345 return 0; 348 return 0;
346 } 349 }
347 350
351 if (strcmp(cmd, "add_to_list") == 0) { /** **/
352 const char *account = GET_ARGV();
353
354 if (account != NULL) {
355 xs *lid = list_maint(&snac, url, 4);
356
357 if (lid != NULL) {
358 xs *actor = NULL;
359 xs *uid = NULL;
360
361 if (valid_status(webfinger_request(account, &actor, &uid))) {
362 xs *md5 = xs_md5_hex(actor, strlen(actor));
363
364 list_content(&snac, lid, md5, 1);
365 printf("Actor %s (%s) added to list %s (%s)\n", actor, uid, url, lid);
366 }
367 else
368 fprintf(stderr, "Cannot resolve account '%s'\n", account);
369 }
370 else
371 fprintf(stderr, "Cannot find a list named '%s'\n", url);
372
373 }
374
375 return 0;
376 }
377
348 if (strcmp(cmd, "alias") == 0) { /** **/ 378 if (strcmp(cmd, "alias") == 0) { /** **/
349 xs *actor = NULL; 379 xs *actor = NULL;
350 xs *uid = NULL; 380 xs *uid = NULL;