commit b4add13
default
·
2025-01-20 08:17:57 +0000 UTC
parent 202d99c
Show the post language under the date 'title'.
1 files changed,
+20,
-5
M
html.c
M
html.c
+20,
-5
1@@ -114,7 +114,8 @@ xs_str *actor_name(xs_dict *actor, const char *proxy)
2
3
4 xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
5- const char *udate, const char *url, int priv, int in_people, const char *proxy)
6+ const char *udate, const char *url, int priv,
7+ int in_people, const char *proxy, const char *lang)
8 {
9 xs_html *actor_icon = xs_html_tag("p", NULL);
10
11@@ -220,6 +221,9 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
12 date_title = xs_str_cat(date_title, " / ", udate);
13 }
14
15+ if (xs_is_string(lang))
16+ date_title = xs_str_cat(date_title, " (", lang, ")");
17+
18 xs_html_add(actor_icon,
19 xs_html_text(" "),
20 xs_html_tag("time",
21@@ -266,6 +270,7 @@ xs_html *html_msg_icon(snac *user, const char *actor_id, const xs_dict *msg, con
22 const char *date = NULL;
23 const char *udate = NULL;
24 const char *url = NULL;
25+ const char *lang = NULL;
26 int priv = 0;
27 const char *type = xs_dict_get(msg, "type");
28
29@@ -277,7 +282,17 @@ xs_html *html_msg_icon(snac *user, const char *actor_id, const xs_dict *msg, con
30 date = xs_dict_get(msg, "published");
31 udate = xs_dict_get(msg, "updated");
32
33- actor_icon = html_actor_icon(user, actor, date, udate, url, priv, 0, proxy);
34+ lang = xs_dict_get(msg, "contentMap");
35+ if (xs_is_dict(lang)) {
36+ const char *v;
37+ int c = 0;
38+
39+ xs_dict_next(lang, &lang, &v, &c);
40+ }
41+ else
42+ lang = NULL;
43+
44+ actor_icon = html_actor_icon(user, actor, date, udate, url, priv, 0, proxy, lang);
45 }
46
47 return actor_icon;
48@@ -2769,7 +2784,7 @@ xs_html *html_people_list(snac *snac, xs_list *list, char *header, char *t, cons
49 xs_html_tag("div",
50 xs_html_attr("class", "snac-post-header"),
51 html_actor_icon(snac, actor, xs_dict_get(actor, "published"),
52- NULL, NULL, 0, 1, proxy)));
53+ NULL, NULL, 0, 1, proxy, NULL)));
54
55 /* content (user bio) */
56 const char *c = xs_dict_get(actor, "summary");
57@@ -3022,7 +3037,7 @@ xs_str *html_notifications(snac *user, int skip, int show)
58 xs_html_add(entry,
59 xs_html_tag("div",
60 xs_html_attr("class", "snac-post"),
61- html_actor_icon(user, actor, NULL, NULL, NULL, 0, 0, proxy)));
62+ html_actor_icon(user, actor, NULL, NULL, NULL, 0, 0, proxy, NULL)));
63 }
64 else
65 if (strcmp(type, "Move") == 0) {
66@@ -3036,7 +3051,7 @@ xs_str *html_notifications(snac *user, int skip, int show)
67 xs_html_add(entry,
68 xs_html_tag("div",
69 xs_html_attr("class", "snac-post"),
70- html_actor_icon(user, old_actor, NULL, NULL, NULL, 0, 0, proxy)));
71+ html_actor_icon(user, old_actor, NULL, NULL, NULL, 0, 0, proxy, NULL)));
72 }
73 }
74 }