aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2025-01-08 17:24:41 +0100
committerdefault <nobody@localhost>2025-01-08 17:24:41 +0100
commita6dce9953889156b485405c7de2bd954587b2ddc (patch)
treeda472d3df10476fddaf7902056de119cb9aed812
parentb51085831e40dbcbd5ff80e033c1b59702cbc920 (diff)
Do a lower case search of hashtags in the content.
-rw-r--r--html.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/html.c b/html.c
index bade62a..7c46c76 100644
--- a/html.c
+++ b/html.c
@@ -2193,7 +2193,8 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
/* show all hashtags that has not been shown previously in the content */
const xs_list *tags = xs_dict_get(msg, "tag");
if (xs_type(tags) == XSTYPE_LIST && xs_list_len(tags)) {
- const char *content = xs_dict_get(msg, "content");
+ const char *o_content = xs_dict_get(msg, "content");
+ xs *content = xs_utf8_to_lower(o_content);
const xs_dict *tag;
xs_html *add_hashtags = xs_html_tag("ul",
@@ -2203,12 +2204,10 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
const char *type = xs_dict_get(tag, "type");
if (xs_type(type) == XSTYPE_STRING && strcmp(type, "Hashtag") == 0) {
- const char *href = xs_dict_get(tag, "href");
- xs *lc_href = xs_utf8_to_lower(href);
+ const char *o_href = xs_dict_get(tag, "href");
+ xs *href = xs_utf8_to_lower(o_href);
- if (xs_type(href) == XSTYPE_STRING &&
- xs_str_in(content, href) == -1 &&
- xs_str_in(content, lc_href) == -1) {
+ if (xs_type(href) == XSTYPE_STRING && xs_str_in(content, href) == -1) {
/* not in the content: add here */
const char *name = xs_dict_get(tag, "name");