Răsfoiți Sursa

set bot to true in mastodon account if user type is service

Haijo7 3 ani în urmă
părinte
comite
9b1c5cc843
1 a modificat fișierele cu 5 adăugiri și 2 ștergeri
  1. 5 2
      mastoapi.c

+ 5 - 2
mastoapi.c

@@ -497,11 +497,9 @@ xs_dict *mastoapi_account(const xs_dict *actor)
         display_name = prefu;
         display_name = prefu;
 
 
     const char *id  = xs_dict_get(actor, "id");
     const char *id  = xs_dict_get(actor, "id");
-    const char *type  = xs_dict_get(actor, "type");
     const char *pub = xs_dict_get(actor, "published");
     const char *pub = xs_dict_get(actor, "published");
     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);
-    acct = xs_dict_append(acct, "type",         type);
     acct = xs_dict_append(acct, "username",     prefu);
     acct = xs_dict_append(acct, "username",     prefu);
     acct = xs_dict_append(acct, "display_name", display_name);
     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))
     if (xs_is_null(note))
         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, "note", note);
 
 
     acct = xs_dict_append(acct, "url", id);
     acct = xs_dict_append(acct, "url", id);