aboutsummaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'html.c')
-rw-r--r--html.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/html.c b/html.c
index 78a9854..abb8562 100644
--- a/html.c
+++ b/html.c
@@ -72,6 +72,9 @@ xs_str *replace_shortnames(xs_str *s, const xs_list *tag, int ems, const char *p
const xs_dict *v;
int c = 0;
+ xs_set rep_emoji;
+ xs_set_init(&rep_emoji);
+
while (xs_list_next(tag_list, &v, &c)) {
const char *t = xs_dict_get(v, "type");
@@ -79,6 +82,10 @@ xs_str *replace_shortnames(xs_str *s, const xs_list *tag, int ems, const char *p
const char *n = xs_dict_get(v, "name");
const xs_dict *i = xs_dict_get(v, "icon");
+ /* avoid repeated emojis (Misskey seems to return this) */
+ if (xs_set_add(&rep_emoji, n) == 0)
+ continue;
+
if (xs_is_string(n) && xs_is_dict(i)) {
const char *u = xs_dict_get(i, "url");
const char *mt = xs_dict_get(i, "mediaType");
@@ -104,6 +111,8 @@ xs_str *replace_shortnames(xs_str *s, const xs_list *tag, int ems, const char *p
}
}
}
+
+ xs_set_free(&rep_emoji);
}
return s;