diff options
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 19 |
1 files changed, 19 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 | { |