|
|
@@ -59,6 +59,8 @@ int usage(void)
|
|
|
printf("import_csv {basedir} {uid} Imports data from CSV files\n");
|
|
|
printf("import_list {basedir} {uid} {file} Imports a Mastodon CSV list file\n");
|
|
|
printf("import_block_list {basedir} {uid} {file} Imports a Mastodon CSV block list file\n");
|
|
|
+ printf("lists {basedir} {uid} Returns the names of the lists created by the user\n");
|
|
|
+ printf("list_members {basedir} {uid} {name} Returns the list of accounts inside a list\n");
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
@@ -282,9 +284,41 @@ int main(int argc, char *argv[])
|
|
|
return migrate_account(&snac);
|
|
|
}
|
|
|
|
|
|
+ if (strcmp(cmd, "lists") == 0) { /** **/
|
|
|
+ xs *lol = list_maint(&snac, NULL, 0);
|
|
|
+ const xs_list *l;
|
|
|
+
|
|
|
+ xs_list_foreach(lol, l) {
|
|
|
+ printf("%s (%s)\n", xs_list_get(l, 1), xs_list_get(l, 0));
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
if ((url = GET_ARGV()) == NULL)
|
|
|
return usage();
|
|
|
|
|
|
+ if (strcmp(cmd, "list_members") == 0) { /** **/
|
|
|
+ xs *lid = list_maint(&snac, url, 4);
|
|
|
+
|
|
|
+ if (lid != NULL) {
|
|
|
+ xs *lcont = list_content(&snac, lid, NULL, 0);
|
|
|
+ const char *md5;
|
|
|
+
|
|
|
+ xs_list_foreach(lcont, md5) {
|
|
|
+ xs *actor = NULL;
|
|
|
+
|
|
|
+ if (valid_status(object_get_by_md5(md5, &actor))) {
|
|
|
+ printf("%s (%s)\n", xs_dict_get(actor, "id"), xs_dict_get_def(actor, "preferredUsername", ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ fprintf(stderr, "Cannot find list named '%s'\n", url);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
if (strcmp(cmd, "alias") == 0) { /** **/
|
|
|
xs *actor = NULL;
|
|
|
xs *uid = NULL;
|