summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorGravatar default2022-09-24 10:03:27 +0200
committerGravatar default2022-09-24 10:03:27 +0200
commita6712ba79a617e4481117fe486858d62977f0260 (patch)
treed975efbf9ddacd7a7aa6cf77514b0048a74ab764 /data.c
parentMore ActivityPub work. (diff)
downloadsnac2-a6712ba79a617e4481117fe486858d62977f0260.tar.gz
snac2-a6712ba79a617e4481117fe486858d62977f0260.tar.xz
snac2-a6712ba79a617e4481117fe486858d62977f0260.zip
Also store the req object in enqueue_input().
Diffstat (limited to 'data.c')
-rw-r--r--data.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/data.c b/data.c
index 67b1802..c3576cc 100644
--- a/data.c
+++ b/data.c
@@ -709,12 +709,12 @@ int actor_get(snac *snac, char *actor, d_char **data)
709} 709}
710 710
711 711
712void enqueue_input(snac *snac, char *msg) 712void enqueue_input(snac *snac, char *msg, char *req)
713/* enqueues an input message */ 713/* enqueues an input message */
714{ 714{
715 xs *ntid = tid(0); 715 xs *ntid = tid(0);
716 xs *fn = xs_fmt("%s/queue/%s.json", snac->basedir, ntid); 716 xs *fn = xs_fmt("%s/queue/%s.json", snac->basedir, ntid);
717 xs *tfn = xs_str_cat(fn, ".tmp"); 717 xs *tfn = xs_fmt("%s.tmp", fn);
718 FILE *f; 718 FILE *f;
719 719
720 if ((f = fopen(tfn, "w")) != NULL) { 720 if ((f = fopen(tfn, "w")) != NULL) {
@@ -723,6 +723,7 @@ void enqueue_input(snac *snac, char *msg)
723 723
724 qmsg = xs_dict_append(qmsg, "type", "input"); 724 qmsg = xs_dict_append(qmsg, "type", "input");
725 qmsg = xs_dict_append(qmsg, "object", msg); 725 qmsg = xs_dict_append(qmsg, "object", msg);
726 qmsg = xs_dict_append(qmsg, "req", req);
726 727
727 j = xs_json_dumps_pp(qmsg, 4); 728 j = xs_json_dumps_pp(qmsg, 4);
728 729
@@ -736,7 +737,7 @@ void enqueue_input(snac *snac, char *msg)
736} 737}
737 738
738 739
739void enqueue_output(snac *snac, char *actor, char *msg, int retries) 740void enqueue_output(snac *snac, char *msg, char *actor, int retries)
740/* enqueues an output message for an actor */ 741/* enqueues an output message for an actor */
741{ 742{
742 if (strcmp(actor, snac->actor) == 0) { 743 if (strcmp(actor, snac->actor) == 0) {
@@ -747,7 +748,7 @@ void enqueue_output(snac *snac, char *actor, char *msg, int retries)
747 int qrt = xs_number_get(xs_dict_get(srv_config, "query_retry_minutes")); 748 int qrt = xs_number_get(xs_dict_get(srv_config, "query_retry_minutes"));
748 xs *ntid = tid(retries * 60 * qrt); 749 xs *ntid = tid(retries * 60 * qrt);
749 xs *fn = xs_fmt("%s/queue/%s.json", snac->basedir, ntid); 750 xs *fn = xs_fmt("%s/queue/%s.json", snac->basedir, ntid);
750 xs *tfn = xs_str_cat(fn, ".tmp"); 751 xs *tfn = xs_fmt("%s.tmp", fn);
751 FILE *f; 752 FILE *f;
752 753
753 if ((f = fopen(tfn, "w")) != NULL) { 754 if ((f = fopen(tfn, "w")) != NULL) {