diff options
| -rw-r--r-- | activitypub.c | 8 | ||||
| -rw-r--r-- | main.c | 11 |
2 files changed, 9 insertions, 10 deletions
diff --git a/activitypub.c b/activitypub.c index 4966482..369423d 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -1486,7 +1486,7 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts, | |||
| 1486 | xs_list *p; | 1486 | xs_list *p; |
| 1487 | const xs_val *v; | 1487 | const xs_val *v; |
| 1488 | 1488 | ||
| 1489 | /* FIXME: implement scopes 2 and 3 */ | 1489 | /* FIXME: implement scope 3 */ |
| 1490 | int priv = scope == 1; | 1490 | int priv = scope == 1; |
| 1491 | 1491 | ||
| 1492 | if (rcpts == NULL) | 1492 | if (rcpts == NULL) |
| @@ -1606,6 +1606,12 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts, | |||
| 1606 | } | 1606 | } |
| 1607 | } | 1607 | } |
| 1608 | 1608 | ||
| 1609 | if (scope == 2) { | ||
| 1610 | /* Mastodon's "quiet public": add public address to cc */ | ||
| 1611 | if (xs_list_in(cc, public_address) == -1) | ||
| 1612 | cc = xs_list_append(cc, public_address); | ||
| 1613 | } | ||
| 1614 | else | ||
| 1609 | /* no recipients? must be for everybody */ | 1615 | /* no recipients? must be for everybody */ |
| 1610 | if (!priv && xs_list_len(to) == 0) | 1616 | if (!priv && xs_list_len(to) == 0) |
| 1611 | to = xs_list_append(to, public_address); | 1617 | to = xs_list_append(to, public_address); |
| @@ -668,15 +668,8 @@ int main(int argc, char *argv[]) | |||
| 668 | else | 668 | else |
| 669 | content = xs_dup(url); | 669 | content = xs_dup(url); |
| 670 | 670 | ||
| 671 | msg = msg_note(&snac, content, NULL, NULL, attl, 0, getenv("LANG")); | 671 | msg = msg_note(&snac, content, NULL, NULL, attl, |
| 672 | 672 | strcmp(cmd, "note_unlisted") == 0 ? 2 : 0, getenv("LANG")); | |
| 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 | 673 | ||
| 681 | c_msg = msg_create(&snac, msg); | 674 | c_msg = msg_create(&snac, msg); |
| 682 | 675 | ||