diff options
| author | 2023-11-20 19:47:41 +0100 | |
|---|---|---|
| committer | 2023-11-20 19:47:41 +0100 | |
| commit | 4fe2ccd67024afebda5c355243b9a109f4782309 (patch) | |
| tree | d345c4c2c8ad86beb8447175a43d181db632b444 | |
| parent | The RSS is created using xs_html. (diff) | |
| download | snac2-4fe2ccd67024afebda5c355243b9a109f4782309.tar.gz snac2-4fe2ccd67024afebda5c355243b9a109f4782309.tar.xz snac2-4fe2ccd67024afebda5c355243b9a109f4782309.zip | |
html_actor_icon() returns an xs_str instead of adding to another one.
| -rw-r--r-- | html.c | 22 |
1 files changed, 12 insertions, 10 deletions
| @@ -92,10 +92,10 @@ xs_str *actor_name(xs_dict *actor) | |||
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | 94 | ||
| 95 | xs_str *html_actor_icon(xs_str *os, char *actor, | 95 | xs_str *html_actor_icon(xs_dict *actor, const char *date, |
| 96 | const char *date, const char *udate, const char *url, int priv) | 96 | const char *udate, const char *url, int priv) |
| 97 | { | 97 | { |
| 98 | xs *s = xs_str_new(NULL); | 98 | xs_str *s = xs_str_new(NULL); |
| 99 | 99 | ||
| 100 | xs *avatar = NULL; | 100 | xs *avatar = NULL; |
| 101 | char *v; | 101 | char *v; |
| @@ -184,7 +184,7 @@ xs_str *html_actor_icon(xs_str *os, char *actor, | |||
| 184 | s = xs_str_cat(s, s1); | 184 | s = xs_str_cat(s, s1); |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | return xs_str_cat(os, s); | 187 | return s; |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | 190 | ||
| @@ -211,7 +211,8 @@ xs_str *html_msg_icon(xs_str *os, const xs_dict *msg) | |||
| 211 | date = xs_dict_get(msg, "published"); | 211 | date = xs_dict_get(msg, "published"); |
| 212 | udate = xs_dict_get(msg, "updated"); | 212 | udate = xs_dict_get(msg, "updated"); |
| 213 | 213 | ||
| 214 | os = html_actor_icon(os, actor, date, udate, url, priv); | 214 | xs *s1 = html_actor_icon(actor, date, udate, url, priv); |
| 215 | os = xs_str_cat(os, s1); | ||
| 215 | } | 216 | } |
| 216 | 217 | ||
| 217 | return os; | 218 | return os; |
| @@ -1692,9 +1693,10 @@ xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *head | |||
| 1692 | if (valid_status(actor_get(actor_id, &actor))) { | 1693 | if (valid_status(actor_get(actor_id, &actor))) { |
| 1693 | s = xs_str_cat(s, "<div class=\"snac-post\">\n<div class=\"snac-post-header\">\n"); | 1694 | s = xs_str_cat(s, "<div class=\"snac-post\">\n<div class=\"snac-post-header\">\n"); |
| 1694 | 1695 | ||
| 1695 | s = html_actor_icon(s, actor, xs_dict_get(actor, "published"), NULL, NULL, 0); | 1696 | { |
| 1696 | 1697 | xs *s1 = html_actor_icon(actor, xs_dict_get(actor, "published"), NULL, NULL, 0); | |
| 1697 | s = xs_str_cat(s, "</div>\n"); | 1698 | s = xs_str_cat(s, s1, "</div>\n"); |
| 1699 | } | ||
| 1698 | 1700 | ||
| 1699 | /* content (user bio) */ | 1701 | /* content (user bio) */ |
| 1700 | char *c = xs_dict_get(actor, "summary"); | 1702 | char *c = xs_dict_get(actor, "summary"); |
| @@ -1898,9 +1900,9 @@ xs_str *html_notifications(snac *snac) | |||
| 1898 | if (strcmp(type, "Follow") == 0 || strcmp(utype, "Follow") == 0) { | 1900 | if (strcmp(type, "Follow") == 0 || strcmp(utype, "Follow") == 0) { |
| 1899 | s = xs_str_cat(s, "<div class=\"snac-post\">\n"); | 1901 | s = xs_str_cat(s, "<div class=\"snac-post\">\n"); |
| 1900 | 1902 | ||
| 1901 | s = html_actor_icon(s, actor, NULL, NULL, NULL, 0); | 1903 | xs *s1 = html_actor_icon(actor, NULL, NULL, NULL, 0); |
| 1902 | 1904 | ||
| 1903 | s = xs_str_cat(s, "</div>\n"); | 1905 | s = xs_str_cat(s, s1, "</div>\n"); |
| 1904 | } | 1906 | } |
| 1905 | else { | 1907 | else { |
| 1906 | xs *md5 = xs_md5_hex(id, strlen(id)); | 1908 | xs *md5 = xs_md5_hex(id, strlen(id)); |