diff options
| -rw-r--r-- | activitypub.c | 23 |
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) | |||
| 1113 | 1113 | ||
| 1114 | if (strcmp(type, "message") == 0) { | 1114 | if (strcmp(type, "message") == 0) { |
| 1115 | xs_dict *msg = xs_dict_get(q_item, "message"); | 1115 | xs_dict *msg = xs_dict_get(q_item, "message"); |
| 1116 | xs *inboxes = inbox_list(snac, msg); | 1116 | xs *rcpts = recipient_list(snac, msg, 1); |
| 1117 | xs_set inboxes; | ||
| 1117 | xs_list *p; | 1118 | xs_list *p; |
| 1118 | xs_str *inbox; | 1119 | xs_str *actor; |
| 1119 | 1120 | ||
| 1120 | p = inboxes; | 1121 | xs_set_init(&inboxes); |
| 1121 | while (xs_list_iter(&p, &inbox)) { | 1122 | |
| 1122 | enqueue_output(snac, msg, inbox, 0); | 1123 | p = rcpts; |
| 1124 | while (xs_list_iter(&p, &actor)) { | ||
| 1125 | xs *inbox = get_actor_inbox(snac, actor); | ||
| 1126 | |||
| 1127 | if (inbox != NULL) { | ||
| 1128 | /* add to the set and, if it's not there, send message */ | ||
| 1129 | if (xs_set_add(&inboxes, inbox) == 1) | ||
| 1130 | enqueue_output(snac, msg, inbox, 0); | ||
| 1131 | } | ||
| 1132 | else | ||
| 1133 | snac_log(snac, xs_fmt("cannot find inbox for %s", actor)); | ||
| 1123 | } | 1134 | } |
| 1135 | |||
| 1136 | xs_set_free(&inboxes); | ||
| 1124 | } | 1137 | } |
| 1125 | else | 1138 | else |
| 1126 | if (strcmp(type, "input") == 0) { | 1139 | if (strcmp(type, "input") == 0) { |