From 7ff6e16e8ccda2433006f949ffc7b1ee5eaf08cf Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 12 Jul 2020 12:17:44 -0400 Subject: Reorganize code and add earlier messages link --- contexts.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'contexts.c') diff --git a/contexts.c b/contexts.c index 04b44ac..b486ef9 100644 --- a/contexts.c +++ b/contexts.c @@ -15,12 +15,16 @@ */ #include +#include #include #include #include #include "server.h" +bool contextsPublic; +int contextsRecent = 500; + const char *ContextsQuery = SQL( WITH recentEvents AS ( SELECT time, context @@ -45,8 +49,8 @@ const char *ContextsQuery = SQL( SELECT name, query, 0 FROM allContexts; ); -enum kcgi_err pageContexts(struct kreq *req) { - struct Scope scope = htmlScope(req); +enum kcgi_err contextsPage(struct kreq *req) { + struct Scope scope = pageScope(req); if (!scope.network) return httpFail(req, KHTTP_400); enum kcgi_err error = httpHead(req, KHTTP_200, KMIME_TEXT_HTML); @@ -62,8 +66,8 @@ enum kcgi_err pageContexts(struct kreq *req) { sqlite3_reset(stmt.contexts); dbBindText(stmt.contexts, ":network", scope.network); - dbBindInt(stmt.contexts, ":recent", pageRecent); - dbBindInt(stmt.contexts, ":public", pagePublic); + dbBindInt(stmt.contexts, ":recent", contextsRecent); + dbBindInt(stmt.contexts, ":public", contextsPublic); enum State { None, -- cgit 1.4.1