summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/activitypub.c b/activitypub.c
index 5afe304..129148d 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -115,7 +115,7 @@ int activitypub_request(snac *user, const char *url, xs_dict **data)
115} 115}
116 116
117 117
118int actor_request(const char *actor, xs_dict **data) 118int actor_request(snac *user, const char *actor, xs_dict **data)
119/* request an actor */ 119/* request an actor */
120{ 120{
121 int status, status2; 121 int status, status2;
@@ -129,7 +129,7 @@ int actor_request(const char *actor, xs_dict **data)
129 129
130 if (status != 200) { 130 if (status != 200) {
131 /* actor data non-existent or stale: get from the net */ 131 /* actor data non-existent or stale: get from the net */
132 status2 = activitypub_request(NULL, actor, &payload); 132 status2 = activitypub_request(user, actor, &payload);
133 133
134 if (valid_status(status2)) { 134 if (valid_status(status2)) {
135 /* renew data */ 135 /* renew data */
@@ -207,7 +207,7 @@ int timeline_request(snac *snac, char **id, xs_str **wrk, int level)
207 207
208 /* request (and drop) the actor for this entry */ 208 /* request (and drop) the actor for this entry */
209 if (!xs_is_null(actor)) 209 if (!xs_is_null(actor))
210 actor_request(actor, NULL); 210 actor_request(snac, actor, NULL);
211 211
212 /* does it have an ancestor? */ 212 /* does it have an ancestor? */
213 char *in_reply_to = xs_dict_get(object, "inReplyTo"); 213 char *in_reply_to = xs_dict_get(object, "inReplyTo");
@@ -331,7 +331,7 @@ xs_str *get_actor_inbox(const char *actor)
331 xs *data = NULL; 331 xs *data = NULL;
332 char *v = NULL; 332 char *v = NULL;
333 333
334 if (valid_status(actor_request(actor, &data))) { 334 if (valid_status(actor_request(NULL, actor, &data))) {
335 /* try first endpoints/sharedInbox */ 335 /* try first endpoints/sharedInbox */
336 if ((v = xs_dict_get(data, "endpoints"))) 336 if ((v = xs_dict_get(data, "endpoints")))
337 v = xs_dict_get(v, "sharedInbox"); 337 v = xs_dict_get(v, "sharedInbox");
@@ -1095,7 +1095,7 @@ xs_dict *msg_follow(snac *snac, const char *q)
1095 } 1095 }
1096 1096
1097 /* request the actor */ 1097 /* request the actor */
1098 status = actor_request(actor, &actor_o); 1098 status = actor_request(snac, actor, &actor_o);
1099 1099
1100 if (valid_status(status)) { 1100 if (valid_status(status)) {
1101 /* check if the actor is an alias */ 1101 /* check if the actor is an alias */
@@ -1501,7 +1501,7 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
1501 utype = "(null)"; 1501 utype = "(null)";
1502 1502
1503 /* bring the actor */ 1503 /* bring the actor */
1504 a_status = actor_request(actor, &actor_o); 1504 a_status = actor_request(snac, actor, &actor_o);
1505 1505
1506 /* do not retry permanent failures */ 1506 /* do not retry permanent failures */
1507 if (a_status == 404 || a_status == 410 || a_status < 0) { 1507 if (a_status == 404 || a_status == 410 || a_status < 0) {
@@ -1520,7 +1520,7 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
1520 /* check the signature */ 1520 /* check the signature */
1521 xs *sig_err = NULL; 1521 xs *sig_err = NULL;
1522 1522
1523 if (!check_signature(req, &sig_err)) { 1523 if (!check_signature(snac, req, &sig_err)) {
1524 srv_log(xs_fmt("bad signature %s (%s)", actor, sig_err)); 1524 srv_log(xs_fmt("bad signature %s (%s)", actor, sig_err));
1525 1525
1526 srv_archive_error("check_signature", sig_err, req, msg); 1526 srv_archive_error("check_signature", sig_err, req, msg);
@@ -1683,7 +1683,7 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
1683 /* bring the actor */ 1683 /* bring the actor */
1684 xs *who_o = NULL; 1684 xs *who_o = NULL;
1685 1685
1686 if (valid_status(actor_request(who, &who_o))) { 1686 if (valid_status(actor_request(snac, who, &who_o))) {
1687 timeline_admire(snac, object, actor, 0); 1687 timeline_admire(snac, object, actor, 0);
1688 snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object)); 1688 snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object));
1689 do_notify = 1; 1689 do_notify = 1;