summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorGravatar grunfink2025-12-18 08:13:54 +0100
committerGravatar grunfink2025-12-18 08:13:54 +0100
commitce667add2cfedcc6d57c521899dfb9d2e3e6e1d7 (patch)
treece35e8985e7ac62071ead816714cf48cadcab029 /html.c
parentFixed some xs_dup() leaks. (diff)
downloadsnac2-ce667add2cfedcc6d57c521899dfb9d2e3e6e1d7.tar.gz
snac2-ce667add2cfedcc6d57c521899dfb9d2e3e6e1d7.tar.xz
snac2-ce667add2cfedcc6d57c521899dfb9d2e3e6e1d7.zip
Fixed some xs_join() uses.
Diffstat (limited to 'html.c')
-rw-r--r--html.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/html.c b/html.c
index dae84b7..6ee0707 100644
--- a/html.c
+++ b/html.c
@@ -72,8 +72,10 @@ xs_str *_replace_shortnames(xs_str *s, const xs_list *tag, int ems,
72 72
73 xs *style = xs_fmt("max-height: %dem; max-width: %dem;", ems, ems); 73 xs *style = xs_fmt("max-height: %dem; max-width: %dem;", ems, ems);
74 xs *class = xs_fmt("snac-emoji snac-emoji-%d-em", ems); 74 xs *class = xs_fmt("snac-emoji snac-emoji-%d-em", ems);
75 if (cl) 75 if (cl) {
76 class = xs_str_cat(class, " ", xs_join(cl, " ")); 76 xs *l = xs_join(cl, " ");
77 class = xs_str_cat(class, " ", l);
78 }
77 79
78 int c = 0; 80 int c = 0;
79 const xs_val *v; 81 const xs_val *v;
@@ -2501,9 +2503,10 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2501 if (!xs_is_null(nb)) { 2503 if (!xs_is_null(nb)) {
2502 is_emoji = 1; 2504 is_emoji = 1;
2503 2505
2504 const char *act = atoi(nb) > 1 ? 2506 xs *al = xs_join(actors, ",\n\t");
2505 xs_fmt("%d different actors \n\t%s", atoi(nb), xs_join(actors, ",\n\t")) : 2507 xs *act = atoi(nb) > 1 ?
2506 xs_dict_get(m, "actor"); 2508 xs_fmt("%d different actors \n\t%s", atoi(nb), al) :
2509 xs_dup(xs_dict_get(m, "actor"));
2507 2510
2508 xs *class = xs_list_new(); 2511 xs *class = xs_list_new();
2509 class = xs_list_append(class, "snac-reaction"); 2512 class = xs_list_append(class, "snac-reaction");
@@ -2517,6 +2520,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2517 if (me) 2520 if (me)
2518 class = xs_list_append(class, "snac-reacted"); 2521 class = xs_list_append(class, "snac-reacted");
2519 2522
2523 xs *l1 = xs_join(class, " ");
2520 ret = xs_html_tag("button", 2524 ret = xs_html_tag("button",
2521 xs_html_attr("type", "submit"), 2525 xs_html_attr("type", "submit"),
2522 xs_html_attr("name", "action"), 2526 xs_html_attr("name", "action"),
@@ -2526,7 +2530,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2526 xs_html_raw(nb), 2530 xs_html_raw(nb),
2527 xs_html_attr("style", "padding-left: 5px;")), 2531 xs_html_attr("style", "padding-left: 5px;")),
2528 xs_html_attr("title", act), 2532 xs_html_attr("title", act),
2529 xs_html_attr("class", xs_join(class, " "))); 2533 xs_html_attr("class", l1));
2530 2534
2531 if (!(ide && xs_startswith(ide, srv_baseurl))) 2535 if (!(ide && xs_startswith(ide, srv_baseurl)))
2532 xs_html_add(ret, xs_html_attr("disabled", "true")); 2536 xs_html_add(ret, xs_html_attr("disabled", "true"));
@@ -2540,6 +2544,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2540 const char *style = "font-size: large;"; 2544 const char *style = "font-size: large;";
2541 if (me) 2545 if (me)
2542 class = xs_list_append(class, "snac-reacted"); 2546 class = xs_list_append(class, "snac-reacted");
2547 xs *l1 = xs_join(class, " ");
2543 ret = xs_html_tag("button", 2548 ret = xs_html_tag("button",
2544 xs_html_attr("type", "submit"), 2549 xs_html_attr("type", "submit"),
2545 xs_html_attr("name", "action"), 2550 xs_html_attr("name", "action"),
@@ -2549,7 +2554,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2549 xs_html_raw(nb), 2554 xs_html_raw(nb),
2550 xs_html_attr("style", "font-size: initial; padding-left: 5px;")), 2555 xs_html_attr("style", "font-size: initial; padding-left: 5px;")),
2551 xs_html_attr("title", act), 2556 xs_html_attr("title", act),
2552 xs_html_attr("class", xs_join(class, " ")), 2557 xs_html_attr("class", l1),
2553 xs_html_attr("style", style)); 2558 xs_html_attr("style", style));
2554 } 2559 }
2555 } 2560 }