From 1022f6db87ea196630972123601639beb190b4c3 Mon Sep 17 00:00:00 2001 From: default Date: Thu, 29 Aug 2024 07:08:26 +0200 Subject: [PATCH] Bookmarking can be done from the command line. --- main.c | 22 ++++++++++++++++++++++ snac.h | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/main.c b/main.c index c88eebe..62d6484 100644 --- a/main.c +++ b/main.c @@ -39,6 +39,8 @@ int usage(void) printf("webfinger_s {basedir} {uid} {actor} Queries about an actor (@user@host or actor url)\n"); printf("pin {basedir} {uid} {msg_url} Pins a message\n"); printf("unpin {basedir} {uid} {msg_url} Unpins a message\n"); + printf("bookmark {basedir} {uid} {msg_url} Bookmarks a message\n"); + printf("unbookmark {basedir} {uid} {msg_url} Unbookmarks a message\n"); printf("block {basedir} {instance_url} Blocks a full instance\n"); printf("unblock {basedir} {instance_url} Unblocks a full instance\n"); printf("limit {basedir} {uid} {actor} Limits an actor (drops their announces)\n"); @@ -442,6 +444,26 @@ int main(int argc, char *argv[]) return 0; } + if (strcmp(cmd, "bookmark") == 0) { /** **/ + int ret = bookmark(&snac, url); + if (ret < 0) { + fprintf(stderr, "error bookmarking %s %d\n", url, ret); + return 1; + } + + return 0; + } + + if (strcmp(cmd, "unbookmark") == 0) { /** **/ + int ret = unbookmark(&snac, url); + if (ret < 0) { + fprintf(stderr, "error unbookmarking %s %d\n", url, ret); + return 1; + } + + return 0; + } + if (strcmp(cmd, "question") == 0) { /** **/ int end_secs = 5 * 60; xs *opts = xs_split(url, ";"); diff --git a/snac.h b/snac.h index 7cf9b81..f428775 100644 --- a/snac.h +++ b/snac.h @@ -166,6 +166,10 @@ void mute(snac *snac, const char *actor); void unmute(snac *snac, const char *actor); int is_muted(snac *snac, const char *actor); +int is_bookmarked(snac *user, const char *id); +int bookmark(snac *user, const char *id); +int unbookmark(snac *user, const char *id); + int pin(snac *user, const char *id); int unpin(snac *user, const char *id); int is_pinned(snac *user, const char *id);