mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-09 19:50:26 +03:00
Unrolled the recipient-to-inbox process in process_user_queue_item().
Instead of calling inbox_list(), waiting for it to end and then sending to all the "uniqueized" inboxes, the sending is done everytime a unique inbox is found.
This commit is contained in:
parent
9d02e70a2f
commit
3a97721c30
@ -1113,14 +1113,27 @@ void process_user_queue_item(snac *snac, xs_dict *q_item)
|
|||||||
|
|
||||||
if (strcmp(type, "message") == 0) {
|
if (strcmp(type, "message") == 0) {
|
||||||
xs_dict *msg = xs_dict_get(q_item, "message");
|
xs_dict *msg = xs_dict_get(q_item, "message");
|
||||||
xs *inboxes = inbox_list(snac, msg);
|
xs *rcpts = recipient_list(snac, msg, 1);
|
||||||
|
xs_set inboxes;
|
||||||
xs_list *p;
|
xs_list *p;
|
||||||
xs_str *inbox;
|
xs_str *actor;
|
||||||
|
|
||||||
p = inboxes;
|
xs_set_init(&inboxes);
|
||||||
while (xs_list_iter(&p, &inbox)) {
|
|
||||||
enqueue_output(snac, msg, inbox, 0);
|
p = rcpts;
|
||||||
|
while (xs_list_iter(&p, &actor)) {
|
||||||
|
xs *inbox = get_actor_inbox(snac, actor);
|
||||||
|
|
||||||
|
if (inbox != NULL) {
|
||||||
|
/* add to the set and, if it's not there, send message */
|
||||||
|
if (xs_set_add(&inboxes, inbox) == 1)
|
||||||
|
enqueue_output(snac, msg, inbox, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
snac_log(snac, xs_fmt("cannot find inbox for %s", actor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xs_set_free(&inboxes);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (strcmp(type, "input") == 0) {
|
if (strcmp(type, "input") == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user