summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
Diffstat (limited to 'data.c')
-rw-r--r--data.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/data.c b/data.c
index 3827422..ac429fa 100644
--- a/data.c
+++ b/data.c
@@ -1373,25 +1373,35 @@ void enqueue_input(snac *snac, xs_dict *msg, xs_dict *req, int retries)
}
-void enqueue_output(snac *snac, xs_dict *msg, xs_str *inbox, int retries)
+void enqueue_output_raw(const char *keyid, const char *seckey,
+ xs_dict *msg, xs_str *inbox, int retries)
/* enqueues an output message to an inbox */
{
- if (xs_startswith(inbox, snac->actor)) {
- snac_debug(snac, 1, xs_str_new("refusing enqueue to myself"));
- return;
- }
-
xs *qmsg = _new_qmsg("output", msg, retries);
char *ntid = xs_dict_get(qmsg, "ntid");
- xs *fn = xs_fmt("%s/queue/%s.json", snac->basedir, ntid);
+ xs *fn = xs_fmt("%s/queue/%s.json", srv_basedir, ntid);
qmsg = xs_dict_append(qmsg, "inbox", inbox);
- qmsg = xs_dict_append(qmsg, "keyid", snac->actor);
- qmsg = xs_dict_append(qmsg, "seckey", xs_dict_get(snac->key, "secret"));
+ qmsg = xs_dict_append(qmsg, "keyid", keyid);
+ qmsg = xs_dict_append(qmsg, "seckey", seckey);
qmsg = _enqueue_put(fn, qmsg);
- snac_debug(snac, 1, xs_fmt("enqueue_output %s %s %d", inbox, fn, retries));
+ srv_debug(1, xs_fmt("enqueue_output %s %s %d", inbox, fn, retries));
+}
+
+
+void enqueue_output(snac *snac, xs_dict *msg, xs_str *inbox, int retries)
+/* enqueues an output message to an inbox */
+{
+ if (xs_startswith(inbox, snac->actor)) {
+ snac_debug(snac, 1, xs_str_new("refusing enqueue to myself"));
+ return;
+ }
+
+ char *seckey = xs_dict_get(snac->key, "secret");
+
+ enqueue_output_raw(snac->actor, seckey, msg, inbox, retries);
}