mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-21 21:05:05 +00:00
Use webfinger_request_fake() in export_csv().
This commit is contained in:
parent
ee63e2a78c
commit
836b66358d
2 changed files with 11 additions and 20 deletions
17
utils.c
17
utils.c
|
@ -605,14 +605,10 @@ void export_csv(snac *user)
|
|||
|
||||
xs_list_foreach(l, actor) {
|
||||
xs *uid = NULL;
|
||||
int status;
|
||||
|
||||
if (valid_status((status = webfinger_request(actor, NULL, &uid)))) {
|
||||
webfinger_request_fake(actor, NULL, &uid);
|
||||
fprintf(f, "%s\n", uid);
|
||||
}
|
||||
else
|
||||
snac_log(user, xs_fmt("Error resolving muted user %s %d", actor, status));
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
@ -639,12 +635,9 @@ void export_csv(snac *user)
|
|||
if (valid_status(object_get_by_md5(md5, &actor))) {
|
||||
const char *id = xs_dict_get(actor, "id");
|
||||
xs *uid = NULL;
|
||||
int status;
|
||||
|
||||
if (valid_status((status = webfinger_request(id, NULL, &uid))))
|
||||
webfinger_request_fake(id, NULL, &uid);
|
||||
fprintf(f, "%s,%s\n", ltitle, uid);
|
||||
else
|
||||
snac_log(user, xs_fmt("Error resolving list member %s %d", id, status));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -665,14 +658,10 @@ void export_csv(snac *user)
|
|||
|
||||
xs_list_foreach(fwing, actor) {
|
||||
xs *uid = NULL;
|
||||
int status;
|
||||
|
||||
if (valid_status((status = webfinger_request(actor, NULL, &uid)))) {
|
||||
webfinger_request_fake(actor, NULL, &uid);
|
||||
fprintf(f, "%s,%s,false,\n", uid, limited(user, actor, 0) ? "false" : "true");
|
||||
}
|
||||
else
|
||||
snac_log(user, xs_fmt("Error resolving followed account %s %d", actor, status));
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
|
|
@ -133,11 +133,13 @@ int webfinger_request_fake(const char *qs, xs_str **actor, xs_str **user)
|
|||
if (xs_startswith(qs, "https:/") || xs_startswith(qs, "http:/")) {
|
||||
xs *l = xs_split(qs, "/");
|
||||
|
||||
if (xs_list_len(l) > 3) {
|
||||
/* i'll end up in hell for this */
|
||||
*user = xs_fmt("%s@%s", xs_list_get(l, 2), xs_list_get(l, -1));
|
||||
*user = xs_fmt("%s@%s", xs_list_get(l, -1), xs_list_get(l, 2));
|
||||
status = HTTP_STATUS_RESET_CONTENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue