about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--html.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/html.c b/html.c
index 562f909..49b65e9 100644
--- a/html.c
+++ b/html.c
@@ -203,11 +203,13 @@ static enum kcgi_err eventTime(struct khtmlreq *html, struct Event event) {
 	return error;
 }
 
-static enum kcgi_err eventNetwork(struct khtmlreq *html, struct Event event) {
-	if (!event.network) return KCGI_OK;
+static enum kcgi_err
+eventNetwork(struct khtmlreq *html, struct Scope scope, struct Event event) {
+	if (scope.network || !scope.query || !event.network) return KCGI_OK;
 	char *href = khttp_urlpart(
-		NULL, NULL, Pages[Contexts],
+		NULL, NULL, Pages[Search],
 		Keys[Network].name, event.network,
+		Keys[Query].name, scope.query,
 		NULL
 	);
 	if (!href) err(EX_OSERR, "khttp_urlpart");
@@ -220,12 +222,16 @@ static enum kcgi_err eventNetwork(struct khtmlreq *html, struct Event event) {
 	return error;
 }
 
-static enum kcgi_err eventContext(struct khtmlreq *html, struct Event event) {
-	if (!event.network || !event.context) return KCGI_OK;
+static enum kcgi_err
+eventContext(struct khtmlreq *html, struct Scope scope, struct Event event) {
+	if (scope.context || !scope.query || !event.network || !event.context) {
+		return KCGI_OK;
+	}
 	char *href = khttp_urlpart(
-		NULL, NULL, Pages[Events],
+		NULL, NULL, Pages[Search],
 		Keys[Network].name, event.network,
 		Keys[Context].name, event.context,
+		Keys[Query].name, scope.query,
 		NULL
 	);
 	if (!href) err(EX_OSERR, "khttp_urlpart");
@@ -297,8 +303,8 @@ htmlEvent(struct khtmlreq *html, struct Scope scope, struct Event event) {
 			KATTR__MAX
 		)
 		|| eventTime(html, event)
-		|| (scope.network ? 0 : eventNetwork(html, event))
-		|| (scope.context ? 0 : eventContext(html, event))
+		|| eventNetwork(html, scope, event)
+		|| eventContext(html, scope, event)
 		|| eventNick(html, event)
 		|| eventMessage(html, event)
 		|| khtml_closeelem(html, 1);