summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-11-27 21:41:43 +0100
committerGravatar default2023-11-27 21:41:43 +0100
commitae121bbce18b41070096d320c1c9bf46000aa956 (patch)
treef0e783f856d29380d244a956d0944c3c67d50677
parentSome html_entry() refactoring. (diff)
downloadsnac2-ae121bbce18b41070096d320c1c9bf46000aa956.tar.gz
snac2-ae121bbce18b41070096d320c1c9bf46000aa956.tar.xz
snac2-ae121bbce18b41070096d320c1c9bf46000aa956.zip
More html_entry() refactoring.
-rw-r--r--html.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/html.c b/html.c
index d6b14a4..976cd35 100644
--- a/html.c
+++ b/html.c
@@ -1020,7 +1020,7 @@ xs_html *html_top_controls(snac *snac)
1020 xs_html_attr("name", "passwd2"), 1020 xs_html_attr("name", "passwd2"),
1021 xs_html_attr("value", ""))), 1021 xs_html_attr("value", ""))),
1022 1022
1023 xs_html_tag("input", 1023 xs_html_sctag("input",
1024 xs_html_attr("type", "submit"), 1024 xs_html_attr("type", "submit"),
1025 xs_html_attr("class", "button"), 1025 xs_html_attr("class", "button"),
1026 xs_html_attr("value", L("Update user info"))))))); 1026 xs_html_attr("value", L("Update user info")))))));
@@ -1354,13 +1354,15 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local,
1354 1354
1355 if (user && xs_list_in(boosts, user->md5) != -1) { 1355 if (user && xs_list_in(boosts, user->md5) != -1) {
1356 /* we boosted this */ 1356 /* we boosted this */
1357 xs *es1 = encode_html(xs_dict_get(user->config, "name")); 1357 xs_html *h = xs_html_tag("div",
1358 xs *s1 = xs_fmt( 1358 xs_html_attr("class", "snac-origin"),
1359 "<div class=\"snac-origin\">" 1359 xs_html_tag("a",
1360 "<a href=\"%s\">%s</a> %s</div>", 1360 xs_html_attr("href", user->actor),
1361 user->actor, es1, L("boosted") 1361 xs_html_text(xs_dict_get(user->config, "name"))),
1362 ); 1362 xs_html_text(" "),
1363 xs_html_text(L("boosted")));
1363 1364
1365 xs *s1 = xs_html_render(h);
1364 s = xs_str_cat(s, s1); 1366 s = xs_str_cat(s, s1);
1365 } 1367 }
1366 else 1368 else
@@ -1368,13 +1370,15 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local,
1368 xs *name = actor_name(actor_r); 1370 xs *name = actor_name(actor_r);
1369 1371
1370 if (!xs_is_null(name)) { 1372 if (!xs_is_null(name)) {
1371 xs *s1 = xs_fmt( 1373 xs_html *h = xs_html_tag("div",
1372 "<div class=\"snac-origin\">" 1374 xs_html_attr("class", "snac-origin"),
1373 "<a href=\"%s\">%s</a> %s</div>\n", 1375 xs_html_tag("a",
1374 xs_dict_get(actor_r, "id"), 1376 xs_html_attr("href", xs_dict_get(actor_r, "id")),
1375 name, 1377 xs_html_text(name)),
1376 L("boosted") 1378 xs_html_text(" "),
1377 ); 1379 xs_html_text(L("boosted")));
1380
1381 xs *s1 = xs_html_render(h);
1378 1382
1379 s = xs_str_cat(s, s1); 1383 s = xs_str_cat(s, s1);
1380 } 1384 }
@@ -1387,11 +1391,15 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local,
1387 char *parent = xs_dict_get(msg, "inReplyTo"); 1391 char *parent = xs_dict_get(msg, "inReplyTo");
1388 1392
1389 if (user && !xs_is_null(parent) && *parent && !timeline_here(user, parent)) { 1393 if (user && !xs_is_null(parent) && *parent && !timeline_here(user, parent)) {
1390 xs *s1 = xs_fmt( 1394 xs_html *h = xs_html_tag("div",
1391 "<div class=\"snac-origin\">%s " 1395 xs_html_attr("class", "snac-origin"),
1392 "<a href=\"%s\">»</a></div>\n", 1396 xs_html_text(L("in reply to")),
1393 L("in reply to"), parent 1397 xs_html_text(" "),
1394 ); 1398 xs_html_tag("a",
1399 xs_html_attr("href", parent),
1400 xs_html_text("»")));
1401
1402 xs *s1 = xs_html_render(h);
1395 1403
1396 s = xs_str_cat(s, s1); 1404 s = xs_str_cat(s, s1);
1397 } 1405 }