snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit b51085831e40dbcbd5ff80e033c1b59702cbc920
parent 932227bbac7fe740bff1e38bf92b58edef19e32f
Author: default <nobody@localhost>
Date:   Wed,  8 Jan 2025 17:20:53 +0100

Also check for the lowecase URL of the hashtags.

Diffstat:
MMakefile | 3++-
MMakefile.NetBSD | 3++-
Mhtml.c | 6+++++-
3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile @@ -42,7 +42,8 @@ data.o: data.c xs.h xs_hex.h xs_io.h xs_json.h xs_openssl.h xs_glob.h \ format.o: format.c xs.h xs_regex.h xs_mime.h xs_html.h xs_json.h \ xs_time.h xs_match.h snac.h http_codes.h html.o: html.c xs.h xs_io.h xs_json.h xs_regex.h xs_set.h xs_openssl.h \ - xs_time.h xs_mime.h xs_match.h xs_html.h xs_curl.h snac.h http_codes.h + xs_time.h xs_mime.h xs_match.h xs_html.h xs_curl.h xs_unicode.h snac.h \ + http_codes.h http.o: http.c xs.h xs_io.h xs_openssl.h xs_curl.h xs_time.h xs_json.h \ snac.h http_codes.h httpd.o: httpd.c xs.h xs_io.h xs_json.h xs_socket.h xs_unix_socket.h \ diff --git a/Makefile.NetBSD b/Makefile.NetBSD @@ -44,7 +44,8 @@ data.o: data.c xs.h xs_hex.h xs_io.h xs_json.h xs_openssl.h xs_glob.h \ format.o: format.c xs.h xs_regex.h xs_mime.h xs_html.h xs_json.h \ xs_time.h xs_match.h snac.h http_codes.h html.o: html.c xs.h xs_io.h xs_json.h xs_regex.h xs_set.h xs_openssl.h \ - xs_time.h xs_mime.h xs_match.h xs_html.h xs_curl.h snac.h http_codes.h + xs_time.h xs_mime.h xs_match.h xs_html.h xs_curl.h xs_unicode.h snac.h \ + http_codes.h http.o: http.c xs.h xs_io.h xs_openssl.h xs_curl.h xs_time.h xs_json.h \ snac.h http_codes.h httpd.o: httpd.c xs.h xs_io.h xs_json.h xs_socket.h xs_unix_socket.h \ diff --git a/html.c b/html.c @@ -12,6 +12,7 @@ #include "xs_match.h" #include "xs_html.h" #include "xs_curl.h" +#include "xs_unicode.h" #include "snac.h" @@ -2203,8 +2204,11 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, 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); - if (xs_type(href) == XSTYPE_STRING && xs_str_in(content, href) == -1) { + if (xs_type(href) == XSTYPE_STRING && + xs_str_in(content, href) == -1 && + xs_str_in(content, lc_href) == -1) { /* not in the content: add here */ const char *name = xs_dict_get(tag, "name");