diff --git a/data.c b/data.c index 2989b2a..66cef9f 100644 --- a/data.c +++ b/data.c @@ -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"))); }