diff options
| author | 2025-05-30 11:30:37 +0200 | |
|---|---|---|
| committer | 2025-05-30 11:30:37 +0200 | |
| commit | c8f6e1865dca9477d0cdfb95168bdca4a62852c3 (patch) | |
| tree | bfa1e1e3b2aefd5608769ce81eebc6a8c90a7a4c | |
| parent | Call enqueue_actor_fresh() from rss_to_timeline(). (diff) | |
| download | penes-snac2-c8f6e1865dca9477d0cdfb95168bdca4a62852c3.tar.gz penes-snac2-c8f6e1865dca9477d0cdfb95168bdca4a62852c3.tar.xz penes-snac2-c8f6e1865dca9477d0cdfb95168bdca4a62852c3.zip | |
New function enqueue_notify_webhook().
| -rw-r--r-- | data.c | 19 | ||||
| -rw-r--r-- | snac.h | 2 |
2 files changed, 21 insertions, 0 deletions
| @@ -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 | ||
| 3526 | void 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 | |||
| 3524 | int was_question_voted(snac *user, const char *id) | 3543 | int 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 | { |
| @@ -294,6 +294,8 @@ void enqueue_object_request(snac *user, const char *id, int forward_secs); | |||
| 294 | void enqueue_verify_links(snac *user); | 294 | void enqueue_verify_links(snac *user); |
| 295 | void enqueue_actor_refresh(snac *user, const char *actor, int forward_secs); | 295 | void enqueue_actor_refresh(snac *user, const char *actor, int forward_secs); |
| 296 | void enqueue_webmention(const xs_dict *msg); | 296 | void enqueue_webmention(const xs_dict *msg); |
| 297 | void enqueue_notify_webhook(snac *user, const xs_dict *noti, int retries); | ||
| 298 | |||
| 297 | int was_question_voted(snac *user, const char *id); | 299 | int was_question_voted(snac *user, const char *id); |
| 298 | 300 | ||
| 299 | xs_list *user_queue(snac *snac); | 301 | xs_list *user_queue(snac *snac); |