commit 9b1c5cc

Haijo7  ·  2023-06-11 14:53:50 +0000 UTC
parent 2544ec9
set bot to true in mastodon account if user type is service
1 files changed,  +5, -2
+5, -2
 1@@ -497,11 +497,9 @@ xs_dict *mastoapi_account(const xs_dict *actor)
 2         display_name = prefu;
 3 
 4     const char *id  = xs_dict_get(actor, "id");
 5-    const char *type  = xs_dict_get(actor, "type");
 6     const char *pub = xs_dict_get(actor, "published");
 7     xs *acct_md5 = xs_md5_hex(id, strlen(id));
 8     acct = xs_dict_append(acct, "id",           acct_md5);
 9-    acct = xs_dict_append(acct, "type",         type);
10     acct = xs_dict_append(acct, "username",     prefu);
11     acct = xs_dict_append(acct, "display_name", display_name);
12 
13@@ -524,6 +522,11 @@ xs_dict *mastoapi_account(const xs_dict *actor)
14     if (xs_is_null(note))
15         note = "";
16 
17+    if (strcmp(xs_dict_get(actor, "type"), "Service") == 0)
18+        acct = xs_dict_append(acct, "bot", "true");
19+    else
20+        acct = xs_dict_append(acct, "bot", "false");
21+
22     acct = xs_dict_append(acct, "note", note);
23 
24     acct = xs_dict_append(acct, "url", id);