summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar grunfink2025-05-30 11:30:37 +0200
committerGravatar grunfink2025-05-30 11:30:37 +0200
commitc8f6e1865dca9477d0cdfb95168bdca4a62852c3 (patch)
treebfa1e1e3b2aefd5608769ce81eebc6a8c90a7a4c
parentCall enqueue_actor_fresh() from rss_to_timeline(). (diff)
downloadsnac2-c8f6e1865dca9477d0cdfb95168bdca4a62852c3.tar.gz
snac2-c8f6e1865dca9477d0cdfb95168bdca4a62852c3.tar.xz
snac2-c8f6e1865dca9477d0cdfb95168bdca4a62852c3.zip
New function enqueue_notify_webhook().
-rw-r--r--data.c19
-rw-r--r--snac.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/data.c b/data.c
index 224976b..ddfb443 100644
--- a/data.c
+++ b/data.c
@@ -3166,6 +3166,8 @@ void notify_add(snac *snac, const char *type, const char *utype,
3166 3166
3167 pthread_mutex_unlock(&data_mutex); 3167 pthread_mutex_unlock(&data_mutex);
3168 } 3168 }
3169
3170 enqueue_notify_webhook(snac, noti, 0);
3169} 3171}
3170 3172
3171 3173
@@ -3521,6 +3523,23 @@ void enqueue_webmention(const xs_dict *msg)
3521} 3523}
3522 3524
3523 3525
3526void enqueue_notify_webhook(snac *user, const xs_dict *noti, int retries)
3527/* enqueues a notification webhook */
3528{
3529 const char *webhook = xs_dict_get(user->config, "notify_webhook");
3530
3531 if (xs_is_string(webhook)) {
3532 xs *qmsg = _new_qmsg("notify_webhook", noti, retries);
3533 const char *ntid = xs_dict_get(qmsg, "ntid");
3534 xs *fn = xs_fmt("%s/queue/%s.json", user->basedir, ntid);
3535
3536 qmsg = _enqueue_put(fn, qmsg);
3537
3538 snac_debug(user, 1, xs_fmt("notify_webhook"));
3539 }
3540}
3541
3542
3524int was_question_voted(snac *user, const char *id) 3543int was_question_voted(snac *user, const char *id)
3525/* returns true if the user voted in this poll */ 3544/* returns true if the user voted in this poll */
3526{ 3545{
diff --git a/snac.h b/snac.h
index 06a36f1..b13a44a 100644
--- a/snac.h
+++ b/snac.h
@@ -294,6 +294,8 @@ void enqueue_object_request(snac *user, const char *id, int forward_secs);
294void enqueue_verify_links(snac *user); 294void enqueue_verify_links(snac *user);
295void enqueue_actor_refresh(snac *user, const char *actor, int forward_secs); 295void enqueue_actor_refresh(snac *user, const char *actor, int forward_secs);
296void enqueue_webmention(const xs_dict *msg); 296void enqueue_webmention(const xs_dict *msg);
297void enqueue_notify_webhook(snac *user, const xs_dict *noti, int retries);
298
297int was_question_voted(snac *user, const char *id); 299int was_question_voted(snac *user, const char *id);
298 300
299xs_list *user_queue(snac *snac); 301xs_list *user_queue(snac *snac);