diff options
| author | 2024-01-12 17:09:58 +0000 | |
|---|---|---|
| committer | 2024-01-12 17:09:58 +0000 | |
| commit | a0cb5c60cdbf7855fa0c2842113797be2a206226 (patch) | |
| tree | 3cff6166192f8bc8f34149a0a18ca103cfb1384e /data.c | |
| parent | In README.md, document how to add -lrt to make (for older distributions). (diff) | |
| parent | ntfy code cleanup (diff) | |
| download | snac2-a0cb5c60cdbf7855fa0c2842113797be2a206226.tar.gz snac2-a0cb5c60cdbf7855fa0c2842113797be2a206226.tar.xz snac2-a0cb5c60cdbf7855fa0c2842113797be2a206226.zip | |
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) | |||
| 2232 | srv_debug(1, xs_fmt("enqueue_telegram %s %s", bot, chat_id)); | 2232 | srv_debug(1, xs_fmt("enqueue_telegram %s %s", bot, chat_id)); |
| 2233 | } | 2233 | } |
| 2234 | 2234 | ||
| 2235 | void enqueue_ntfy(const xs_str *msg, const char *ntfy_server, const char *ntfy_token) | ||
| 2236 | /* enqueues a message to be sent via ntfy */ | ||
| 2237 | { | ||
| 2238 | xs *qmsg = _new_qmsg("ntfy", msg, 0); | ||
| 2239 | char *ntid = xs_dict_get(qmsg, "ntid"); | ||
| 2240 | xs *fn = xs_fmt("%s/queue/%s.json", srv_basedir, ntid); | ||
| 2241 | |||
| 2242 | qmsg = xs_dict_append(qmsg, "ntfy_server", ntfy_server); | ||
| 2243 | qmsg = xs_dict_append(qmsg, "ntfy_token", ntfy_token); | ||
| 2244 | |||
| 2245 | |||
| 2246 | qmsg = _enqueue_put(fn, qmsg); | ||
| 2247 | |||
| 2248 | srv_debug(1, xs_fmt("enqueue_ntfy %s %s", ntfy_server, ntfy_token)); | ||
| 2249 | } | ||
| 2235 | 2250 | ||
| 2236 | void enqueue_message(snac *snac, const xs_dict *msg) | 2251 | void enqueue_message(snac *snac, const xs_dict *msg) |
| 2237 | /* enqueues an output message */ | 2252 | /* enqueues an output message */ |