From 605b60c06ea882cd61df7f2d834c02cce6dd254d Mon Sep 17 00:00:00 2001 From: grunfink Date: Sat, 3 May 2025 19:16:21 +0200 Subject: New function enqueue_webmention(). The q_msg is queued, but nothing is done yet. --- data.c | 13 +++++++++++++ html.c | 4 +++- main.c | 1 + snac.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/data.c b/data.c index 7d33f77..73332ef 100644 --- a/data.c +++ b/data.c @@ -3473,6 +3473,19 @@ void enqueue_actor_refresh(snac *user, const char *actor, int forward_secs) } +void enqueue_webmention(const xs_dict *msg) +/* enqueues a webmention for the post */ +{ + xs *qmsg = _new_qmsg("webmention", msg, 0); + const char *ntid = xs_dict_get(qmsg, "ntid"); + xs *fn = xs_fmt("%s/queue/%s.json", srv_basedir, ntid); + + qmsg = _enqueue_put(fn, qmsg); + + srv_debug(1, xs_fmt("enqueue_webmention")); +} + + int was_question_voted(snac *user, const char *id) /* returns true if the user voted in this poll */ { diff --git a/html.c b/html.c index 0652892..e114ea7 100644 --- a/html.c +++ b/html.c @@ -4488,8 +4488,10 @@ int html_post_handler(const xs_dict *req, const char *q_path, snac_log(&snac, xs_fmt("cannot get object '%s' for editing", edit_id)); } - if (c_msg != NULL) + if (c_msg != NULL) { enqueue_message(&snac, c_msg); + enqueue_webmention(msg); + } history_del(&snac, "timeline.html_"); } diff --git a/main.c b/main.c index a6fb6fd..80df2d0 100644 --- a/main.c +++ b/main.c @@ -830,6 +830,7 @@ int main(int argc, char *argv[]) } enqueue_message(&snac, c_msg); + enqueue_webmention(msg); timeline_add(&snac, xs_dict_get(msg, "id"), msg); diff --git a/snac.h b/snac.h index 06f9568..d9d0cfd 100644 --- a/snac.h +++ b/snac.h @@ -289,6 +289,7 @@ void enqueue_close_question(snac *user, const char *id, int end_secs); void enqueue_object_request(snac *user, const char *id, int forward_secs); void enqueue_verify_links(snac *user); void enqueue_actor_refresh(snac *user, const char *actor, int forward_secs); +void enqueue_webmention(const xs_dict *msg); int was_question_voted(snac *user, const char *id); xs_list *user_queue(snac *snac); -- cgit v1.2.3