diff options
| author | 2025-01-20 09:17:57 +0100 | |
|---|---|---|
| committer | 2025-01-20 09:17:57 +0100 | |
| commit | b4add138e10410fc4aeedea50a6de7ebead2f710 (patch) | |
| tree | d4df7a63ee3b134558ffba94499872da827e5a08 | |
| parent | Added the USER_AGENT to HTTP errors. (diff) | |
| download | penes-snac2-b4add138e10410fc4aeedea50a6de7ebead2f710.tar.gz penes-snac2-b4add138e10410fc4aeedea50a6de7ebead2f710.tar.xz penes-snac2-b4add138e10410fc4aeedea50a6de7ebead2f710.zip | |
Show the post language under the date 'title'.
| -rw-r--r-- | html.c | 25 |
1 files changed, 20 insertions, 5 deletions
| @@ -114,7 +114,8 @@ xs_str *actor_name(xs_dict *actor, const char *proxy) | |||
| 114 | 114 | ||
| 115 | 115 | ||
| 116 | xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date, | 116 | xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date, |
| 117 | const char *udate, const char *url, int priv, int in_people, const char *proxy) | 117 | const char *udate, const char *url, int priv, |
| 118 | int in_people, const char *proxy, const char *lang) | ||
| 118 | { | 119 | { |
| 119 | xs_html *actor_icon = xs_html_tag("p", NULL); | 120 | xs_html *actor_icon = xs_html_tag("p", NULL); |
| 120 | 121 | ||
| @@ -220,6 +221,9 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date, | |||
| 220 | date_title = xs_str_cat(date_title, " / ", udate); | 221 | date_title = xs_str_cat(date_title, " / ", udate); |
| 221 | } | 222 | } |
| 222 | 223 | ||
| 224 | if (xs_is_string(lang)) | ||
| 225 | date_title = xs_str_cat(date_title, " (", lang, ")"); | ||
| 226 | |||
| 223 | xs_html_add(actor_icon, | 227 | xs_html_add(actor_icon, |
| 224 | xs_html_text(" "), | 228 | xs_html_text(" "), |
| 225 | xs_html_tag("time", | 229 | xs_html_tag("time", |
| @@ -266,6 +270,7 @@ xs_html *html_msg_icon(snac *user, const char *actor_id, const xs_dict *msg, con | |||
| 266 | const char *date = NULL; | 270 | const char *date = NULL; |
| 267 | const char *udate = NULL; | 271 | const char *udate = NULL; |
| 268 | const char *url = NULL; | 272 | const char *url = NULL; |
| 273 | const char *lang = NULL; | ||
| 269 | int priv = 0; | 274 | int priv = 0; |
| 270 | const char *type = xs_dict_get(msg, "type"); | 275 | const char *type = xs_dict_get(msg, "type"); |
| 271 | 276 | ||
| @@ -277,7 +282,17 @@ xs_html *html_msg_icon(snac *user, const char *actor_id, const xs_dict *msg, con | |||
| 277 | date = xs_dict_get(msg, "published"); | 282 | date = xs_dict_get(msg, "published"); |
| 278 | udate = xs_dict_get(msg, "updated"); | 283 | udate = xs_dict_get(msg, "updated"); |
| 279 | 284 | ||
| 280 | actor_icon = html_actor_icon(user, actor, date, udate, url, priv, 0, proxy); | 285 | lang = xs_dict_get(msg, "contentMap"); |
| 286 | if (xs_is_dict(lang)) { | ||
| 287 | const char *v; | ||
| 288 | int c = 0; | ||
| 289 | |||
| 290 | xs_dict_next(lang, &lang, &v, &c); | ||
| 291 | } | ||
| 292 | else | ||
| 293 | lang = NULL; | ||
| 294 | |||
| 295 | actor_icon = html_actor_icon(user, actor, date, udate, url, priv, 0, proxy, lang); | ||
| 281 | } | 296 | } |
| 282 | 297 | ||
| 283 | return actor_icon; | 298 | return actor_icon; |
| @@ -2769,7 +2784,7 @@ xs_html *html_people_list(snac *snac, xs_list *list, char *header, char *t, cons | |||
| 2769 | xs_html_tag("div", | 2784 | xs_html_tag("div", |
| 2770 | xs_html_attr("class", "snac-post-header"), | 2785 | xs_html_attr("class", "snac-post-header"), |
| 2771 | html_actor_icon(snac, actor, xs_dict_get(actor, "published"), | 2786 | html_actor_icon(snac, actor, xs_dict_get(actor, "published"), |
| 2772 | NULL, NULL, 0, 1, proxy))); | 2787 | NULL, NULL, 0, 1, proxy, NULL))); |
| 2773 | 2788 | ||
| 2774 | /* content (user bio) */ | 2789 | /* content (user bio) */ |
| 2775 | const char *c = xs_dict_get(actor, "summary"); | 2790 | const char *c = xs_dict_get(actor, "summary"); |
| @@ -3022,7 +3037,7 @@ xs_str *html_notifications(snac *user, int skip, int show) | |||
| 3022 | xs_html_add(entry, | 3037 | xs_html_add(entry, |
| 3023 | xs_html_tag("div", | 3038 | xs_html_tag("div", |
| 3024 | xs_html_attr("class", "snac-post"), | 3039 | xs_html_attr("class", "snac-post"), |
| 3025 | html_actor_icon(user, actor, NULL, NULL, NULL, 0, 0, proxy))); | 3040 | html_actor_icon(user, actor, NULL, NULL, NULL, 0, 0, proxy, NULL))); |
| 3026 | } | 3041 | } |
| 3027 | else | 3042 | else |
| 3028 | if (strcmp(type, "Move") == 0) { | 3043 | if (strcmp(type, "Move") == 0) { |
| @@ -3036,7 +3051,7 @@ xs_str *html_notifications(snac *user, int skip, int show) | |||
| 3036 | xs_html_add(entry, | 3051 | xs_html_add(entry, |
| 3037 | xs_html_tag("div", | 3052 | xs_html_tag("div", |
| 3038 | xs_html_attr("class", "snac-post"), | 3053 | xs_html_attr("class", "snac-post"), |
| 3039 | html_actor_icon(user, old_actor, NULL, NULL, NULL, 0, 0, proxy))); | 3054 | html_actor_icon(user, old_actor, NULL, NULL, NULL, 0, 0, proxy, NULL))); |
| 3040 | } | 3055 | } |
| 3041 | } | 3056 | } |
| 3042 | } | 3057 | } |