mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 14:35:04 +00:00
actor_request() does not need a user argument.
This commit is contained in:
parent
8823325bd9
commit
0e6c5f9463
5 changed files with 13 additions and 13 deletions
|
@ -115,7 +115,7 @@ int activitypub_request(snac *user, const char *url, xs_dict **data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int actor_request(snac *user, const char *actor, xs_dict **data)
|
int actor_request(const char *actor, xs_dict **data)
|
||||||
/* request an actor */
|
/* request an actor */
|
||||||
{
|
{
|
||||||
int status, status2;
|
int status, status2;
|
||||||
|
@ -129,7 +129,7 @@ int actor_request(snac *user, const char *actor, xs_dict **data)
|
||||||
|
|
||||||
if (status != 200) {
|
if (status != 200) {
|
||||||
/* actor data non-existent or stale: get from the net */
|
/* actor data non-existent or stale: get from the net */
|
||||||
status2 = activitypub_request(user, actor, &payload);
|
status2 = activitypub_request(NULL, actor, &payload);
|
||||||
|
|
||||||
if (valid_status(status2)) {
|
if (valid_status(status2)) {
|
||||||
/* renew data */
|
/* renew data */
|
||||||
|
@ -205,7 +205,7 @@ int timeline_request(snac *snac, char **id, xs_str **wrk, int level)
|
||||||
|
|
||||||
/* request (and drop) the actor for this entry */
|
/* request (and drop) the actor for this entry */
|
||||||
if (!xs_is_null(actor))
|
if (!xs_is_null(actor))
|
||||||
actor_request(snac, actor, NULL);
|
actor_request(actor, NULL);
|
||||||
|
|
||||||
/* does it have an ancestor? */
|
/* does it have an ancestor? */
|
||||||
char *in_reply_to = xs_dict_get(object, "inReplyTo");
|
char *in_reply_to = xs_dict_get(object, "inReplyTo");
|
||||||
|
@ -329,7 +329,7 @@ xs_str *get_actor_inbox(snac *snac, const char *actor)
|
||||||
xs *data = NULL;
|
xs *data = NULL;
|
||||||
char *v = NULL;
|
char *v = NULL;
|
||||||
|
|
||||||
if (valid_status(actor_request(snac, actor, &data))) {
|
if (valid_status(actor_request(actor, &data))) {
|
||||||
/* try first endpoints/sharedInbox */
|
/* try first endpoints/sharedInbox */
|
||||||
if ((v = xs_dict_get(data, "endpoints")))
|
if ((v = xs_dict_get(data, "endpoints")))
|
||||||
v = xs_dict_get(v, "sharedInbox");
|
v = xs_dict_get(v, "sharedInbox");
|
||||||
|
@ -1093,7 +1093,7 @@ xs_dict *msg_follow(snac *snac, const char *q)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* request the actor */
|
/* request the actor */
|
||||||
status = actor_request(snac, actor, &actor_o);
|
status = actor_request(actor, &actor_o);
|
||||||
|
|
||||||
if (valid_status(status)) {
|
if (valid_status(status)) {
|
||||||
/* check if the actor is an alias */
|
/* check if the actor is an alias */
|
||||||
|
@ -1499,7 +1499,7 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
|
||||||
utype = "(null)";
|
utype = "(null)";
|
||||||
|
|
||||||
/* bring the actor */
|
/* bring the actor */
|
||||||
a_status = actor_request(snac, actor, &actor_o);
|
a_status = actor_request(actor, &actor_o);
|
||||||
|
|
||||||
/* do not retry permanent failures */
|
/* do not retry permanent failures */
|
||||||
if (a_status == 404 || a_status == 410 || a_status < 0) {
|
if (a_status == 404 || a_status == 410 || a_status < 0) {
|
||||||
|
@ -1681,7 +1681,7 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
|
||||||
/* bring the actor */
|
/* bring the actor */
|
||||||
xs *who_o = NULL;
|
xs *who_o = NULL;
|
||||||
|
|
||||||
if (valid_status(actor_request(snac, who, &who_o))) {
|
if (valid_status(actor_request(who, &who_o))) {
|
||||||
timeline_admire(snac, object, actor, 0);
|
timeline_admire(snac, object, actor, 0);
|
||||||
snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object));
|
snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object));
|
||||||
do_notify = 1;
|
do_notify = 1;
|
||||||
|
|
2
http.c
2
http.c
|
@ -173,7 +173,7 @@ int check_signature(snac *user, xs_dict *req, xs_str **err)
|
||||||
|
|
||||||
xs *actor = NULL;
|
xs *actor = NULL;
|
||||||
|
|
||||||
if (!valid_status(actor_request(user, keyId, &actor))) {
|
if (!valid_status(actor_request(keyId, &actor))) {
|
||||||
*err = xs_fmt("unknown actor %s", keyId);
|
*err = xs_fmt("unknown actor %s", keyId);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
6
main.c
6
main.c
|
@ -184,7 +184,7 @@ int main(int argc, char *argv[])
|
||||||
xs *actor = NULL;
|
xs *actor = NULL;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
status = actor_request(NULL, user, &actor);
|
status = actor_request(user, &actor);
|
||||||
|
|
||||||
printf("status: %d\n", status);
|
printf("status: %d\n", status);
|
||||||
if (valid_status(status)) {
|
if (valid_status(status)) {
|
||||||
|
@ -334,7 +334,7 @@ int main(int argc, char *argv[])
|
||||||
if (strcmp(cmd, "ping") == 0) { /** **/
|
if (strcmp(cmd, "ping") == 0) { /** **/
|
||||||
xs *actor_o = NULL;
|
xs *actor_o = NULL;
|
||||||
|
|
||||||
if (valid_status(actor_request(&snac, url, &actor_o))) {
|
if (valid_status(actor_request(url, &actor_o))) {
|
||||||
xs *msg = msg_ping(&snac, url);
|
xs *msg = msg_ping(&snac, url);
|
||||||
|
|
||||||
enqueue_output_by_actor(&snac, msg, url, 0);
|
enqueue_output_by_actor(&snac, msg, url, 0);
|
||||||
|
@ -409,7 +409,7 @@ int main(int argc, char *argv[])
|
||||||
int status;
|
int status;
|
||||||
xs *data = NULL;
|
xs *data = NULL;
|
||||||
|
|
||||||
status = actor_request(&snac, url, &data);
|
status = actor_request(url, &data);
|
||||||
|
|
||||||
printf("status: %d\n", status);
|
printf("status: %d\n", status);
|
||||||
|
|
||||||
|
|
|
@ -1944,7 +1944,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
||||||
if (valid_status(webfinger_request(q, &actor, &user))) {
|
if (valid_status(webfinger_request(q, &actor, &user))) {
|
||||||
xs *actor_o = NULL;
|
xs *actor_o = NULL;
|
||||||
|
|
||||||
if (valid_status(actor_request(&snac1, actor, &actor_o))) {
|
if (valid_status(actor_request(actor, &actor_o))) {
|
||||||
xs *acct = mastoapi_account(actor_o);
|
xs *acct = mastoapi_account(actor_o);
|
||||||
|
|
||||||
acl = xs_list_append(acl, acct);
|
acl = xs_list_append(acl, acct);
|
||||||
|
|
2
snac.h
2
snac.h
|
@ -242,7 +242,7 @@ xs_dict *msg_question(snac *user, const char *content, xs_list *attach,
|
||||||
const xs_list *opts, int multiple, int end_secs);
|
const xs_list *opts, int multiple, int end_secs);
|
||||||
|
|
||||||
int activitypub_request(snac *snac, const char *url, xs_dict **data);
|
int activitypub_request(snac *snac, const char *url, xs_dict **data);
|
||||||
int actor_request(snac *snac, const char *actor, xs_dict **data);
|
int actor_request(const char *actor, xs_dict **data);
|
||||||
void timeline_request_replies(snac *user, const char *id);
|
void timeline_request_replies(snac *user, const char *id);
|
||||||
int send_to_inbox_raw(const char *keyid, const char *seckey,
|
int send_to_inbox_raw(const char *keyid, const char *seckey,
|
||||||
const xs_str *inbox, const xs_dict *msg,
|
const xs_str *inbox, const xs_dict *msg,
|
||||||
|
|
Loading…
Reference in a new issue