commit f766507

default  ·  2024-06-17 15:28:10 +0000 UTC
parent 5b1e771
Only send notes and poll to the collected inboxes.
1 files changed,  +8, -8
+8, -8
 1@@ -2182,16 +2182,16 @@ void process_user_queue_item(snac *snac, xs_dict *q_item)
 2 
 3     if (strcmp(type, "message") == 0) {
 4         const xs_dict *msg = xs_dict_get(q_item, "message");
 5-        xs *rcpts    = recipient_list(snac, msg, 1);
 6+        xs *rcpts = recipient_list(snac, msg, 1);
 7         xs_set inboxes;
 8-        xs_list *p;
 9         const xs_str *actor;
10+        int c;
11 
12         xs_set_init(&inboxes);
13 
14         /* iterate the recipients */
15-        p = rcpts;
16-        while (xs_list_iter(&p, &actor)) {
17+        c = 0;
18+        while (xs_list_next(rcpts, &actor, &c)) {
19             xs *inbox = get_actor_inbox(actor);
20 
21             if (inbox != NULL) {
22@@ -2203,14 +2203,14 @@ void process_user_queue_item(snac *snac, xs_dict *q_item)
23                 snac_log(snac, xs_fmt("cannot find inbox for %s", actor));
24         }
25 
26-        /* if it's public, send to the collected inboxes */
27-        if (is_msg_public(msg)) {
28+        /* if it's a public note or question, send to the collected inboxes */
29+        if (xs_match(xs_dict_get_def(msg, "type", ""), "Create") && is_msg_public(msg)) {
30             if (xs_type(xs_dict_get(srv_config, "disable_inbox_collection")) != XSTYPE_TRUE) {
31                 xs *shibx = inbox_list();
32                 const xs_str *inbox;
33 
34-                p = shibx;
35-                while (xs_list_iter(&p, &inbox)) {
36+                c = 0;
37+                while (xs_list_next(shibx, &inbox, &c)) {
38                     if (xs_set_add(&inboxes, inbox) == 1)
39                         enqueue_output(snac, msg, inbox, 0, 0);
40                 }