summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-04-24 17:25:32 +0200
committerdefault <nobody@localhost>2023-04-24 17:25:32 +0200
commitf625d8842605e4d18be106260fc85ba88ad50b0b (patch)
tree451f445166b6c7f9b5968c787c40e1ab7556fc84
parent9456a57954821db53b0db90dbe7b7b0a9ba0e6fe (diff)
Added custom emojis to Statuses.
-rw-r--r--mastoapi.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 0bc5dd9..012164e 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -604,6 +604,28 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg)
htl = xs_list_append(htl, d1);
}
}
+ else
+ if (strcmp(type, "Emoji") == 0) {
+ const char *name = xs_dict_get(v, "name");
+ const xs_dict *icon = xs_dict_get(v, "icon");
+
+ if (!xs_is_null(name) && !xs_is_null(icon)) {
+ const char *url = xs_dict_get(icon, "url");
+
+ if (!xs_is_null(url)) {
+ xs *nm = xs_strip_chars_i(xs_dup(name), ":");
+ xs *t = xs_val_new(XSTYPE_TRUE);
+
+ d1 = xs_dict_append(d1, "shortcode", nm);
+ d1 = xs_dict_append(d1, "url", url);
+ d1 = xs_dict_append(d1, "static_url", url);
+ d1 = xs_dict_append(d1, "visible_in_picker", t);
+ d1 = xs_dict_append(d1, "category", "Emojis");
+
+ eml = xs_list_append(eml, d1);
+ }
+ }
+ }
}
st = xs_dict_append(st, "mentions", ml);