commit f8196b4ef6369b5cbaf746cbaf6101eba1fb783b
parent ad718e5b801edd19fd76fb7d2921533c21ffab38
Author: default <nobody@localhost>
Date: Sun, 17 Dec 2023 15:21:16 +0100
New function srv_archive_qitem().
Diffstat:
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git 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
@@ -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
@@ -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)