summary refs log tree commit diff
path: root/events.c
diff options
context:
space:
mode:
Diffstat (limited to 'events.c')
-rw-r--r--events.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/events.c b/events.c
index 423ce1e..bdeb3f6 100644
--- a/events.c
+++ b/events.c
@@ -169,13 +169,8 @@ enum kcgi_err eventsPage(struct kreq *req) {
 	if (result == SQLITE_ROW) {
 		error = 0
 			|| khtml_elem(&html, KELEM_THEAD)
-			|| khtml_elem(&html, KELEM_TR)
-			|| khtml_attr(
-				&html, KELEM_TH,
-				KATTR_CLASS, "topic",
-				KATTR_COLSPAN, "3",
-				KATTR__MAX
-			)
+			|| khtml_attr(&html, KELEM_TR, KATTR_CLASS, "topic", KATTR__MAX)
+			|| khtml_attr(&html, KELEM_TH, KATTR_COLSPAN, "3", KATTR__MAX)
 			|| khtml_puts(&html, sqlite3_column_text(stmt.topic, 0))
 			|| khtml_closeelem(&html, 3);
 		if (error) return error;
@@ -224,7 +219,7 @@ enum kcgi_err eventsPage(struct kreq *req) {
 			free(base);
 
 			error = 0
-				|| khtml_elem(&html, KELEM_TR)
+				|| khtml_attr(&html, KELEM_TR, KATTR_CLASS, "page", KATTR__MAX)
 				|| khtml_attr(&html, KELEM_TH, KATTR_COLSPAN, "3", KATTR__MAX)
 				|| khtml_attr(&html, KELEM_A, KATTR_HREF, href, KATTR__MAX)
 				|| khtml_puts(&html, "Earlier messages")
@@ -259,7 +254,7 @@ enum kcgi_err eventsPage(struct kreq *req) {
 		);
 		if (!href) err(EX_OSERR, "khttp_urlpart");
 		error = 0
-			|| khtml_elem(&html, KELEM_TR)
+			|| khtml_attr(&html, KELEM_TR, KATTR_CLASS, "page", KATTR__MAX)
 			|| khtml_attr(&html, KELEM_TH, KATTR_COLSPAN, "3", KATTR__MAX)
 			|| khtml_attr(&html, KELEM_A, KATTR_HREF, href, KATTR__MAX)
 			|| khtml_puts(&html, "Later messages")
@@ -268,5 +263,13 @@ enum kcgi_err eventsPage(struct kreq *req) {
 		if (error) return error;
 	}
 
+	if (!rows) {
+		error = 0
+			|| khtml_elem(&html, KELEM_TR)
+			|| khtml_attr(&html, KELEM_TH, KATTR_COLSPAN, "3", KATTR__MAX)
+			|| khtml_puts(&html, "No matching messages");
+		if (error) return error;
+	}
+
 	return htmlFooter(&html) || khtml_close(&html);
 }