From f8196b4ef6369b5cbaf746cbaf6101eba1fb783b Mon Sep 17 00:00:00 2001 From: default Date: Sun, 17 Dec 2023 15:21:16 +0100 Subject: [PATCH] New function srv_archive_qitem(). --- activitypub.c | 4 +++- data.c | 14 ++++++++++++++ snac.h | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/activitypub.c b/activitypub.c index 130c283..fa06a89 100644 --- a/activitypub.c +++ b/activitypub.c @@ -2135,8 +2135,10 @@ void process_queue_item(xs_dict *q_item) unlink(tmpfn); - if (cnt == 0) + if (cnt == 0) { + srv_archive_qitem(q_item); srv_debug(1, xs_fmt("no valid recipients for %s", tmpfn)); + } } } else diff --git a/data.c b/data.c index 2dfee50..36de138 100644 --- a/data.c +++ b/data.c @@ -2752,3 +2752,17 @@ void srv_archive_error(const char *prefix, const xs_str *err, fclose(f); } } + + +void srv_archive_qitem(xs_dict *q_item) +/* archives a q_item in the error folder */ +{ + xs *ntid = tid(0); + xs *fn = xs_fmt("%s/error/%s_qitem", srv_basedir, ntid); + FILE *f; + + if ((f = fopen(fn, "w")) != NULL) { + xs_json_dump(q_item, 4, f); + fclose(f); + } +} diff --git a/snac.h b/snac.h index 020aaa5..c192cd9 100644 --- a/snac.h +++ b/snac.h @@ -64,6 +64,7 @@ void srv_archive(const char *direction, const char *url, xs_dict *req, const char *body, int b_size); void srv_archive_error(const char *prefix, const xs_str *err, const xs_dict *req, const xs_val *data); +void srv_archive_qitem(xs_dict *q_item); double mtime_nl(const char *fn, int *n_link); #define mtime(fn) mtime_nl(fn, NULL)