snac2

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

commit c8f6e1865dca9477d0cdfb95168bdca4a62852c3
parent cd51d5310c8fa08a27018b40e6afdd1eb3d6e12e
Author: grunfink <grunfink@comam.es>
Date:   Fri, 30 May 2025 11:30:37 +0200

New function enqueue_notify_webhook().

Diffstat:
Mdata.c | 19+++++++++++++++++++
Msnac.h | 2++
2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/data.c b/data.c @@ -3166,6 +3166,8 @@ void notify_add(snac *snac, const char *type, const char *utype, pthread_mutex_unlock(&data_mutex); } + + enqueue_notify_webhook(snac, noti, 0); } @@ -3521,6 +3523,23 @@ void enqueue_webmention(const xs_dict *msg) } +void enqueue_notify_webhook(snac *user, const xs_dict *noti, int retries) +/* enqueues a notification webhook */ +{ + const char *webhook = xs_dict_get(user->config, "notify_webhook"); + + if (xs_is_string(webhook)) { + xs *qmsg = _new_qmsg("notify_webhook", noti, retries); + const char *ntid = xs_dict_get(qmsg, "ntid"); + xs *fn = xs_fmt("%s/queue/%s.json", user->basedir, ntid); + + qmsg = _enqueue_put(fn, qmsg); + + snac_debug(user, 1, xs_fmt("notify_webhook")); + } +} + + int was_question_voted(snac *user, const char *id) /* returns true if the user voted in this poll */ { diff --git a/snac.h b/snac.h @@ -294,6 +294,8 @@ 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); +void enqueue_notify_webhook(snac *user, const xs_dict *noti, int retries); + int was_question_voted(snac *user, const char *id); xs_list *user_queue(snac *snac);