Bookmarking can be done from the command line.

This commit is contained in:
default 2024-08-29 07:08:26 +02:00
parent 9a67b19a7c
commit 1022f6db87
2 changed files with 26 additions and 0 deletions

22
main.c
View file

@ -39,6 +39,8 @@ int usage(void)
printf("webfinger_s {basedir} {uid} {actor} Queries about an actor (@user@host or actor url)\n"); 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("pin {basedir} {uid} {msg_url} Pins a message\n");
printf("unpin {basedir} {uid} {msg_url} Unpins 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("block {basedir} {instance_url} Blocks a full instance\n");
printf("unblock {basedir} {instance_url} Unblocks 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"); printf("limit {basedir} {uid} {actor} Limits an actor (drops their announces)\n");
@ -442,6 +444,26 @@ int main(int argc, char *argv[])
return 0; 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) { /** **/ if (strcmp(cmd, "question") == 0) { /** **/
int end_secs = 5 * 60; int end_secs = 5 * 60;
xs *opts = xs_split(url, ";"); xs *opts = xs_split(url, ";");

4
snac.h
View file

@ -166,6 +166,10 @@ void mute(snac *snac, const char *actor);
void unmute(snac *snac, const char *actor); void unmute(snac *snac, const char *actor);
int is_muted(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 pin(snac *user, const char *id);
int unpin(snac *user, const char *id); int unpin(snac *user, const char *id);
int is_pinned(snac *user, const char *id); int is_pinned(snac *user, const char *id);