commit a6dce99
default
·
2025-01-08 16:24:41 +0000 UTC
parent b510858
Do a lower case search of hashtags in the content.
1 files changed,
+5,
-6
M
html.c
M
html.c
+5,
-6
1@@ -2193,7 +2193,8 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2 /* show all hashtags that has not been shown previously in the content */
3 const xs_list *tags = xs_dict_get(msg, "tag");
4 if (xs_type(tags) == XSTYPE_LIST && xs_list_len(tags)) {
5- const char *content = xs_dict_get(msg, "content");
6+ const char *o_content = xs_dict_get(msg, "content");
7+ xs *content = xs_utf8_to_lower(o_content);
8 const xs_dict *tag;
9
10 xs_html *add_hashtags = xs_html_tag("ul",
11@@ -2203,12 +2204,10 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
12 const char *type = xs_dict_get(tag, "type");
13
14 if (xs_type(type) == XSTYPE_STRING && strcmp(type, "Hashtag") == 0) {
15- const char *href = xs_dict_get(tag, "href");
16- xs *lc_href = xs_utf8_to_lower(href);
17+ const char *o_href = xs_dict_get(tag, "href");
18+ xs *href = xs_utf8_to_lower(o_href);
19
20- if (xs_type(href) == XSTYPE_STRING &&
21- xs_str_in(content, href) == -1 &&
22- xs_str_in(content, lc_href) == -1) {
23+ if (xs_type(href) == XSTYPE_STRING && xs_str_in(content, href) == -1) {
24 /* not in the content: add here */
25 const char *name = xs_dict_get(tag, "name");
26