summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorGravatar default2023-11-23 21:20:10 +0100
committerGravatar default2023-11-23 21:20:10 +0100
commitcac1ce0578892bdf1bc935991207d5edff906e7e (patch)
treee6599e70ae1976082fb36a5dceefd77098b0c6a6 /html.c
parentUse html_note() from html_people_list(). (diff)
downloadsnac2-cac1ce0578892bdf1bc935991207d5edff906e7e.tar.gz
snac2-cac1ce0578892bdf1bc935991207d5edff906e7e.tar.xz
snac2-cac1ce0578892bdf1bc935991207d5edff906e7e.zip
html_people_list() returns an xs_html.
Diffstat (limited to 'html.c')
-rw-r--r--html.c58
1 files changed, 30 insertions, 28 deletions
diff --git a/html.c b/html.c
index 97e7129..c88952c 100644
--- a/html.c
+++ b/html.c
@@ -1848,19 +1848,19 @@ xs_str *html_timeline(snac *user, const xs_list *list, int local,
1848} 1848}
1849 1849
1850 1850
1851xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *header, const char *t) 1851xs_html *html_people_list(snac *snac, xs_list *list, char *header, char *t)
1852{ 1852{
1853 xs *s = xs_str_new(NULL); 1853 xs_html *snac_posts;
1854 xs *es1 = encode_html(header); 1854 xs_html *people = xs_html_tag("div",
1855 xs *h = xs_fmt("<h2 class=\"snac-header\">%s</h2>\n", es1); 1855 xs_html_tag("h2",
1856 xs_list *p; 1856 xs_html_attr("class", "snac-header"),
1857 xs_html_text(header)),
1858 snac_posts = xs_html_tag("div",
1859 xs_html_attr("class", "snac-posts")));
1860
1861 xs_list *p = list;
1857 char *actor_id; 1862 char *actor_id;
1858 1863
1859 s = xs_str_cat(s, h);
1860
1861 s = xs_str_cat(s, "<div class=\"snac-posts\">\n");
1862
1863 p = list;
1864 while (xs_list_iter(&p, &actor_id)) { 1864 while (xs_list_iter(&p, &actor_id)) {
1865 xs *md5 = xs_md5_hex(actor_id, strlen(actor_id)); 1865 xs *md5 = xs_md5_hex(actor_id, strlen(actor_id));
1866 xs *actor = NULL; 1866 xs *actor = NULL;
@@ -1950,28 +1950,22 @@ xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *head
1950 xs *dm_div_id = xs_fmt("%s_%s_dm", md5, t); 1950 xs *dm_div_id = xs_fmt("%s_%s_dm", md5, t);
1951 xs *dm_form_id = xs_fmt("%s_reply_form", md5); 1951 xs *dm_form_id = xs_fmt("%s_reply_form", md5);
1952 1952
1953 xs_html *dm_textarea = html_note(snac, "Direct Message...", 1953 xs_html_add(snac_controls,
1954 dm_div_id, dm_form_id, 1954 html_note(snac, L("Direct Message..."),
1955 "", "", 1955 dm_div_id, dm_form_id,
1956 NULL, actor_id, 1956 "", "",
1957 xs_stock_false, "", 1957 NULL, actor_id,
1958 xs_stock_false, NULL, 1958 xs_stock_false, "",
1959 NULL, 0); 1959 xs_stock_false, NULL,
1960 1960 NULL, 0));
1961 xs_html_add(snac_controls, dm_textarea);
1962 1961
1963 xs_html_add(snac_post, snac_controls); 1962 xs_html_add(snac_post, snac_controls);
1964 1963
1965 { 1964 xs_html_add(snac_posts, snac_post);
1966 xs *s1 = xs_html_render_s(snac_post, xs_dup("\n"));
1967 s = xs_str_cat(s, s1);
1968 }
1969 } 1965 }
1970 } 1966 }
1971 1967
1972 s = xs_str_cat(s, "</div>\n"); 1968 return people;
1973
1974 return xs_str_cat(os, s);
1975} 1969}
1976 1970
1977 1971
@@ -1983,9 +1977,17 @@ xs_str *html_people(snac *snac)
1983 1977
1984 s = html_user_header(snac, s, 0); 1978 s = html_user_header(snac, s, 0);
1985 1979
1986 s = html_people_list(snac, s, wing, L("People you follow"), "i"); 1980 {
1981 xs_html *h = html_people_list(snac, wing, L("People you follow"), "i");
1982 xs *s1 = xs_html_render(h);
1983 s = xs_str_cat(s, s1);
1984 }
1987 1985
1988 s = html_people_list(snac, s, wers, L("People that follow you"), "e"); 1986 {
1987 xs_html *h = html_people_list(snac, wers, L("People that follow you"), "e");
1988 xs *s1 = xs_html_render(h);
1989 s = xs_str_cat(s, s1);
1990 }
1989 1991
1990 s = html_footer(s); 1992 s = html_footer(s);
1991 1993