summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'html.c')
-rw-r--r--html.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/html.c b/html.c
index bf71710..37a884f 100644
--- a/html.c
+++ b/html.c
@@ -815,6 +815,12 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
815 /* add the ballot box emoji */ 815 /* add the ballot box emoji */
816 xs *f = xs_fmt("<span title=\"%s\"> &#128499; </span>", L("Poll")); 816 xs *f = xs_fmt("<span title=\"%s\"> &#128499; </span>", L("Poll"));
817 s = xs_str_cat(s, f); 817 s = xs_str_cat(s, f);
818
819 if (was_question_voted(snac, id)) {
820 /* add a check to show this poll was voted */
821 xs *f2 = xs_fmt("<span title=\"%s\"> &#10003; </span>", L("Voted"));
822 s = xs_str_cat(s, f2);
823 }
818 } 824 }
819 825
820 /* if this is our post, add the score */ 826 /* if this is our post, add the score */
@@ -1049,6 +1055,10 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
1049 1055
1050 if ((attach = xs_dict_get(msg, "attachment")) != NULL) { /** **/ 1056 if ((attach = xs_dict_get(msg, "attachment")) != NULL) { /** **/
1051 char *v; 1057 char *v;
1058
1059 /* make custom css for attachments easier */
1060 s = xs_str_cat(s, "<p class=\"snac-content-attachments\">\n");
1061
1052 while (xs_list_iter(&attach, &v)) { 1062 while (xs_list_iter(&attach, &v)) {
1053 char *t = xs_dict_get(v, "mediaType"); 1063 char *t = xs_dict_get(v, "mediaType");
1054 1064
@@ -1060,8 +1070,9 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
1060 char *name = xs_dict_get(v, "name"); 1070 char *name = xs_dict_get(v, "name");
1061 1071
1062 if (url != NULL) { 1072 if (url != NULL) {
1063 xs *s1 = xs_fmt("<p><img src=\"%s\" alt=\"%s\" loading=\"lazy\"/></p>\n", 1073 xs *s1 = xs_fmt(
1064 url, xs_is_null(name) ? "" : name); 1074 "<a href=\"%s\" target=\"_blank\"><img src=\"%s\" alt=\"%s\" loading=\"lazy\"/></a>\n",
1075 url, url, xs_is_null(name) ? "" : name);
1065 1076
1066 s = xs_str_cat(s, s1); 1077 s = xs_str_cat(s, s1);
1067 } 1078 }
@@ -1071,12 +1082,14 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
1071 char *url = xs_dict_get(v, "url"); 1082 char *url = xs_dict_get(v, "url");
1072 1083
1073 if (url != NULL) { 1084 if (url != NULL) {
1074 xs *s1 = xs_fmt("<p><object data=\"%s\"></object></p>\n", url); 1085 xs *s1 = xs_fmt("<object data=\"%s\"></object>\n", url);
1075 1086
1076 s = xs_str_cat(s, s1); 1087 s = xs_str_cat(s, s1);
1077 } 1088 }
1078 } 1089 }
1079 } 1090 }
1091
1092 s = xs_str_cat(s, "</p>\n");
1080 } 1093 }
1081 1094
1082 if (sensitive) 1095 if (sensitive)