snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 1022f6db87ea196630972123601639beb190b4c3
parent 9a67b19a7cebb8f1ddaa3719d8f84386f0b380a0
Author: default <nobody@localhost>
Date:   Thu, 29 Aug 2024 07:08:26 +0200

Bookmarking can be done from the command line.

Diffstat:
Mmain.c | 22++++++++++++++++++++++
Msnac.h | 4++++
2 files changed, 26 insertions(+), 0 deletions(-)

diff --git 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 @@ -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);