From a2dadbbe1261ec89fc6b05f356baef06efdc6df7 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 21 Jul 2012 13:12:51 +0100 Subject: Add about:welcome handler and enable resource:welcome.html. --- content/fetchers/about.c | 22 ++++++++++++++++++++-- content/fetchers/resource.c | 1 + 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/content/fetchers/about.c b/content/fetchers/about.c index eddd77ef0..1330217f9 100644 --- a/content/fetchers/about.c +++ b/content/fetchers/about.c @@ -548,6 +548,21 @@ static bool fetch_about_logo_handler(struct fetch_about_context *ctx) return true; } +static bool fetch_about_welcome_handler(struct fetch_about_context *ctx) +{ + fetch_msg msg; + + /* content is going to return redirect */ + fetch_set_http_code(ctx->fetchh, 302); + + msg.type = FETCH_REDIRECT; + msg.data.redirect = "resource:welcome.html"; + + fetch_about_send_callback(&msg, ctx); + + return true; +} + /* Forward declaration because this handler requires the handler table. */ static bool fetch_about_about_handler(struct fetch_about_context *ctx); @@ -560,13 +575,15 @@ struct about_handlers { }; /** List of about paths and their handlers */ -struct about_handlers about_handler_list[] = { +struct about_handlers about_handler_list[] = { { "credits", SLEN("credits"), NULL, fetch_about_credits_handler, false }, { "licence", SLEN("licence"), NULL, fetch_about_licence_handler, false }, { "license", SLEN("license"), NULL, fetch_about_licence_handler, true }, + { "welcome", SLEN("welcome"), NULL, + fetch_about_welcome_handler, false }, { "config", SLEN("config"), NULL, fetch_about_config_handler, false }, { "Choices", SLEN("Choices"), NULL, @@ -585,7 +602,8 @@ struct about_handlers about_handler_list[] = { fetch_about_blank_handler, true } }; -#define about_handler_list_len (sizeof(about_handler_list) / sizeof(struct about_handlers)) +#define about_handler_list_len (sizeof(about_handler_list) / \ + sizeof(struct about_handlers)) /** * List all the valid about: paths available diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c index 1cd04f2dd..86d5498d5 100644 --- a/content/fetchers/resource.c +++ b/content/fetchers/resource.c @@ -79,6 +79,7 @@ static const char *fetch_resource_paths[] = { "user.css", "credits.html", "licence.html", + "welcome.html", "favicon.ico", "netsurf.png" }; -- cgit v1.2.3