diff options
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/activitypub.c b/activitypub.c index d19a428..de3a4dc 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -1600,17 +1600,18 @@ xs_dict *msg_repulsion(snac *user, const char *id, const char *type) | |||
| 1600 | return msg; | 1600 | return msg; |
| 1601 | } | 1601 | } |
| 1602 | 1602 | ||
| 1603 | xs_dict *msg_emoji_init(snac *snac, const char *mid, const char *eid) | 1603 | xs_dict *msg_emoji_init(snac *snac, const char *mid, const char *eid_o) |
| 1604 | /* creates an emoji reaction from a local user */ | 1604 | /* creates an emoji reaction from a local user */ |
| 1605 | { | 1605 | { |
| 1606 | xs_dict *n_msg = msg_admiration(snac, mid, "EmojiReact"); | 1606 | xs_dict *n_msg = msg_admiration(snac, mid, "EmojiReact"); |
| 1607 | 1607 | ||
| 1608 | eid = xs_strip_chars_i(xs_dup(eid), ":"); | 1608 | xs *eid = xs_strip_chars_i(xs_dup(eid_o), ":"); |
| 1609 | xs *content = NULL; | 1609 | xs *content = NULL; |
| 1610 | xs *tag = xs_list_new(); | 1610 | xs *tag = xs_list_new(); |
| 1611 | xs *dict = xs_dict_new(); | 1611 | xs *dict = xs_dict_new(); |
| 1612 | xs *icon = xs_dict_new(); | 1612 | xs *icon = xs_dict_new(); |
| 1613 | xs *accounts = xs_list_new(); | 1613 | xs *accounts = xs_list_new(); |
| 1614 | xs *emjs = emojis(); | ||
| 1614 | 1615 | ||
| 1615 | /* may be a default emoji */ | 1616 | /* may be a default emoji */ |
| 1616 | xs *eidd = xs_dup(eid); | 1617 | xs *eidd = xs_dup(eid); |
| @@ -1625,15 +1626,18 @@ xs_dict *msg_emoji_init(snac *snac, const char *mid, const char *eid) | |||
| 1625 | return NULL; | 1626 | return NULL; |
| 1626 | } | 1627 | } |
| 1627 | } | 1628 | } |
| 1628 | else if (xs_dict_get(emojis(), xs_fmt(":%s:", eid)) == NULL) | ||
| 1629 | return NULL; | ||
| 1630 | else { | 1629 | else { |
| 1631 | content = xs_fmt(":%s:", eid); | 1630 | content = xs_fmt(":%s:", eid); |
| 1631 | const char *url = xs_dict_get(emjs, content); | ||
| 1632 | |||
| 1633 | if (url == NULL) | ||
| 1634 | return NULL; | ||
| 1635 | |||
| 1632 | icon = xs_dict_set(icon, "type", "Image"); | 1636 | icon = xs_dict_set(icon, "type", "Image"); |
| 1633 | icon = xs_dict_set(icon, "url", xs_fmt("%s/s/%s.png", snac->actor, eid)); | 1637 | icon = xs_dict_set(icon, "url", url); |
| 1634 | dict = xs_dict_set(dict, "icon", icon); | 1638 | dict = xs_dict_set(dict, "icon", icon); |
| 1635 | 1639 | ||
| 1636 | dict = xs_dict_set(dict, "id", xs_fmt("%s/s/%s.png", snac->actor, eid)); | 1640 | dict = xs_dict_set(dict, "id", url); |
| 1637 | dict = xs_dict_set(dict, "name", content); | 1641 | dict = xs_dict_set(dict, "name", content); |
| 1638 | dict = xs_dict_set(dict, "type", "Emoji"); | 1642 | dict = xs_dict_set(dict, "type", "Emoji"); |
| 1639 | tag = xs_list_append(tag, dict); | 1643 | tag = xs_list_append(tag, dict); |