snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 25a057bac27fc612ced9764f3b1610b3fbc6f220
parent aaca6350edc76794f582934ab54e17ba41433a6a
Author: default <nobody@localhost>
Date:   Sun,  2 Oct 2022 18:22:15 +0200

Added history support.

Diffstat:
Mhtml.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/html.c b/html.c @@ -851,6 +851,12 @@ int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char * else if (xs_startswith(p_path, "h/")) { /* an entry from the history */ + xs *id = xs_replace(p_path, "h/", ""); + + if ((*body = history_get(&snac, id)) != NULL) { + *b_size = strlen(*body); + status = 200; + } } else status = 404;