Reworked enqueue_message().

This commit is contained in:
default 2023-01-31 21:54:50 +01:00
parent 274ae3d142
commit f0ef1d4115

14
data.c
View File

@ -1396,20 +1396,16 @@ void enqueue_email(snac *snac, xs_str *msg, int retries)
}
void enqueue_message(snac *snac, char *msg)
void enqueue_message(snac *snac, xs_dict *msg)
/* enqueues an output message */
{
char *id = xs_dict_get(msg, "id");
xs *ntid = tid(0);
xs *fn = xs_fmt("%s/queue/%s.json", snac->basedir, ntid);
xs *qmsg = xs_dict_new();
qmsg = xs_dict_append(qmsg, "type", "message");
qmsg = xs_dict_append(qmsg, "message", msg);
xs *qmsg = _new_qmsg("message", msg, 0);
char *ntid = xs_dict_get(qmsg, "ntid");
xs *fn = xs_fmt("%s/queue/%s.json", snac->basedir, ntid);
qmsg = _enqueue_put(fn, qmsg);
snac_debug(snac, 0, xs_fmt("enqueue_message %s", id));
snac_debug(snac, 0, xs_fmt("enqueue_message %s", xs_dict_get(msg, "id")));
}