commit d00ee22
default
·
2023-11-28 17:56:06 +0000 UTC
parent 6821d3d
More html_entry() tweaks.
1 files changed,
+8,
-5
M
html.c
M
html.c
+8,
-5
1@@ -1639,9 +1639,11 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local,
2 #endif
3
4 {
5- const char *content = xs_dict_get(msg, "content");
6+ /** build the content string **/
7
8- xs *c = sanitize(xs_is_null(content) ? "" : content);
9+ char *content = xs_dict_get(msg, "content");
10+
11+ xs *c = sanitize(xs_is_null(content) ? "" : content);
12 char *p, *v;
13
14 /* do some tweaks to the content */
15@@ -1693,6 +1695,9 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local,
16 }
17 }
18
19+ /* c contains sanitized HTML */
20+ s = xs_str_cat(s, c);
21+
22 if (strcmp(type, "Question") == 0) { /** question content **/
23 xs_list *oo = xs_dict_get(msg, "oneOf");
24 xs_list *ao = xs_dict_get(msg, "anyOf");
25@@ -1821,10 +1826,8 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local,
26 }
27
28 xs *s1 = xs_html_render(poll);
29- c = xs_str_cat(c, s1);
30+ s = xs_str_cat(s, s1);
31 }
32-
33- s = xs_str_cat(s, c);
34 }
35
36 s = xs_str_cat(s, "\n");