diff options
author | June McEnroe <june@causal.agency> | 2020-07-16 17:46:19 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-07-16 17:46:19 -0400 |
commit | 6500baa1ffc720ec4c0f256dd99dab478225122b (patch) | |
tree | 8afb6e817f3fd21c93a42a6fd65de931b262be05 /contexts.c | |
parent | Remove viewport meta (diff) | |
download | scooper-6500baa1ffc720ec4c0f256dd99dab478225122b.tar.gz scooper-6500baa1ffc720ec4c0f256dd99dab478225122b.zip |
Big refactor, remove struct Scope
Diffstat (limited to 'contexts.c')
-rw-r--r-- | contexts.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/contexts.c b/contexts.c index 5eba403..5c5e5cc 100644 --- a/contexts.c +++ b/contexts.c @@ -58,8 +58,8 @@ const char *ContextsQuery = SQL( ); enum kcgi_err contextsPage(struct kreq *req) { - struct Scope scope = pageScope(req); - if (!scope.network) return httpFail(req, KHTTP_400); + if (!req->fieldmap[Network]) return httpFail(req, KHTTP_400); + const char *network = req->fieldmap[Network]->parsed.s; enum kcgi_err error = 0 || httpHead(req, KHTTP_200, KMIME_TEXT_HTML) @@ -69,12 +69,12 @@ enum kcgi_err contextsPage(struct kreq *req) { struct khtmlreq html; error = error || khtml_open(&html, req, 0) - || htmlHead(&html, scope.network) - || htmlNav(&html, scope); + || htmlHead(&html, network) + || htmlNav(&html, req); if (error) return error; sqlite3_reset(stmt.contexts); - dbBindText(stmt.contexts, ":network", scope.network); + dbBindText(stmt.contexts, ":network", network); dbBindInt(stmt.contexts, ":recent", contextsRecent); dbBindInt(stmt.contexts, ":public", contextsPublic); @@ -94,7 +94,7 @@ enum kcgi_err contextsPage(struct kreq *req) { bool active = sqlite3_column_int(stmt.contexts, i++); enum State prev = state; - state = (active ? Active : (query ? Queries : Channels)); + state = (active ? Active : query ? Queries : Channels); if (state != prev) { error = 0 || khtml_closeelem(&html, 1) @@ -107,7 +107,7 @@ enum kcgi_err contextsPage(struct kreq *req) { char *href = khttp_urlpart( NULL, NULL, Pages[Events], - Keys[Network].name, scope.network, + Keys[Network].name, network, Keys[Context].name, context, NULL ); @@ -126,7 +126,7 @@ enum kcgi_err contextsPage(struct kreq *req) { if (error) return error; sqlite3_reset(stmt.motd); - dbBindText(stmt.motd, ":network", scope.network); + dbBindText(stmt.motd, ":network", network); result = sqlite3_step(stmt.motd); if (result == SQLITE_ROW) { |