commit 7131a5c
default
·
2024-12-30 21:11:23 +0000 UTC
parent 25e1f7f
Always enqueue a message into the local shared-inbox.
1 files changed,
+12,
-10
+12,
-10
1@@ -706,11 +706,11 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
2 }
3 }
4
5- /* is this a tag we're following? */
6- const xs_list *tags_in_msg = xs_dict_get(msg, "tag");
7- if (xs_type(tags_in_msg) == XSTYPE_LIST) {
8- const xs_list *fw_tags = xs_dict_get(snac->config, "followed_hashtags");
9- if (xs_type(fw_tags) == XSTYPE_LIST) {
10+ /* does this message contain a tag we are following? */
11+ const xs_list *fw_tags = xs_dict_get(snac->config, "followed_hashtags");
12+ if (xs_type(fw_tags) == XSTYPE_LIST) {
13+ const xs_list *tags_in_msg = xs_dict_get(msg, "tag");
14+ if (xs_type(tags_in_msg) == XSTYPE_LIST) {
15 const xs_dict *te;
16
17 /* iterate the tags in the message */
18@@ -2413,13 +2413,16 @@ void process_user_queue_item(snac *snac, xs_dict *q_item)
19 xs *rcpts = recipient_list(snac, msg, 1);
20 xs_set inboxes;
21 const xs_str *actor;
22- int c;
23
24 xs_set_init(&inboxes);
25
26+ /* add this shared inbox first */
27+ xs *this_shared_inbox = xs_fmt("%s/shared-inbox", srv_baseurl);
28+ xs_set_add(&inboxes, this_shared_inbox);
29+ enqueue_output(snac, msg, this_shared_inbox, 0, 0);
30+
31 /* iterate the recipients */
32- c = 0;
33- while (xs_list_next(rcpts, &actor, &c)) {
34+ xs_list_foreach(rcpts, actor) {
35 xs *inbox = get_actor_inbox(actor, 1);
36
37 if (inbox != NULL) {
38@@ -2437,8 +2440,7 @@ void process_user_queue_item(snac *snac, xs_dict *q_item)
39 xs *shibx = inbox_list();
40 const xs_str *inbox;
41
42- c = 0;
43- while (xs_list_next(shibx, &inbox, &c)) {
44+ xs_list_foreach(shibx, inbox) {
45 if (xs_set_add(&inboxes, inbox) == 1)
46 enqueue_output(snac, msg, inbox, 0, 0);
47 }