diff options
| author | 2023-12-10 09:08:30 +0100 | |
|---|---|---|
| committer | 2023-12-10 09:08:30 +0100 | |
| commit | d7fe3ba6151c57a31f748434399a2544b1919c40 (patch) | |
| tree | a88aa04f03d97a0d445b199dad1eb27e98ce63c7 /activitypub.c | |
| parent | Usage of shared inboxes is now configurable from the server.json file. (diff) | |
| download | snac2-d7fe3ba6151c57a31f748434399a2544b1919c40.tar.gz snac2-d7fe3ba6151c57a31f748434399a2544b1919c40.tar.xz snac2-d7fe3ba6151c57a31f748434399a2544b1919c40.zip | |
Call is_msg_for_me() from global queue input messages.
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/activitypub.c b/activitypub.c index 1b83bd8..62b4faf 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -2035,8 +2035,9 @@ void process_queue_item(xs_dict *q_item) | |||
| 2035 | else | 2035 | else |
| 2036 | if (strcmp(type, "input") == 0) { | 2036 | if (strcmp(type, "input") == 0) { |
| 2037 | /* redistribute the input message to all users */ | 2037 | /* redistribute the input message to all users */ |
| 2038 | char *ntid = xs_dict_get(q_item, "ntid"); | 2038 | char *ntid = xs_dict_get(q_item, "ntid"); |
| 2039 | xs *tmpfn = xs_fmt("%s/tmp/%s.json", srv_basedir, ntid); | 2039 | xs *tmpfn = xs_fmt("%s/tmp/%s.json", srv_basedir, ntid); |
| 2040 | xs_dict *msg = xs_dict_get(q_item, "message"); | ||
| 2040 | FILE *f; | 2041 | FILE *f; |
| 2041 | 2042 | ||
| 2042 | if ((f = fopen(tmpfn, "w")) != NULL) { | 2043 | if ((f = fopen(tmpfn, "w")) != NULL) { |
| @@ -2052,12 +2053,14 @@ void process_queue_item(xs_dict *q_item) | |||
| 2052 | snac user; | 2053 | snac user; |
| 2053 | 2054 | ||
| 2054 | if (user_open(&user, v)) { | 2055 | if (user_open(&user, v)) { |
| 2055 | xs *fn = xs_fmt("%s/queue/%s.json", user.basedir, ntid); | 2056 | if (is_msg_for_me(&user, msg)) { |
| 2057 | xs *fn = xs_fmt("%s/queue/%s.json", user.basedir, ntid); | ||
| 2056 | 2058 | ||
| 2057 | snac_debug(&user, 1, xs_fmt("enqueue_input (from shared inbox) %s", fn)); | 2059 | snac_debug(&user, 1, xs_fmt("enqueue_input (from shared inbox) %s", fn)); |
| 2058 | 2060 | ||
| 2059 | if (link(tmpfn, fn) < 0) | 2061 | if (link(tmpfn, fn) < 0) |
| 2060 | srv_log(xs_fmt("link(%s, %s) error", tmpfn, fn)); | 2062 | srv_log(xs_fmt("link(%s, %s) error", tmpfn, fn)); |
| 2063 | } | ||
| 2061 | 2064 | ||
| 2062 | user_free(&user); | 2065 | user_free(&user); |
| 2063 | } | 2066 | } |