mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 14:35:04 +00:00
Minor tweak for better corruption detection.
This commit is contained in:
parent
5532a3e8bd
commit
9185cc4baa
1 changed files with 6 additions and 6 deletions
12
mastoapi.c
12
mastoapi.c
|
@ -494,18 +494,18 @@ xs_str *mastoapi_id(const xs_dict *msg)
|
||||||
xs_dict *mastoapi_account(const xs_dict *actor)
|
xs_dict *mastoapi_account(const xs_dict *actor)
|
||||||
/* converts an ActivityPub actor to a Mastodon account */
|
/* converts an ActivityPub actor to a Mastodon account */
|
||||||
{
|
{
|
||||||
|
const char *id = xs_dict_get(actor, "id");
|
||||||
|
const char *pub = xs_dict_get(actor, "published");
|
||||||
|
|
||||||
|
if (xs_type(id) != XSTYPE_STRING)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
const char *prefu = xs_dict_get(actor, "preferredUsername");
|
const char *prefu = xs_dict_get(actor, "preferredUsername");
|
||||||
|
|
||||||
const char *display_name = xs_dict_get(actor, "name");
|
const char *display_name = xs_dict_get(actor, "name");
|
||||||
if (xs_is_null(display_name) || *display_name == '\0')
|
if (xs_is_null(display_name) || *display_name == '\0')
|
||||||
display_name = prefu;
|
display_name = prefu;
|
||||||
|
|
||||||
const char *id = xs_dict_get(actor, "id");
|
|
||||||
const char *pub = xs_dict_get(actor, "published");
|
|
||||||
|
|
||||||
if (xs_is_null(id))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
xs_dict *acct = xs_dict_new();
|
xs_dict *acct = xs_dict_new();
|
||||||
xs *acct_md5 = xs_md5_hex(id, strlen(id));
|
xs *acct_md5 = xs_md5_hex(id, strlen(id));
|
||||||
acct = xs_dict_append(acct, "id", acct_md5);
|
acct = xs_dict_append(acct, "id", acct_md5);
|
||||||
|
|
Loading…
Reference in a new issue