diff options
author | June McEnroe <june@causal.agency> | 2020-07-12 12:17:44 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-07-12 12:17:44 -0400 |
commit | 7ff6e16e8ccda2433006f949ffc7b1ee5eaf08cf (patch) | |
tree | 03abf9d87da7810b364d27f97f9e541df9c9e46f /contexts.c | |
parent | Clean up page error handling (diff) | |
download | scooper-7ff6e16e8ccda2433006f949ffc7b1ee5eaf08cf.tar.gz scooper-7ff6e16e8ccda2433006f949ffc7b1ee5eaf08cf.zip |
Reorganize code and add earlier messages link
Diffstat (limited to 'contexts.c')
-rw-r--r-- | contexts.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/contexts.c b/contexts.c index 04b44ac..b486ef9 100644 --- a/contexts.c +++ b/contexts.c @@ -15,12 +15,16 @@ */ #include <err.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <sysexits.h> #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, |