summary refs log tree commit diff
path: root/server.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-07-16 17:46:19 -0400
committerJune McEnroe <june@causal.agency>2020-07-16 17:46:19 -0400
commit6500baa1ffc720ec4c0f256dd99dab478225122b (patch)
tree8afb6e817f3fd21c93a42a6fd65de931b262be05 /server.h
parentRemove viewport meta (diff)
downloadscooper-6500baa1ffc720ec4c0f256dd99dab478225122b.tar.gz
scooper-6500baa1ffc720ec4c0f256dd99dab478225122b.zip
Big refactor, remove struct Scope
Diffstat (limited to '')
-rw-r--r--server.h26
1 files changed, 6 insertions, 20 deletions
diff --git a/server.h b/server.h
index 1177871..20d1803 100644
--- a/server.h
+++ b/server.h
@@ -55,11 +55,11 @@ extern const char *Pages[PagesLen];
 	X(Context, "context", kvalid_stringne) \
 	X(After, "after", kvalid_stringne) \
 	X(Before, "before", kvalid_stringne) \
-	X(Tidy, "tidy", kvalid_stringne) \
+	X(Tidy, "tidy", kvalid_int) \
 	X(Query, "query", kvalid_stringne) \
 	X(Offset, "offset", kvalid_int)
 
-enum {
+enum Key {
 #define X(key, name, valid) key,
 	ENUM_KEYS
 #undef X
@@ -67,20 +67,6 @@ enum {
 };
 extern const struct kvalid Keys[KeysLen];
 
-struct Scope {
-	const char *network;
-	const char *context;
-	const char *query;
-};
-
-static inline struct Scope pageScope(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 int contextsRecent;
 extern bool contextsPublic;
 extern const char *NetworksQuery;
@@ -181,13 +167,13 @@ struct Event {
 
 extern const char *htmlStylesheet;
 enum kcgi_err htmlHead(struct khtmlreq *html, const char *title);
-enum kcgi_err htmlScopeFields(struct khtmlreq *html, struct Scope scope);
-enum kcgi_err htmlNav(struct khtmlreq *html, struct Scope scope);
-enum kcgi_err htmlFooter(struct khtmlreq *html);
+enum kcgi_err htmlHidden(struct khtmlreq *html, struct kreq *req, enum Key key);
+enum kcgi_err htmlNav(struct khtmlreq *html, struct kreq *req);
 enum kcgi_err htmlIRC(struct khtmlreq *html, const char *str);
 enum kcgi_err htmlEvent(
-	struct khtmlreq *html, struct Scope scope, struct Event event
+	struct khtmlreq *html, struct kreq *req, struct Event *event
 );
+enum kcgi_err htmlFooter(struct khtmlreq *html);
 
 static inline enum kcgi_err
 httpHead(struct kreq *req, enum khttp http, enum kmime mime) {