commit 1022f6d

default  ·  2024-08-29 05:08:26 +0000 UTC
parent 9a67b19
Bookmarking can be done from the command line.
2 files changed,  +26, -0
M main.c
M snac.h
M main.c
+22, -0
 1@@ -39,6 +39,8 @@ int usage(void)
 2     printf("webfinger_s {basedir} {uid} {actor}  Queries about an actor (@user@host or actor url)\n");
 3     printf("pin {basedir} {uid} {msg_url}        Pins a message\n");
 4     printf("unpin {basedir} {uid} {msg_url}      Unpins a message\n");
 5+    printf("bookmark {basedir} {uid} {msg_url}   Bookmarks a message\n");
 6+    printf("unbookmark {basedir} {uid} {msg_url} Unbookmarks a message\n");
 7     printf("block {basedir} {instance_url}       Blocks a full instance\n");
 8     printf("unblock {basedir} {instance_url}     Unblocks a full instance\n");
 9     printf("limit {basedir} {uid} {actor}        Limits an actor (drops their announces)\n");
10@@ -442,6 +444,26 @@ int main(int argc, char *argv[])
11         return 0;
12     }
13 
14+    if (strcmp(cmd, "bookmark") == 0) { /** **/
15+        int ret = bookmark(&snac, url);
16+        if (ret < 0) {
17+            fprintf(stderr, "error bookmarking %s %d\n", url, ret);
18+            return 1;
19+        }
20+
21+        return 0;
22+    }
23+
24+    if (strcmp(cmd, "unbookmark") == 0) { /** **/
25+        int ret = unbookmark(&snac, url);
26+        if (ret < 0) {
27+            fprintf(stderr, "error unbookmarking %s %d\n", url, ret);
28+            return 1;
29+        }
30+
31+        return 0;
32+    }
33+
34     if (strcmp(cmd, "question") == 0) { /** **/
35         int end_secs = 5 * 60;
36         xs *opts = xs_split(url, ";");
M snac.h
+4, -0
 1@@ -166,6 +166,10 @@ void mute(snac *snac, const char *actor);
 2 void unmute(snac *snac, const char *actor);
 3 int is_muted(snac *snac, const char *actor);
 4 
 5+int is_bookmarked(snac *user, const char *id);
 6+int bookmark(snac *user, const char *id);
 7+int unbookmark(snac *user, const char *id);
 8+
 9 int pin(snac *user, const char *id);
10 int unpin(snac *user, const char *id);
11 int is_pinned(snac *user, const char *id);