commit d7fe3ba

default  ·  2023-12-10 08:08:30 +0000 UTC
parent 8f172f5
Call is_msg_for_me() from global queue input messages.
1 files changed,  +9, -6
+9, -6
 1@@ -2035,8 +2035,9 @@ void process_queue_item(xs_dict *q_item)
 2     else
 3     if (strcmp(type, "input") == 0) {
 4         /* redistribute the input message to all users */
 5-        char *ntid = xs_dict_get(q_item, "ntid");
 6-        xs *tmpfn  = xs_fmt("%s/tmp/%s.json", srv_basedir, ntid);
 7+        char *ntid   = xs_dict_get(q_item, "ntid");
 8+        xs *tmpfn    = xs_fmt("%s/tmp/%s.json", srv_basedir, ntid);
 9+        xs_dict *msg = xs_dict_get(q_item, "message");
10         FILE *f;
11 
12         if ((f = fopen(tmpfn, "w")) != NULL) {
13@@ -2052,12 +2053,14 @@ void process_queue_item(xs_dict *q_item)
14             snac user;
15 
16             if (user_open(&user, v)) {
17-                xs *fn = xs_fmt("%s/queue/%s.json", user.basedir, ntid);
18+                if (is_msg_for_me(&user, msg)) {
19+                    xs *fn = xs_fmt("%s/queue/%s.json", user.basedir, ntid);
20 
21-                snac_debug(&user, 1, xs_fmt("enqueue_input (from shared inbox) %s", fn));
22+                    snac_debug(&user, 1, xs_fmt("enqueue_input (from shared inbox) %s", fn));
23 
24-                if (link(tmpfn, fn) < 0)
25-                    srv_log(xs_fmt("link(%s, %s) error", tmpfn, fn));
26+                    if (link(tmpfn, fn) < 0)
27+                        srv_log(xs_fmt("link(%s, %s) error", tmpfn, fn));
28+                }
29 
30                 user_free(&user);
31             }