commit f055c8b

grunfink  ·  2025-05-30 17:34:11 +0000 UTC
parent e41e597
Added a new server knob disable_notify_webhook.
2 files changed,  +4, -3
M data.c
+1, -1
1@@ -2769,7 +2769,7 @@ void process_user_queue_item(snac *user, xs_dict *q_item)
2     if (strcmp(type, "notify_webhook") == 0) {
3         const char *webhook = xs_dict_get(user->config, "notify_webhook");
4 
5-        if (xs_is_string(webhook)) {
6+        if (xs_is_string(webhook) && *webhook) {
7             const xs_dict *msg = xs_dict_get(q_item, "message");
8             int retries = xs_number_get(xs_dict_get(q_item, "retries"));
9 
M data.c
+3, -2
 1@@ -3167,7 +3167,8 @@ void notify_add(snac *snac, const char *type, const char *utype,
 2         pthread_mutex_unlock(&data_mutex);
 3     }
 4 
 5-    enqueue_notify_webhook(snac, noti, 0);
 6+    if (!xs_is_true(xs_dict_get(srv_config, "disable_notify_webhook")))
 7+        enqueue_notify_webhook(snac, noti, 0);
 8 }
 9 
10 
11@@ -3528,7 +3529,7 @@ void enqueue_notify_webhook(snac *user, const xs_dict *noti, int retries)
12 {
13     const char *webhook = xs_dict_get(user->config, "notify_webhook");
14 
15-    if (xs_is_string(webhook)) {
16+    if (xs_is_string(webhook) && *webhook) {
17         xs *msg = xs_dup(noti);
18 
19         /* add more data */