summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-02-20 13:19:29 +0100
committerdefault <nobody@localhost>2023-02-20 13:19:29 +0100
commit3a97721c30e1b8d0a8f8d47ef60b64ec6eb06e5e (patch)
tree18e20246279cc88849f96e175f14469a2d6f83fe /activitypub.c
parent9d02e70a2fd05b48abde342ea76e82ad7a30f3f1 (diff)
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.
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/activitypub.c b/activitypub.c
index dd46601..1d191b8 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -1113,14 +1113,27 @@ void process_user_queue_item(snac *snac, xs_dict *q_item)
if (strcmp(type, "message") == 0) {
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_str *inbox;
+ xs_str *actor;
- p = inboxes;
- while (xs_list_iter(&p, &inbox)) {
- enqueue_output(snac, msg, inbox, 0);
+ xs_set_init(&inboxes);
+
+ 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
if (strcmp(type, "input") == 0) {