diff options
| author | 2025-01-06 18:04:56 +0100 | |
|---|---|---|
| committer | 2025-01-06 18:04:56 +0100 | |
| commit | 00eb86deaf1c4e00f44e15ca13bb9fe9984e57aa (patch) | |
| tree | b32a388fdad722d2f02a231dc17e16fa84fa2fa7 /main.c | |
| parent | In the /share page, set the charset explicitly to utf-8. (diff) | |
| download | penes-snac2-00eb86deaf1c4e00f44e15ca13bb9fe9984e57aa.tar.gz penes-snac2-00eb86deaf1c4e00f44e15ca13bb9fe9984e57aa.tar.xz penes-snac2-00eb86deaf1c4e00f44e15ca13bb9fe9984e57aa.zip | |
New command-line operation 'note_unlisted'.
Diffstat (limited to '')
| -rw-r--r-- | main.c | 11 |
1 files changed, 10 insertions, 1 deletions
| @@ -33,6 +33,7 @@ int usage(void) | |||
| 33 | printf("insert {basedir} {uid} {url} Requests an object and inserts it into the timeline\n"); | 33 | printf("insert {basedir} {uid} {url} Requests an object and inserts it into the timeline\n"); |
| 34 | printf("actor {basedir} [{uid}] {url} Requests an actor\n"); | 34 | printf("actor {basedir} [{uid}] {url} Requests an actor\n"); |
| 35 | printf("note {basedir} {uid} {text} [files...] Sends a note with optional attachments\n"); | 35 | printf("note {basedir} {uid} {text} [files...] Sends a note with optional attachments\n"); |
| 36 | printf("note_unlisted {basedir} {uid} {text} [files...] Sends an unlisted note with optional attachments\n"); | ||
| 36 | printf("boost|announce {basedir} {uid} {url} Boosts (announces) a post\n"); | 37 | printf("boost|announce {basedir} {uid} {url} Boosts (announces) a post\n"); |
| 37 | printf("unboost {basedir} {uid} {url} Unboosts a post\n"); | 38 | printf("unboost {basedir} {uid} {url} Unboosts a post\n"); |
| 38 | printf("resetpwd {basedir} {uid} Resets the password of a user\n"); | 39 | printf("resetpwd {basedir} {uid} Resets the password of a user\n"); |
| @@ -603,7 +604,7 @@ int main(int argc, char *argv[]) | |||
| 603 | return 0; | 604 | return 0; |
| 604 | } | 605 | } |
| 605 | 606 | ||
| 606 | if (strcmp(cmd, "note") == 0) { /** **/ | 607 | if (strcmp(cmd, "note") == 0 || strcmp(cmd, "note_unlisted") == 0) { /** **/ |
| 607 | xs *content = NULL; | 608 | xs *content = NULL; |
| 608 | xs *msg = NULL; | 609 | xs *msg = NULL; |
| 609 | xs *c_msg = NULL; | 610 | xs *c_msg = NULL; |
| @@ -669,6 +670,14 @@ int main(int argc, char *argv[]) | |||
| 669 | 670 | ||
| 670 | msg = msg_note(&snac, content, NULL, NULL, attl, 0, getenv("LANG")); | 671 | msg = msg_note(&snac, content, NULL, NULL, attl, 0, getenv("LANG")); |
| 671 | 672 | ||
| 673 | if (strcmp(cmd, "note_unlisted") == 0) { | ||
| 674 | /* according to Mastodon, "unlisted" posts (now called "quiet public") | ||
| 675 | has the public address as a cc instead of to, so toggle it */ | ||
| 676 | xs *to = xs_dup(xs_dict_get(msg, "to")); | ||
| 677 | msg = xs_dict_set(msg, "cc", to); | ||
| 678 | msg = xs_dict_set(msg, "to", xs_stock(XSTYPE_LIST)); | ||
| 679 | } | ||
| 680 | |||
| 672 | c_msg = msg_create(&snac, msg); | 681 | c_msg = msg_create(&snac, msg); |
| 673 | 682 | ||
| 674 | if (dbglevel) { | 683 | if (dbglevel) { |