summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorGravatar default2023-02-07 07:37:23 +0100
committerGravatar default2023-02-07 07:37:23 +0100
commit2db57c9df96f4bf7c9dd996f19c104da3cae6263 (patch)
treeccdaf03c90686442cf32a44a60b4b10394b9d918 /data.c
parentprocess_queue() now posts the q_item to the thread pool. (diff)
downloadsnac2-2db57c9df96f4bf7c9dd996f19c104da3cae6263.tar.gz
snac2-2db57c9df96f4bf7c9dd996f19c104da3cae6263.tar.xz
snac2-2db57c9df96f4bf7c9dd996f19c104da3cae6263.zip
Added internals for Telegram notifications.
Diffstat (limited to 'data.c')
-rw-r--r--data.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/data.c b/data.c
index fd5d02c..ad5304a 100644
--- a/data.c
+++ b/data.c
@@ -1420,6 +1420,22 @@ void enqueue_email(xs_str *msg, int retries)
1420} 1420}
1421 1421
1422 1422
1423void 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
1423void enqueue_message(snac *snac, xs_dict *msg) 1439void enqueue_message(snac *snac, xs_dict *msg)
1424/* enqueues an output message */ 1440/* enqueues an output message */
1425{ 1441{