From 2a8d34a833d15760de97943192b634c53f556a90 Mon Sep 17 00:00:00 2001 From: Haijo7 Date: Fri, 2 Jun 2023 09:43:49 +0200 Subject: [PATCH] open image in new tab when clicked, add css class for attachments --- html.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/html.c b/html.c index fb9dd11..695f853 100644 --- a/html.c +++ b/html.c @@ -1055,6 +1055,10 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, if ((attach = xs_dict_get(msg, "attachment")) != NULL) { /** **/ char *v; + + /* make custom css for attachments easier */ + s = xs_str_cat(s, "

\n"); + while (xs_list_iter(&attach, &v)) { char *t = xs_dict_get(v, "mediaType"); @@ -1066,8 +1070,9 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, char *name = xs_dict_get(v, "name"); if (url != NULL) { - xs *s1 = xs_fmt("

\"%s\"

\n", - url, xs_is_null(name) ? "" : name); + xs *s1 = xs_fmt( + "\"%s\"\n", + url, url, xs_is_null(name) ? "" : name); s = xs_str_cat(s, s1); } @@ -1077,12 +1082,14 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, char *url = xs_dict_get(v, "url"); if (url != NULL) { - xs *s1 = xs_fmt("

\n", url); + xs *s1 = xs_fmt("\n", url); s = xs_str_cat(s, s1); } } } + + s = xs_str_cat(s, "

\n"); } if (sensitive)