summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorpoesty <poesty@noreply.codeberg.org>2023-05-07 07:27:24 +0000
committerpoesty <poesty@noreply.codeberg.org>2023-05-07 07:27:24 +0000
commite65760a349112abce39404ca50f6bc2f1301bed9 (patch)
treec2484af8006961d95dcf39cf16c3749100a713c9 /html.c
parent7d3a909598c1fc9def2069aeeccda58e305c738a (diff)
parent6a1cc55676eaf18ecadb42b86474aaef73cf9805 (diff)
Merge pull request 'master' (#1) from grunfink/snac2:master into master
Reviewed-on: https://codeberg.org/poesty/snac2/pulls/1
Diffstat (limited to 'html.c')
-rw-r--r--html.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/html.c b/html.c
index 5f57262..8d4203d 100644
--- a/html.c
+++ b/html.c
@@ -79,7 +79,7 @@ xs_str *actor_name(xs_dict *actor)
}
-d_char *html_actor_icon(snac *snac, d_char *os, char *actor,
+xs_str *html_actor_icon(xs_str *os, char *actor,
const char *date, const char *udate, const char *url, int priv)
{
xs *s = xs_str_new(NULL);
@@ -168,7 +168,7 @@ d_char *html_msg_icon(snac *snac, d_char *os, char *msg)
date = xs_dict_get(msg, "published");
udate = xs_dict_get(msg, "updated");
- os = html_actor_icon(snac, os, actor, date, udate, url, priv);
+ os = html_actor_icon(os, actor, date, udate, url, priv);
}
return os;
@@ -983,7 +983,7 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local,
}
-d_char *html_user_footer(snac *snac, d_char *s)
+xs_str *html_user_footer(xs_str *s)
{
xs *s1 = xs_fmt(
"<div class=\"snac-footer\">\n"
@@ -1064,7 +1064,7 @@ d_char *html_timeline(snac *snac, char *list, int local, int skip, int show, int
s = xs_str_cat(s, s1);
}
- s = html_user_footer(snac, s);
+ s = html_user_footer(s);
s = xs_str_cat(s, "</body>\n</html>\n");
@@ -1088,8 +1088,7 @@ d_char *html_people_list(snac *snac, d_char *os, d_char *list, const char *heade
if (valid_status(actor_get(snac, actor_id, &actor))) {
s = xs_str_cat(s, "<div class=\"snac-post\">\n");
- s = html_actor_icon(snac, s, actor, xs_dict_get(actor, "published"), NULL, NULL, 0);
-
+ s = html_actor_icon(s, actor, xs_dict_get(actor, "published"), NULL, NULL, 0);
/* content (user bio) */
char *c = xs_dict_get(actor, "summary");
@@ -1182,7 +1181,7 @@ d_char *html_people(snac *snac)
s = html_people_list(snac, s, wers, L("People that follows you"), "e");
- s = html_user_footer(snac, s);
+ s = html_user_footer(s);
s = xs_str_cat(s, "</body>\n</html>\n");
@@ -1226,7 +1225,7 @@ xs_str *html_notifications(snac *snac)
const char *actor_id = xs_dict_get(noti, "actor");
xs *actor = NULL;
- if (!valid_status(object_get(actor_id, &actor)))
+ if (!valid_status(actor_get(snac, actor_id, &actor)))
continue;
xs *a_name = actor_name(actor);
@@ -1277,12 +1276,13 @@ xs_str *html_notifications(snac *snac)
s = xs_str_cat(s, s1);
}
- s = html_user_footer(snac, s);
+ s = html_user_footer(s);
s = xs_str_cat(s, "</body>\n</html>\n");
/* set the check time to now */
xs *dummy = notify_check_time(snac, 1);
+ dummy = xs_free(dummy);
timeline_touch(snac);
@@ -1290,7 +1290,8 @@ xs_str *html_notifications(snac *snac)
}
-int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char **ctype)
+int html_get_handler(const xs_dict *req, const char *q_path,
+ char **body, int *b_size, char **ctype)
{
char *accept = xs_dict_get(req, "accept");
int status = 404;
@@ -1547,9 +1548,13 @@ int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char *
}
-int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
+int html_post_handler(const xs_dict *req, const char *q_path,
+ char *payload, int p_size,
char **body, int *b_size, char **ctype)
{
+ (void)p_size;
+ (void)ctype;
+
int status = 0;
snac snac;
char *uid, *p_path;