summary refs log tree commit diff
path: root/contexts.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--contexts.c16
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) {