summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'html.c')
-rw-r--r--html.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/html.c b/html.c
index 6a5aa10..322bafa 100644
--- a/html.c
+++ b/html.c
@@ -2317,8 +2317,9 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2317 2317
2318 /* show all hashtags that has not been shown previously in the content */ 2318 /* show all hashtags that has not been shown previously in the content */
2319 const xs_list *tags = xs_dict_get(msg, "tag"); 2319 const xs_list *tags = xs_dict_get(msg, "tag");
2320 if (xs_type(tags) == XSTYPE_LIST && xs_list_len(tags)) { 2320 const char *o_content = xs_dict_get_def(msg, "content", "");
2321 const char *o_content = xs_dict_get_def(msg, "content", ""); 2321
2322 if (xs_is_string(o_content) && xs_is_list(tags) && xs_list_len(tags)) {
2322 xs *content = xs_utf8_to_lower(o_content); 2323 xs *content = xs_utf8_to_lower(o_content);
2323 const xs_dict *tag; 2324 const xs_dict *tag;
2324 2325
@@ -2328,16 +2329,15 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2328 xs_list_foreach(tags, tag) { 2329 xs_list_foreach(tags, tag) {
2329 const char *type = xs_dict_get(tag, "type"); 2330 const char *type = xs_dict_get(tag, "type");
2330 2331
2331 if (xs_type(type) == XSTYPE_STRING && strcmp(type, "Hashtag") == 0) { 2332 if (xs_is_string(type) && strcmp(type, "Hashtag") == 0) {
2332 const char *o_href = xs_dict_get(tag, "href"); 2333 const char *o_href = xs_dict_get(tag, "href");
2334 const char *name = xs_dict_get(tag, "name");
2333 2335
2334 if (xs_type(o_href) == XSTYPE_STRING) { 2336 if (xs_is_string(o_href) && xs_is_string(name)) {
2335 xs *href = xs_utf8_to_lower(o_href); 2337 xs *href = xs_utf8_to_lower(o_href);
2336 2338
2337 if (xs_str_in(content, href) == -1) { 2339 if (xs_str_in(content, href) == -1 && xs_str_in(content, name) == -1) {
2338 /* not in the content: add here */ 2340 /* not in the content: add here */
2339 const char *name = xs_dict_get(tag, "name");
2340
2341 xs_html_add(add_hashtags, 2341 xs_html_add(add_hashtags,
2342 xs_html_tag("li", 2342 xs_html_tag("li",
2343 xs_html_tag("a", 2343 xs_html_tag("a",