diff options
Diffstat (limited to '')
| -rw-r--r-- | activitypub.c | 16 | ||||
| -rw-r--r-- | http.c | 4 | ||||
| -rw-r--r-- | main.c | 6 | ||||
| -rw-r--r-- | mastoapi.c | 2 | ||||
| -rw-r--r-- | snac.h | 4 |
5 files changed, 16 insertions, 16 deletions
diff --git a/activitypub.c b/activitypub.c index 129148d..5afe304 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 | ||
| 118 | int actor_request(snac *user, const char *actor, xs_dict **data) | 118 | int actor_request(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(snac *user, 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(user, actor, &payload); | 132 | status2 = activitypub_request(NULL, 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(snac, actor, NULL); | 210 | actor_request(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(NULL, actor, &data))) { | 334 | if (valid_status(actor_request(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(snac, actor, &actor_o); | 1098 | status = actor_request(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(snac, actor, &actor_o); | 1504 | a_status = actor_request(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(snac, req, &sig_err)) { | 1523 | if (!check_signature(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(snac, who, &who_o))) { | 1686 | if (valid_status(actor_request(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; |
| @@ -120,7 +120,7 @@ xs_dict *http_signed_request(snac *snac, const char *method, const char *url, | |||
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | 122 | ||
| 123 | int check_signature(snac *user, xs_dict *req, xs_str **err) | 123 | int check_signature(xs_dict *req, xs_str **err) |
| 124 | /* check the signature */ | 124 | /* check the signature */ |
| 125 | { | 125 | { |
| 126 | char *sig_hdr = xs_dict_get(req, "signature"); | 126 | char *sig_hdr = xs_dict_get(req, "signature"); |
| @@ -173,7 +173,7 @@ int check_signature(snac *user, xs_dict *req, xs_str **err) | |||
| 173 | 173 | ||
| 174 | xs *actor = NULL; | 174 | xs *actor = NULL; |
| 175 | 175 | ||
| 176 | if (!valid_status(actor_request(user, keyId, &actor))) { | 176 | if (!valid_status(actor_request(keyId, &actor))) { |
| 177 | *err = xs_fmt("unknown actor %s", keyId); | 177 | *err = xs_fmt("unknown actor %s", keyId); |
| 178 | return 0; | 178 | return 0; |
| 179 | } | 179 | } |
| @@ -184,7 +184,7 @@ int main(int argc, char *argv[]) | |||
| 184 | xs *actor = NULL; | 184 | xs *actor = NULL; |
| 185 | int status; | 185 | int status; |
| 186 | 186 | ||
| 187 | status = actor_request(NULL, user, &actor); | 187 | status = actor_request(user, &actor); |
| 188 | 188 | ||
| 189 | printf("status: %d\n", status); | 189 | printf("status: %d\n", status); |
| 190 | if (valid_status(status)) { | 190 | if (valid_status(status)) { |
| @@ -334,7 +334,7 @@ int main(int argc, char *argv[]) | |||
| 334 | if (strcmp(cmd, "ping") == 0) { /** **/ | 334 | if (strcmp(cmd, "ping") == 0) { /** **/ |
| 335 | xs *actor_o = NULL; | 335 | xs *actor_o = NULL; |
| 336 | 336 | ||
| 337 | if (valid_status(actor_request(&snac, url, &actor_o))) { | 337 | if (valid_status(actor_request(url, &actor_o))) { |
| 338 | xs *msg = msg_ping(&snac, url); | 338 | xs *msg = msg_ping(&snac, url); |
| 339 | 339 | ||
| 340 | enqueue_output_by_actor(&snac, msg, url, 0); | 340 | enqueue_output_by_actor(&snac, msg, url, 0); |
| @@ -409,7 +409,7 @@ int main(int argc, char *argv[]) | |||
| 409 | int status; | 409 | int status; |
| 410 | xs *data = NULL; | 410 | xs *data = NULL; |
| 411 | 411 | ||
| 412 | status = actor_request(&snac, url, &data); | 412 | status = actor_request(url, &data); |
| 413 | 413 | ||
| 414 | printf("status: %d\n", status); | 414 | printf("status: %d\n", status); |
| 415 | 415 | ||
| @@ -1944,7 +1944,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1944 | if (valid_status(webfinger_request(q, &actor, &user))) { | 1944 | if (valid_status(webfinger_request(q, &actor, &user))) { |
| 1945 | xs *actor_o = NULL; | 1945 | xs *actor_o = NULL; |
| 1946 | 1946 | ||
| 1947 | if (valid_status(actor_request(&snac1, actor, &actor_o))) { | 1947 | if (valid_status(actor_request(actor, &actor_o))) { |
| 1948 | xs *acct = mastoapi_account(actor_o); | 1948 | xs *acct = mastoapi_account(actor_o); |
| 1949 | 1949 | ||
| 1950 | acl = xs_list_append(acl, acct); | 1950 | acl = xs_list_append(acl, acct); |
| @@ -212,7 +212,7 @@ xs_dict *http_signed_request(snac *snac, const char *method, const char *url, | |||
| 212 | const char *body, int b_size, | 212 | const char *body, int b_size, |
| 213 | int *status, xs_str **payload, int *p_size, | 213 | int *status, xs_str **payload, int *p_size, |
| 214 | int timeout); | 214 | int timeout); |
| 215 | int check_signature(snac *user, xs_dict *req, xs_str **err); | 215 | int check_signature(xs_dict *req, xs_str **err); |
| 216 | 216 | ||
| 217 | void httpd(void); | 217 | void httpd(void); |
| 218 | 218 | ||
| @@ -242,7 +242,7 @@ xs_dict *msg_question(snac *user, const char *content, xs_list *attach, | |||
| 242 | const xs_list *opts, int multiple, int end_secs); | 242 | const xs_list *opts, int multiple, int end_secs); |
| 243 | 243 | ||
| 244 | int activitypub_request(snac *snac, const char *url, xs_dict **data); | 244 | int activitypub_request(snac *snac, const char *url, xs_dict **data); |
| 245 | int actor_request(snac *user, const char *actor, xs_dict **data); | 245 | int actor_request(const char *actor, xs_dict **data); |
| 246 | void timeline_request_replies(snac *user, const char *id); | 246 | void timeline_request_replies(snac *user, const char *id); |
| 247 | int send_to_inbox_raw(const char *keyid, const char *seckey, | 247 | int send_to_inbox_raw(const char *keyid, const char *seckey, |
| 248 | const xs_str *inbox, const xs_dict *msg, | 248 | const xs_str *inbox, const xs_dict *msg, |