commit d53d9af

default  ·  2023-03-02 08:28:19 +0000 UTC
parent 29b1249
Enqueue messages to the collected inboxes first.
1 files changed,  +10, -1
+10, -1
 1@@ -282,7 +282,6 @@ d_char *recipient_list(snac *snac, char *msg, int expand_public)
 2 int is_msg_public(snac *snac, xs_dict *msg)
 3 /* checks if a message is public */
 4 {
 5-    int ret = 0;
 6     xs *rcpts = recipient_list(snac, msg, 0);
 7 
 8     return xs_list_in(rcpts, public_address) != -1;
 9@@ -1102,12 +1101,22 @@ void process_user_queue_item(snac *snac, xs_dict *q_item)
10     if (strcmp(type, "message") == 0) {
11         xs_dict *msg = xs_dict_get(q_item, "message");
12         xs *rcpts    = recipient_list(snac, msg, 1);
13+        xs *shibx    = inbox_list();
14         xs_set inboxes;
15         xs_list *p;
16+        xs_str *v;
17         xs_str *actor;
18 
19         xs_set_init(&inboxes);
20 
21+        /* send first to the collected inboxes */
22+        p = shibx;
23+        while (xs_list_iter(&p, &v)) {
24+            if (xs_set_add(&inboxes, v) == 1)
25+                enqueue_output(snac, msg, v, 0);
26+        }
27+
28+        /* iterate now the recipients */
29         p = rcpts;
30         while (xs_list_iter(&p, &actor)) {
31             xs *inbox = get_actor_inbox(snac, actor);