diff options
| author | 2023-02-07 07:37:23 +0100 | |
|---|---|---|
| committer | 2023-02-07 07:37:23 +0100 | |
| commit | 2db57c9df96f4bf7c9dd996f19c104da3cae6263 (patch) | |
| tree | ccdaf03c90686442cf32a44a60b4b10394b9d918 /data.c | |
| parent | process_queue() now posts the q_item to the thread pool. (diff) | |
| download | snac2-2db57c9df96f4bf7c9dd996f19c104da3cae6263.tar.gz snac2-2db57c9df96f4bf7c9dd996f19c104da3cae6263.tar.xz snac2-2db57c9df96f4bf7c9dd996f19c104da3cae6263.zip | |
Added internals for Telegram notifications.
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 16 |
1 files changed, 16 insertions, 0 deletions
| @@ -1420,6 +1420,22 @@ void enqueue_email(xs_str *msg, int retries) | |||
| 1420 | } | 1420 | } |
| 1421 | 1421 | ||
| 1422 | 1422 | ||
| 1423 | void enqueue_telegram(const xs_str *msg, const char *bot, const char *chat_id) | ||
| 1424 | /* enqueues a message to be sent via Telegram */ | ||
| 1425 | { | ||
| 1426 | xs *qmsg = _new_qmsg("telegram", msg, 0); | ||
| 1427 | char *ntid = xs_dict_get(qmsg, "ntid"); | ||
| 1428 | xs *fn = xs_fmt("%s/queue/%s.json", srv_basedir, ntid); | ||
| 1429 | |||
| 1430 | qmsg = xs_dict_append(qmsg, "bot", bot); | ||
| 1431 | qmsg = xs_dict_append(qmsg, "chat_id", chat_id); | ||
| 1432 | |||
| 1433 | qmsg = _enqueue_put(fn, qmsg); | ||
| 1434 | |||
| 1435 | srv_debug(1, xs_fmt("enqueue_email %s %s", bot, chat_id)); | ||
| 1436 | } | ||
| 1437 | |||
| 1438 | |||
| 1423 | void enqueue_message(snac *snac, xs_dict *msg) | 1439 | void enqueue_message(snac *snac, xs_dict *msg) |
| 1424 | /* enqueues an output message */ | 1440 | /* enqueues an output message */ |
| 1425 | { | 1441 | { |