summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/html.c b/html.c
index e8803ab..d1844c2 100644
--- a/html.c
+++ b/html.c
@@ -2189,6 +2189,39 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2189 au_tag); 2189 au_tag);
2190 } 2190 }
2191 2191
2192 /* show all hashtags that has not been shown previously in the content */
2193 const xs_list *tags = xs_dict_get(msg, "tag");
2194 if (xs_type(tags) == XSTYPE_LIST && xs_list_len(tags)) {
2195 const char *content = xs_dict_get(msg, "content");
2196 const xs_dict *tag;
2197
2198 xs_html *add_hashtags = xs_html_tag("ul",
2199 xs_html_attr("class", "snac-more-hashtags"));
2200
2201 xs_list_foreach(tags, tag) {
2202 const char *type = xs_dict_get(tag, "type");
2203
2204 if (xs_type(type) == XSTYPE_STRING && strcmp(type, "Hashtag") == 0) {
2205 const char *href = xs_dict_get(tag, "href");
2206
2207 if (xs_type(href) == XSTYPE_STRING && xs_str_in(content, href) == -1) {
2208 /* not in the content: add here */
2209 const char *name = xs_dict_get(tag, "name");
2210
2211 xs_html_add(add_hashtags,
2212 xs_html_tag("li",
2213 xs_html_tag("a",
2214 xs_html_attr("href", href),
2215 xs_html_text(name),
2216 xs_html_text(" "))));
2217 }
2218 }
2219 }
2220
2221 xs_html_add(snac_content_wrap,
2222 add_hashtags);
2223 }
2224
2192 /** controls **/ 2225 /** controls **/
2193 2226
2194 if (!read_only && user) { 2227 if (!read_only && user) {