From 26446c816090bf1bc8de008b0d1d16b4664d7abf Mon Sep 17 00:00:00 2001 From: default Date: Wed, 28 Sep 2022 10:21:57 +0200 Subject: [PATCH] New function html_top_controls(). --- html.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 105 insertions(+), 14 deletions(-) diff --git a/html.c b/html.c index 5530c34..21ee151 100644 --- a/html.c +++ b/html.c @@ -259,28 +259,116 @@ d_char *html_user_header(snac *snac, d_char *s, int local) /* user info */ { - s = xs_str_cat(s, "
\n"); - - xs *s1 = xs_fmt("

%s

\n", - xs_dict_get(snac->config, "name")); - s = xs_str_cat(s, s1); - - xs *s2 = xs_fmt("

@%s@%s

\n", - xs_dict_get(snac->config, "uid"), xs_dict_get(srv_config, "host")); - s = xs_str_cat(s, s2); - xs *bio = NULL; - not_really_markdown(xs_dict_get(snac->config, "bio"), &bio); - xs *s3 = xs_fmt("
%s
\n", bio); - s = xs_str_cat(s, s3); + char *_tmpl = + "
\n" + "

%s

\n" + "

@%s@%s

\n" + "
%s
\n" + "
\n"; - s = xs_str_cat(s, "
\n"); + not_really_markdown(xs_dict_get(snac->config, "bio"), &bio); + + xs *s1 = xs_fmt(_tmpl, + xs_dict_get(snac->config, "name"), + xs_dict_get(snac->config, "uid"), xs_dict_get(srv_config, "host"), + bio + ); + + s = xs_str_cat(s, s1); } return s; } +d_char *html_top_controls(snac *snac, d_char *s) +/* generates the top controls */ +{ + char *_tmpl = + "
\n" + + "
\n" + "
\n" + "\n" + "\n" + "\n" + "

\n" + "

\n" + + "
\n" + "
%s\n" + + "
\n" + "\n" + " %s\n" + "

\n" + + "
\n" + "\n" + " %s\n" + "

\n" + + "
%s\n" + + "
\n" + "
\n" + "

%s:
\n" + "

\n" + + "

%s:
\n" + "

\n" + + "

%s:
\n" + "

\n" + + "

%s:
\n" + "

\n" + + "

%s:
\n" + "

\n" + + "\n" + "
\n" + + "
\n" + "
\n" + "
\n" + "
\n" + "
\n"; + + xs *s1 = xs_fmt(_tmpl, + snac->actor, + L("Post"), + + L("More options..."), + + snac->actor, + L("Follow"), L("(by URL or user@host)"), + + snac->actor, + L("Boost"), L("(by URL)"), + + L("User setup..."), + snac->actor, + L("User name"), + xs_dict_get(snac->config, "name"), + L("Avatar URL"), + xs_dict_get(snac->config, "avatar"), + L("Bio"), + xs_dict_get(snac->config, "bio"), + L("Password (only to change it)"), + L("Repeat Password"), + L("Update user info") + ); + + s = xs_str_cat(s, s1); + + return s; +} + + d_char *html_timeline(snac *snac, char *list, int local) /* returns the HTML for the timeline */ { @@ -288,6 +376,9 @@ d_char *html_timeline(snac *snac, char *list, int local) s = html_user_header(snac, s, local); + if (!local) + s = html_top_controls(snac, s); + s = xs_str_cat(s, "

HI

\n"); s = xs_str_cat(s, xs_fmt("len() == %d\n", xs_list_len(list)));