commit b3be8e0

default  ·  2024-11-25 09:24:47 +0000 UTC
parent 2eff3ff
New cmdline ops 'import_list' and 'import_block_list'.
2 files changed,  +15, -1
M main.c
M main.c
+14, -0
 1@@ -52,6 +52,8 @@ int usage(void)
 2     printf("alias {basedir} {uid} {account}      Sets account (@user@host or actor url) as an alias\n");
 3     printf("migrate {basedir} {uid}              Migrates to the account defined as the alias\n");
 4     printf("import_csv {basedir} {uid}           Imports data from CSV files into current directory\n");
 5+    printf("import_list {basedir} {uid} {file}   Imports a Mastodon CSV list file\n");
 6+    printf("import_block_list {basedir} {uid} {file} Imports a Mastodon CSV block list file\n");
 7 
 8     return 1;
 9 }
10@@ -589,6 +591,18 @@ int main(int argc, char *argv[])
11         return 0;
12     }
13 
14+    if (strcmp(cmd, "import_list") == 0) { /** **/
15+        import_list_csv(&snac, url);
16+
17+        return 0;
18+    }
19+
20+    if (strcmp(cmd, "import_block_list") == 0) { /** **/
21+        import_blocked_accounts_csv(&snac, url);
22+
23+        return 0;
24+    }
25+
26     if (strcmp(cmd, "note") == 0) { /** **/
27         xs *content = NULL;
28         xs *msg = NULL;
+1, -1
1@@ -681,7 +681,7 @@ void import_blocked_accounts_csv(snac *user, const char *fn)
2         while (!feof(f)) {
3             xs *l = xs_strip_i(xs_readline(f));
4 
5-            if (*l) {
6+            if (*l && strchr(l, '@') != NULL) {
7                 xs *url = NULL;
8                 xs *uid = NULL;
9