From 2544ec92b20c44a9b0dee29817b394b1e5c74f70 Mon Sep 17 00:00:00 2001 From: Haijo7 Date: Sun, 11 Jun 2023 16:38:06 +0200 Subject: [PATCH 1/2] add user type to mastodon profile --- mastoapi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mastoapi.c b/mastoapi.c index acefe57..ff5c756 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -497,9 +497,11 @@ xs_dict *mastoapi_account(const xs_dict *actor) display_name = prefu; const char *id = xs_dict_get(actor, "id"); + const char *type = xs_dict_get(actor, "type"); const char *pub = xs_dict_get(actor, "published"); xs *acct_md5 = xs_md5_hex(id, strlen(id)); acct = xs_dict_append(acct, "id", acct_md5); + acct = xs_dict_append(acct, "type", type); acct = xs_dict_append(acct, "username", prefu); acct = xs_dict_append(acct, "display_name", display_name); From 9b1c5cc843e5f949cef0ebecd933f4442fb52577 Mon Sep 17 00:00:00 2001 From: Haijo7 Date: Sun, 11 Jun 2023 16:53:50 +0200 Subject: [PATCH 2/2] set bot to true in mastodon account if user type is service --- mastoapi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mastoapi.c b/mastoapi.c index ff5c756..3b9db28 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -497,11 +497,9 @@ xs_dict *mastoapi_account(const xs_dict *actor) display_name = prefu; const char *id = xs_dict_get(actor, "id"); - const char *type = xs_dict_get(actor, "type"); const char *pub = xs_dict_get(actor, "published"); xs *acct_md5 = xs_md5_hex(id, strlen(id)); acct = xs_dict_append(acct, "id", acct_md5); - acct = xs_dict_append(acct, "type", type); acct = xs_dict_append(acct, "username", prefu); acct = xs_dict_append(acct, "display_name", display_name); @@ -524,6 +522,11 @@ xs_dict *mastoapi_account(const xs_dict *actor) if (xs_is_null(note)) note = ""; + if (strcmp(xs_dict_get(actor, "type"), "Service") == 0) + acct = xs_dict_append(acct, "bot", "true"); + else + acct = xs_dict_append(acct, "bot", "false"); + acct = xs_dict_append(acct, "note", note); acct = xs_dict_append(acct, "url", id);