commit 765cd34
grunfink
·
2025-12-18 08:24:39 +0000 UTC
parent 2b1d108
Only generate an Image tag if the emoji is an URL.
1 files changed,
+15,
-9
+15,
-9
1@@ -1628,19 +1628,25 @@ xs_dict *msg_emoji_init(snac *snac, const char *mid, const char *eid_o)
2 }
3 else {
4 content = xs_fmt(":%s:", eid);
5- const char *url = xs_dict_get(emjs, content);
6+ const char *emo = xs_dict_get(emjs, content);
7
8- if (url == NULL)
9+ if (emo == NULL)
10 return NULL;
11
12- icon = xs_dict_set(icon, "type", "Image");
13- icon = xs_dict_set(icon, "url", url);
14- dict = xs_dict_set(dict, "icon", icon);
15+ if (xs_match(emo, "https://*|http://*")) { /* emoji is an URL to an image */
16+ icon = xs_dict_set(icon, "type", "Image");
17+ icon = xs_dict_set(icon, "url", emo);
18+ dict = xs_dict_set(dict, "icon", icon);
19
20- dict = xs_dict_set(dict, "id", url);
21- dict = xs_dict_set(dict, "name", content);
22- dict = xs_dict_set(dict, "type", "Emoji");
23- tag = xs_list_append(tag, dict);
24+ dict = xs_dict_set(dict, "id", emo);
25+ dict = xs_dict_set(dict, "name", content);
26+ dict = xs_dict_set(dict, "type", "Emoji");
27+ tag = xs_list_append(tag, dict);
28+ }
29+ else {
30+ xs_free(content);
31+ content = xs_dup(emo);
32+ }
33 }
34
35 accounts = xs_list_append(accounts, snac->actor);