summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-02-07 07:37:23 +0100
committerdefault <nobody@localhost>2023-02-07 07:37:23 +0100
commit2db57c9df96f4bf7c9dd996f19c104da3cae6263 (patch)
treeccdaf03c90686442cf32a44a60b4b10394b9d918 /data.c
parentf6d51357afcb047a0804600a19694944f64e82bc (diff)
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)
}
+void enqueue_telegram(const xs_str *msg, const char *bot, const char *chat_id)
+/* enqueues a message to be sent via Telegram */
+{
+ xs *qmsg = _new_qmsg("telegram", 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, "bot", bot);
+ qmsg = xs_dict_append(qmsg, "chat_id", chat_id);
+
+ qmsg = _enqueue_put(fn, qmsg);
+
+ srv_debug(1, xs_fmt("enqueue_email %s %s", bot, chat_id));
+}
+
+
void enqueue_message(snac *snac, xs_dict *msg)
/* enqueues an output message */
{