about summary refs log tree commit diff
path: root/server.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--server.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/server.h b/server.h
index 502e228..318d103 100644
--- a/server.h
+++ b/server.h
@@ -171,10 +171,24 @@ static inline enum kcgi_err httpFail(struct kreq *req, enum khttp http) {
 		|| khttp_printf(req, "%s\n", khttps[http]);
 }
 
+struct Scope {
+	const char *network;
+	const char *context;
+	const char *query;
+};
+
+static inline struct Scope htmlScope(struct kreq *req) {
+	struct Scope s = {0};
+	if (req->fieldmap[Network]) s.network = req->fieldmap[Network]->parsed.s;
+	if (req->fieldmap[Context]) s.context = req->fieldmap[Context]->parsed.s;
+	if (req->fieldmap[Query]) s.query = req->fieldmap[Query]->parsed.s;
+	return s;
+}
+
 extern const char *htmlStylesheet;
 enum kcgi_err htmlHead(struct khtmlreq *html, const char *title);
-enum kcgi_err htmlNav(
-	struct khtmlreq *html, const char *network, const char *context
-);
+enum kcgi_err htmlNav(struct khtmlreq *html, struct Scope scope);
 enum kcgi_err htmlFooter(struct khtmlreq *html);
-enum kcgi_err htmlEvent(struct khtmlreq *html, struct Event event);
+enum kcgi_err htmlEvent(
+	struct khtmlreq *html, struct Scope scope, struct Event event
+);