diff options
| author | grunfink <grunfink@comam.es> | 2025-12-18 09:24:39 +0100 |
|---|---|---|
| committer | grunfink <grunfink@comam.es> | 2025-12-18 09:24:39 +0100 |
| commit | 765cd34527052970892ca33b80fd977c37b6b608 (patch) | |
| tree | 2e941d1b995e667755807757333bed2931e74cb1 /activitypub.c | |
| parent | 2b1d108653bd8c37fb1c0962e860704783f309f0 (diff) | |
Only generate an Image tag if the emoji is an URL.
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/activitypub.c b/activitypub.c index de3a4dc..e1f3210 100644 --- a/activitypub.c +++ b/activitypub.c @@ -1628,19 +1628,25 @@ xs_dict *msg_emoji_init(snac *snac, const char *mid, const char *eid_o) } else { content = xs_fmt(":%s:", eid); - const char *url = xs_dict_get(emjs, content); + const char *emo = xs_dict_get(emjs, content); - if (url == NULL) + if (emo == NULL) return NULL; - icon = xs_dict_set(icon, "type", "Image"); - icon = xs_dict_set(icon, "url", url); - dict = xs_dict_set(dict, "icon", icon); + if (xs_match(emo, "https://*|http://*")) { /* emoji is an URL to an image */ + icon = xs_dict_set(icon, "type", "Image"); + icon = xs_dict_set(icon, "url", emo); + dict = xs_dict_set(dict, "icon", icon); - dict = xs_dict_set(dict, "id", url); - dict = xs_dict_set(dict, "name", content); - dict = xs_dict_set(dict, "type", "Emoji"); - tag = xs_list_append(tag, dict); + dict = xs_dict_set(dict, "id", emo); + dict = xs_dict_set(dict, "name", content); + dict = xs_dict_set(dict, "type", "Emoji"); + tag = xs_list_append(tag, dict); + } + else { + xs_free(content); + content = xs_dup(emo); + } } accounts = xs_list_append(accounts, snac->actor); |