commit c8f6e18
grunfink
·
2025-05-30 09:30:37 +0000 UTC
parent cd51d53
New function enqueue_notify_webhook().
M
data.c
+19,
-0
1@@ -3166,6 +3166,8 @@ void notify_add(snac *snac, const char *type, const char *utype,
2
3 pthread_mutex_unlock(&data_mutex);
4 }
5+
6+ enqueue_notify_webhook(snac, noti, 0);
7 }
8
9
10@@ -3521,6 +3523,23 @@ void enqueue_webmention(const xs_dict *msg)
11 }
12
13
14+void enqueue_notify_webhook(snac *user, const xs_dict *noti, int retries)
15+/* enqueues a notification webhook */
16+{
17+ const char *webhook = xs_dict_get(user->config, "notify_webhook");
18+
19+ if (xs_is_string(webhook)) {
20+ xs *qmsg = _new_qmsg("notify_webhook", noti, retries);
21+ const char *ntid = xs_dict_get(qmsg, "ntid");
22+ xs *fn = xs_fmt("%s/queue/%s.json", user->basedir, ntid);
23+
24+ qmsg = _enqueue_put(fn, qmsg);
25+
26+ snac_debug(user, 1, xs_fmt("notify_webhook"));
27+ }
28+}
29+
30+
31 int was_question_voted(snac *user, const char *id)
32 /* returns true if the user voted in this poll */
33 {
M
snac.h
+2,
-0
1@@ -294,6 +294,8 @@ void enqueue_object_request(snac *user, const char *id, int forward_secs);
2 void enqueue_verify_links(snac *user);
3 void enqueue_actor_refresh(snac *user, const char *actor, int forward_secs);
4 void enqueue_webmention(const xs_dict *msg);
5+void enqueue_notify_webhook(snac *user, const xs_dict *noti, int retries);
6+
7 int was_question_voted(snac *user, const char *id);
8
9 xs_list *user_queue(snac *snac);