summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 012164e..8697ac2 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -462,7 +462,7 @@ xs_dict *mastoapi_account(const xs_dict *actor)
462 462
463 acct = xs_dict_append(acct, "note", note); 463 acct = xs_dict_append(acct, "note", note);
464 464
465 acct = xs_dict_append(acct, "url", id); 465 acct = xs_dict_append(acct, "url", id);
466 466
467 xs *avatar = NULL; 467 xs *avatar = NULL;
468 xs_dict *av = xs_dict_get(actor, "icon"); 468 xs_dict *av = xs_dict_get(actor, "icon");
@@ -474,6 +474,41 @@ xs_dict *mastoapi_account(const xs_dict *actor)
474 474
475 acct = xs_dict_append(acct, "avatar", avatar); 475 acct = xs_dict_append(acct, "avatar", avatar);
476 476
477 /* emojis */
478 xs_list *p;
479 if (!xs_is_null(p = xs_dict_get(actor, "tag"))) {
480 xs *eml = xs_list_new();
481 xs_dict *v;
482 xs *t = xs_val_new(XSTYPE_TRUE);
483
484 while (xs_list_iter(&p, &v)) {
485 const char *type = xs_dict_get(v, "type");
486
487 if (!xs_is_null(type) && strcmp(type, "Emoji") == 0) {
488 const char *name = xs_dict_get(v, "name");
489 const xs_dict *icon = xs_dict_get(v, "icon");
490
491 if (!xs_is_null(name) && !xs_is_null(icon)) {
492 const char *url = xs_dict_get(icon, "url");
493
494 if (!xs_is_null(url)) {
495 xs *nm = xs_strip_chars_i(xs_dup(name), ":");
496 xs *d1 = xs_dict_new();
497
498 d1 = xs_dict_append(d1, "shortcode", nm);
499 d1 = xs_dict_append(d1, "url", url);
500 d1 = xs_dict_append(d1, "static_url", url);
501 d1 = xs_dict_append(d1, "visible_in_picker", t);
502
503 eml = xs_list_append(eml, d1);
504 }
505 }
506 }
507 }
508
509 acct = xs_dict_append(acct, "emojis", eml);
510 }
511
477 return acct; 512 return acct;
478} 513}
479 514