diff options
| author | 2025-12-18 09:24:39 +0100 | |
|---|---|---|
| committer | 2025-12-18 09:24:39 +0100 | |
| commit | 765cd34527052970892ca33b80fd977c37b6b608 (patch) | |
| tree | 2e941d1b995e667755807757333bed2931e74cb1 /activitypub.c | |
| parent | Use the emoji value from emojis.json instead of creating a link to the static... (diff) | |
| download | snac2-765cd34527052970892ca33b80fd977c37b6b608.tar.gz snac2-765cd34527052970892ca33b80fd977c37b6b608.tar.xz snac2-765cd34527052970892ca33b80fd977c37b6b608.zip | |
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) | |||
| 1628 | } | 1628 | } |
| 1629 | else { | 1629 | else { |
| 1630 | content = xs_fmt(":%s:", eid); | 1630 | content = xs_fmt(":%s:", eid); |
| 1631 | const char *url = xs_dict_get(emjs, content); | 1631 | const char *emo = xs_dict_get(emjs, content); |
| 1632 | 1632 | ||
| 1633 | if (url == NULL) | 1633 | if (emo == NULL) |
| 1634 | return NULL; | 1634 | return NULL; |
| 1635 | 1635 | ||
| 1636 | icon = xs_dict_set(icon, "type", "Image"); | 1636 | if (xs_match(emo, "https://*|http://*")) { /* emoji is an URL to an image */ |
| 1637 | icon = xs_dict_set(icon, "url", url); | 1637 | icon = xs_dict_set(icon, "type", "Image"); |
| 1638 | dict = xs_dict_set(dict, "icon", icon); | 1638 | icon = xs_dict_set(icon, "url", emo); |
| 1639 | dict = xs_dict_set(dict, "icon", icon); | ||
| 1639 | 1640 | ||
| 1640 | dict = xs_dict_set(dict, "id", url); | 1641 | dict = xs_dict_set(dict, "id", emo); |
| 1641 | dict = xs_dict_set(dict, "name", content); | 1642 | dict = xs_dict_set(dict, "name", content); |
| 1642 | dict = xs_dict_set(dict, "type", "Emoji"); | 1643 | dict = xs_dict_set(dict, "type", "Emoji"); |
| 1643 | tag = xs_list_append(tag, dict); | 1644 | tag = xs_list_append(tag, dict); |
| 1645 | } | ||
| 1646 | else { | ||
| 1647 | xs_free(content); | ||
| 1648 | content = xs_dup(emo); | ||
| 1649 | } | ||
| 1644 | } | 1650 | } |
| 1645 | 1651 | ||
| 1646 | accounts = xs_list_append(accounts, snac->actor); | 1652 | accounts = xs_list_append(accounts, snac->actor); |