commit ff44142

default  ·  2025-01-11 00:39:37 +0000 UTC
parent 6a5ea97
Moved creation of "quiet public" posts to msg_note(), where it belongs.
2 files changed,  +9, -10
M main.c
+7, -1
 1@@ -1486,7 +1486,7 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
 2     xs_list *p;
 3     const xs_val *v;
 4 
 5-    /* FIXME: implement scopes 2 and 3 */
 6+    /* FIXME: implement scope 3 */
 7     int priv = scope == 1;
 8 
 9     if (rcpts == NULL)
10@@ -1606,6 +1606,12 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
11         }
12     }
13 
14+    if (scope == 2) {
15+        /* Mastodon's "quiet public": add public address to cc */
16+        if (xs_list_in(cc, public_address) == -1)
17+            cc = xs_list_append(cc, public_address);
18+    }
19+    else
20     /* no recipients? must be for everybody */
21     if (!priv && xs_list_len(to) == 0)
22         to = xs_list_append(to, public_address);
M main.c
+2, -9
 1@@ -668,15 +668,8 @@ int main(int argc, char *argv[])
 2         else
 3             content = xs_dup(url);
 4 
 5-        msg = msg_note(&snac, content, NULL, NULL, attl, 0, getenv("LANG"));
 6-
 7-        if (strcmp(cmd, "note_unlisted") == 0) {
 8-            /* according to Mastodon, "unlisted" posts (now called "quiet public")
 9-               has the public address as a cc instead of to, so toggle it */
10-            xs *to = xs_dup(xs_dict_get(msg, "to"));
11-            msg = xs_dict_set(msg, "cc", to);
12-            msg = xs_dict_set(msg, "to", xs_stock(XSTYPE_LIST));
13-        }
14+        msg = msg_note(&snac, content, NULL, NULL, attl,
15+            strcmp(cmd, "note_unlisted") == 0 ? 2 : 0, getenv("LANG"));
16 
17         c_msg = msg_create(&snac, msg);
18