diff options
| author | grunfink <grunfink@noreply.codeberg.org> | 2024-01-12 17:09:58 +0000 |
|---|---|---|
| committer | grunfink <grunfink@noreply.codeberg.org> | 2024-01-12 17:09:58 +0000 |
| commit | a0cb5c60cdbf7855fa0c2842113797be2a206226 (patch) | |
| tree | 3cff6166192f8bc8f34149a0a18ca103cfb1384e /data.c | |
| parent | d8e7fe69eda030b960bda8eecfdcc126a09ce14f (diff) | |
| parent | 82d57557bb9a16f18ed5acc874d283ef0e9f47f5 (diff) | |
Merge pull request 'Added support for ntfy notifications with enhanced privacy when utilizing a self-hosted server, eliminating the need for external services.' (#102) from draga79/snac2:master into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/102
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -2232,6 +2232,21 @@ void enqueue_telegram(const xs_str *msg, const char *bot, const char *chat_id) srv_debug(1, xs_fmt("enqueue_telegram %s %s", bot, chat_id)); } +void enqueue_ntfy(const xs_str *msg, const char *ntfy_server, const char *ntfy_token) +/* enqueues a message to be sent via ntfy */ +{ + xs *qmsg = _new_qmsg("ntfy", msg, 0); + char *ntid = xs_dict_get(qmsg, "ntid"); + xs *fn = xs_fmt("%s/queue/%s.json", srv_basedir, ntid); + + qmsg = xs_dict_append(qmsg, "ntfy_server", ntfy_server); + qmsg = xs_dict_append(qmsg, "ntfy_token", ntfy_token); + + + qmsg = _enqueue_put(fn, qmsg); + + srv_debug(1, xs_fmt("enqueue_ntfy %s %s", ntfy_server, ntfy_token)); +} void enqueue_message(snac *snac, const xs_dict *msg) /* enqueues an output message */ |