diff options
| author | 2023-03-02 09:28:19 +0100 | |
|---|---|---|
| committer | 2023-03-02 09:28:19 +0100 | |
| commit | d53d9af2bea8c023319a56d6e3d60d38826f8708 (patch) | |
| tree | 9a85beb940170c1f0314a84930638c6e569b1abb | |
| parent | Simplified is_msg_public(). (diff) | |
| download | snac2-d53d9af2bea8c023319a56d6e3d60d38826f8708.tar.gz snac2-d53d9af2bea8c023319a56d6e3d60d38826f8708.tar.xz snac2-d53d9af2bea8c023319a56d6e3d60d38826f8708.zip | |
Enqueue messages to the collected inboxes first.
| -rw-r--r-- | activitypub.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/activitypub.c b/activitypub.c index 79c20d7..1b89e3c 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -282,7 +282,6 @@ d_char *recipient_list(snac *snac, char *msg, int expand_public) | |||
| 282 | int is_msg_public(snac *snac, xs_dict *msg) | 282 | int is_msg_public(snac *snac, xs_dict *msg) |
| 283 | /* checks if a message is public */ | 283 | /* checks if a message is public */ |
| 284 | { | 284 | { |
| 285 | int ret = 0; | ||
| 286 | xs *rcpts = recipient_list(snac, msg, 0); | 285 | xs *rcpts = recipient_list(snac, msg, 0); |
| 287 | 286 | ||
| 288 | return xs_list_in(rcpts, public_address) != -1; | 287 | return xs_list_in(rcpts, public_address) != -1; |
| @@ -1102,12 +1101,22 @@ void process_user_queue_item(snac *snac, xs_dict *q_item) | |||
| 1102 | if (strcmp(type, "message") == 0) { | 1101 | if (strcmp(type, "message") == 0) { |
| 1103 | xs_dict *msg = xs_dict_get(q_item, "message"); | 1102 | xs_dict *msg = xs_dict_get(q_item, "message"); |
| 1104 | xs *rcpts = recipient_list(snac, msg, 1); | 1103 | xs *rcpts = recipient_list(snac, msg, 1); |
| 1104 | xs *shibx = inbox_list(); | ||
| 1105 | xs_set inboxes; | 1105 | xs_set inboxes; |
| 1106 | xs_list *p; | 1106 | xs_list *p; |
| 1107 | xs_str *v; | ||
| 1107 | xs_str *actor; | 1108 | xs_str *actor; |
| 1108 | 1109 | ||
| 1109 | xs_set_init(&inboxes); | 1110 | xs_set_init(&inboxes); |
| 1110 | 1111 | ||
| 1112 | /* send first to the collected inboxes */ | ||
| 1113 | p = shibx; | ||
| 1114 | while (xs_list_iter(&p, &v)) { | ||
| 1115 | if (xs_set_add(&inboxes, v) == 1) | ||
| 1116 | enqueue_output(snac, msg, v, 0); | ||
| 1117 | } | ||
| 1118 | |||
| 1119 | /* iterate now the recipients */ | ||
| 1111 | p = rcpts; | 1120 | p = rcpts; |
| 1112 | while (xs_list_iter(&p, &actor)) { | 1121 | while (xs_list_iter(&p, &actor)) { |
| 1113 | xs *inbox = get_actor_inbox(snac, actor); | 1122 | xs *inbox = get_actor_inbox(snac, actor); |