Call is_msg_for_me() from global queue input messages.

This commit is contained in:
default 2023-12-10 09:08:30 +01:00
parent 8f172f5e0e
commit d7fe3ba615

View File

@ -2037,6 +2037,7 @@ void process_queue_item(xs_dict *q_item)
/* redistribute the input message to all users */ /* redistribute the input message to all users */
char *ntid = xs_dict_get(q_item, "ntid"); char *ntid = xs_dict_get(q_item, "ntid");
xs *tmpfn = xs_fmt("%s/tmp/%s.json", srv_basedir, ntid); xs *tmpfn = xs_fmt("%s/tmp/%s.json", srv_basedir, ntid);
xs_dict *msg = xs_dict_get(q_item, "message");
FILE *f; FILE *f;
if ((f = fopen(tmpfn, "w")) != NULL) { if ((f = fopen(tmpfn, "w")) != NULL) {
@ -2052,12 +2053,14 @@ void process_queue_item(xs_dict *q_item)
snac user; snac user;
if (user_open(&user, v)) { if (user_open(&user, v)) {
if (is_msg_for_me(&user, msg)) {
xs *fn = xs_fmt("%s/queue/%s.json", user.basedir, ntid); xs *fn = xs_fmt("%s/queue/%s.json", user.basedir, ntid);
snac_debug(&user, 1, xs_fmt("enqueue_input (from shared inbox) %s", fn)); snac_debug(&user, 1, xs_fmt("enqueue_input (from shared inbox) %s", fn));
if (link(tmpfn, fn) < 0) if (link(tmpfn, fn) < 0)
srv_log(xs_fmt("link(%s, %s) error", tmpfn, fn)); srv_log(xs_fmt("link(%s, %s) error", tmpfn, fn));
}
user_free(&user); user_free(&user);
} }