diff options
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 34 |
1 files changed, 34 insertions, 0 deletions
| @@ -59,6 +59,8 @@ int usage(void) | |||
| 59 | printf("import_csv {basedir} {uid} Imports data from CSV files\n"); | 59 | printf("import_csv {basedir} {uid} Imports data from CSV files\n"); |
| 60 | printf("import_list {basedir} {uid} {file} Imports a Mastodon CSV list file\n"); | 60 | printf("import_list {basedir} {uid} {file} Imports a Mastodon CSV list file\n"); |
| 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"); | ||
| 63 | printf("list_members {basedir} {uid} {name} Returns the list of accounts inside a list\n"); | ||
| 62 | 64 | ||
| 63 | return 1; | 65 | return 1; |
| 64 | } | 66 | } |
| @@ -282,9 +284,41 @@ int main(int argc, char *argv[]) | |||
| 282 | return migrate_account(&snac); | 284 | return migrate_account(&snac); |
| 283 | } | 285 | } |
| 284 | 286 | ||
| 287 | if (strcmp(cmd, "lists") == 0) { /** **/ | ||
| 288 | xs *lol = list_maint(&snac, NULL, 0); | ||
| 289 | const xs_list *l; | ||
| 290 | |||
| 291 | xs_list_foreach(lol, l) { | ||
| 292 | printf("%s (%s)\n", xs_list_get(l, 1), xs_list_get(l, 0)); | ||
| 293 | } | ||
| 294 | |||
| 295 | return 0; | ||
| 296 | } | ||
| 297 | |||
| 285 | if ((url = GET_ARGV()) == NULL) | 298 | if ((url = GET_ARGV()) == NULL) |
| 286 | return usage(); | 299 | return usage(); |
| 287 | 300 | ||
| 301 | if (strcmp(cmd, "list_members") == 0) { /** **/ | ||
| 302 | xs *lid = list_maint(&snac, url, 4); | ||
| 303 | |||
| 304 | if (lid != NULL) { | ||
| 305 | xs *lcont = list_content(&snac, lid, NULL, 0); | ||
| 306 | const char *md5; | ||
| 307 | |||
| 308 | xs_list_foreach(lcont, md5) { | ||
| 309 | xs *actor = NULL; | ||
| 310 | |||
| 311 | if (valid_status(object_get_by_md5(md5, &actor))) { | ||
| 312 | printf("%s (%s)\n", xs_dict_get(actor, "id"), xs_dict_get_def(actor, "preferredUsername", "")); | ||
| 313 | } | ||
| 314 | } | ||
| 315 | } | ||
| 316 | else | ||
| 317 | fprintf(stderr, "Cannot find list named '%s'\n", url); | ||
| 318 | |||
| 319 | return 0; | ||
| 320 | } | ||
| 321 | |||
| 288 | if (strcmp(cmd, "alias") == 0) { /** **/ | 322 | if (strcmp(cmd, "alias") == 0) { /** **/ |
| 289 | xs *actor = NULL; | 323 | xs *actor = NULL; |
| 290 | xs *uid = NULL; | 324 | xs *uid = NULL; |