Browse Source

New cmdline ops 'import_list' and 'import_block_list'.

default 4 months ago
parent
commit
b3be8e0673
2 changed files with 15 additions and 1 deletions
  1. 14 0
      main.c
  2. 1 1
      utils.c

+ 14 - 0
main.c

@@ -52,6 +52,8 @@ int usage(void)
     printf("alias {basedir} {uid} {account}      Sets account (@user@host or actor url) as an alias\n");
     printf("migrate {basedir} {uid}              Migrates to the account defined as the alias\n");
     printf("import_csv {basedir} {uid}           Imports data from CSV files into current directory\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");
 
     return 1;
 }
@@ -589,6 +591,18 @@ int main(int argc, char *argv[])
         return 0;
     }
 
+    if (strcmp(cmd, "import_list") == 0) { /** **/
+        import_list_csv(&snac, url);
+
+        return 0;
+    }
+
+    if (strcmp(cmd, "import_block_list") == 0) { /** **/
+        import_blocked_accounts_csv(&snac, url);
+
+        return 0;
+    }
+
     if (strcmp(cmd, "note") == 0) { /** **/
         xs *content = NULL;
         xs *msg = NULL;

+ 1 - 1
utils.c

@@ -681,7 +681,7 @@ void import_blocked_accounts_csv(snac *user, const char *fn)
         while (!feof(f)) {
             xs *l = xs_strip_i(xs_readline(f));
 
-            if (*l) {
+            if (*l && strchr(l, '@') != NULL) {
                 xs *url = NULL;
                 xs *uid = NULL;