aboutsummaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-12-15 15:17:38 +0100
committerdefault <nobody@localhost>2024-12-15 15:17:38 +0100
commitee607734d8effdfb3a1a163e59153546a6ae9506 (patch)
treec750f1ef30c61c410b7a3200d0387d939bcf3d94 /mastoapi.c
parente94db271d130a348fdff4940fed4a8b0950bac86 (diff)
mastoapi: fixed incorrect field 'bot' for newly created accounts.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 990898b..d844b42 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -1193,10 +1193,13 @@ int process_auth_token(snac *snac, const xs_dict *req)
return logged_in;
}
+
void credentials_get(char **body, char **ctype, int *status, snac snac)
{
xs *acct = xs_dict_new();
+ const xs_val *bot = xs_dict_get(snac.config, "bot");
+
acct = xs_dict_append(acct, "id", snac.md5);
acct = xs_dict_append(acct, "username", xs_dict_get(snac.config, "uid"));
acct = xs_dict_append(acct, "acct", xs_dict_get(snac.config, "uid"));
@@ -1206,7 +1209,7 @@ void credentials_get(char **body, char **ctype, int *status, snac snac)
acct = xs_dict_append(acct, "note", xs_dict_get(snac.config, "bio"));
acct = xs_dict_append(acct, "url", snac.actor);
acct = xs_dict_append(acct, "locked", xs_stock(XSTYPE_FALSE));
- acct = xs_dict_append(acct, "bot", xs_dict_get(snac.config, "bot"));
+ acct = xs_dict_append(acct, "bot", xs_stock(xs_is_true(bot) ? XSTYPE_TRUE : XSTYPE_FALSE));
acct = xs_dict_append(acct, "emojis", xs_stock(XSTYPE_LIST));
xs *src = xs_json_loads("{\"privacy\":\"public\", \"language\":\"en\","
@@ -1220,7 +1223,7 @@ void credentials_get(char **body, char **ctype, int *status, snac snac)
src = xs_dict_set(src, "sensitive",
strcmp(cw, "open") == 0 ? xs_stock(XSTYPE_TRUE) : xs_stock(XSTYPE_FALSE));
- src = xs_dict_set(src, "bot", xs_dict_get(snac.config, "bot"));
+ src = xs_dict_set(src, "bot", xs_stock(xs_is_true(bot) ? XSTYPE_TRUE : XSTYPE_FALSE));
xs *avatar = NULL;
const char *av = xs_dict_get(snac.config, "avatar");