diff options
| author | 2024-08-29 07:08:26 +0200 | |
|---|---|---|
| committer | 2024-08-29 07:08:26 +0200 | |
| commit | 1022f6db87ea196630972123601639beb190b4c3 (patch) | |
| tree | e995c3fe584ef2ee99d5140556657f2aa2a94b62 | |
| parent | Simplified pinning functions. (diff) | |
| download | snac2-1022f6db87ea196630972123601639beb190b4c3.tar.gz snac2-1022f6db87ea196630972123601639beb190b4c3.tar.xz snac2-1022f6db87ea196630972123601639beb190b4c3.zip | |
Bookmarking can be done from the command line.
| -rw-r--r-- | main.c | 22 | ||||
| -rw-r--r-- | snac.h | 4 |
2 files changed, 26 insertions, 0 deletions
| @@ -39,6 +39,8 @@ int usage(void) | |||
| 39 | printf("webfinger_s {basedir} {uid} {actor} Queries about an actor (@user@host or actor url)\n"); | 39 | printf("webfinger_s {basedir} {uid} {actor} Queries about an actor (@user@host or actor url)\n"); |
| 40 | printf("pin {basedir} {uid} {msg_url} Pins a message\n"); | 40 | printf("pin {basedir} {uid} {msg_url} Pins a message\n"); |
| 41 | printf("unpin {basedir} {uid} {msg_url} Unpins a message\n"); | 41 | printf("unpin {basedir} {uid} {msg_url} Unpins a message\n"); |
| 42 | printf("bookmark {basedir} {uid} {msg_url} Bookmarks a message\n"); | ||
| 43 | printf("unbookmark {basedir} {uid} {msg_url} Unbookmarks a message\n"); | ||
| 42 | printf("block {basedir} {instance_url} Blocks a full instance\n"); | 44 | printf("block {basedir} {instance_url} Blocks a full instance\n"); |
| 43 | printf("unblock {basedir} {instance_url} Unblocks a full instance\n"); | 45 | printf("unblock {basedir} {instance_url} Unblocks a full instance\n"); |
| 44 | printf("limit {basedir} {uid} {actor} Limits an actor (drops their announces)\n"); | 46 | printf("limit {basedir} {uid} {actor} Limits an actor (drops their announces)\n"); |
| @@ -442,6 +444,26 @@ int main(int argc, char *argv[]) | |||
| 442 | return 0; | 444 | return 0; |
| 443 | } | 445 | } |
| 444 | 446 | ||
| 447 | if (strcmp(cmd, "bookmark") == 0) { /** **/ | ||
| 448 | int ret = bookmark(&snac, url); | ||
| 449 | if (ret < 0) { | ||
| 450 | fprintf(stderr, "error bookmarking %s %d\n", url, ret); | ||
| 451 | return 1; | ||
| 452 | } | ||
| 453 | |||
| 454 | return 0; | ||
| 455 | } | ||
| 456 | |||
| 457 | if (strcmp(cmd, "unbookmark") == 0) { /** **/ | ||
| 458 | int ret = unbookmark(&snac, url); | ||
| 459 | if (ret < 0) { | ||
| 460 | fprintf(stderr, "error unbookmarking %s %d\n", url, ret); | ||
| 461 | return 1; | ||
| 462 | } | ||
| 463 | |||
| 464 | return 0; | ||
| 465 | } | ||
| 466 | |||
| 445 | if (strcmp(cmd, "question") == 0) { /** **/ | 467 | if (strcmp(cmd, "question") == 0) { /** **/ |
| 446 | int end_secs = 5 * 60; | 468 | int end_secs = 5 * 60; |
| 447 | xs *opts = xs_split(url, ";"); | 469 | xs *opts = xs_split(url, ";"); |
| @@ -166,6 +166,10 @@ void mute(snac *snac, const char *actor); | |||
| 166 | void unmute(snac *snac, const char *actor); | 166 | void unmute(snac *snac, const char *actor); |
| 167 | int is_muted(snac *snac, const char *actor); | 167 | int is_muted(snac *snac, const char *actor); |
| 168 | 168 | ||
| 169 | int is_bookmarked(snac *user, const char *id); | ||
| 170 | int bookmark(snac *user, const char *id); | ||
| 171 | int unbookmark(snac *user, const char *id); | ||
| 172 | |||
| 169 | int pin(snac *user, const char *id); | 173 | int pin(snac *user, const char *id); |
| 170 | int unpin(snac *user, const char *id); | 174 | int unpin(snac *user, const char *id); |
| 171 | int is_pinned(snac *user, const char *id); | 175 | int is_pinned(snac *user, const char *id); |