summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mastoapi.c b/mastoapi.c
index d3221c1..a81e86e 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -494,18 +494,18 @@ xs_str *mastoapi_id(const xs_dict *msg)
494xs_dict *mastoapi_account(const xs_dict *actor) 494xs_dict *mastoapi_account(const xs_dict *actor)
495/* converts an ActivityPub actor to a Mastodon account */ 495/* converts an ActivityPub actor to a Mastodon account */
496{ 496{
497 const char *id = xs_dict_get(actor, "id");
498 const char *pub = xs_dict_get(actor, "published");
499
500 if (xs_type(id) != XSTYPE_STRING)
501 return NULL;
502
497 const char *prefu = xs_dict_get(actor, "preferredUsername"); 503 const char *prefu = xs_dict_get(actor, "preferredUsername");
498 504
499 const char *display_name = xs_dict_get(actor, "name"); 505 const char *display_name = xs_dict_get(actor, "name");
500 if (xs_is_null(display_name) || *display_name == '\0') 506 if (xs_is_null(display_name) || *display_name == '\0')
501 display_name = prefu; 507 display_name = prefu;
502 508
503 const char *id = xs_dict_get(actor, "id");
504 const char *pub = xs_dict_get(actor, "published");
505
506 if (xs_is_null(id))
507 return NULL;
508
509 xs_dict *acct = xs_dict_new(); 509 xs_dict *acct = xs_dict_new();
510 xs *acct_md5 = xs_md5_hex(id, strlen(id)); 510 xs *acct_md5 = xs_md5_hex(id, strlen(id));
511 acct = xs_dict_append(acct, "id", acct_md5); 511 acct = xs_dict_append(acct, "id", acct_md5);