snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 605b60c06ea882cd61df7f2d834c02cce6dd254d
parent 7f38c744dc6ead2ccac83ae979c99ef521aad23a
Author: grunfink <grunfink@comam.es>
Date:   Sat,  3 May 2025 19:16:21 +0200

New function enqueue_webmention().

The q_msg is queued, but nothing is done yet.

Diffstat:
Mdata.c | 13+++++++++++++
Mhtml.c | 4+++-
Mmain.c | 1+
Msnac.h | 1+
4 files changed, 18 insertions(+), 1 deletion(-)

diff --git 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 @@ -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 @@ -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 @@ -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);