summary refs log tree commit diff
path: root/events.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--events.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/events.c b/events.c
index 7962ab3..32e94c2 100644
--- a/events.c
+++ b/events.c
@@ -107,7 +107,8 @@ enum kcgi_err pageEvents(struct kreq *req) {
 		|| khttp_body(req)
 		|| khtml_open(&html, req, KHTML_PRETTY)
 		|| htmlHead(&html, context)
-		|| htmlNav(&html, network, context);
+		|| htmlNav(&html, network, context)
+		|| khtml_elem(&html, KELEM_TABLE);
 	if (error) return error;
 
 	sqlite3_stmt *events = stmt.eventsAfter;
@@ -121,11 +122,17 @@ enum kcgi_err pageEvents(struct kreq *req) {
 
 	int result;
 	while (SQLITE_ROW == (result = sqlite3_step(events))) {
-		const char *msg = (const char *)sqlite3_column_text(events, 7);
-		if (!msg) continue;
-		error = 0
-			|| khtml_puts(&html, msg)
-			|| khtml_elem(&html, KELEM_BR);
+		struct Event event = {
+			.event = sqlite3_column_int64(events, 0),
+			.time = sqlite3_column_int64(events, 1),
+			.type = sqlite3_column_int(events, 2),
+			.nick = (const char *)sqlite3_column_text(events, 3),
+			.user = (const char *)sqlite3_column_text(events, 4),
+			.host = (const char *)sqlite3_column_text(events, 5),
+			.target = (const char *)sqlite3_column_text(events, 6),
+			.message = (const char *)sqlite3_column_text(events, 7),
+		};
+		error = htmlEvent(&html, event);
 		if (error) break;
 	}
 	if (result != SQLITE_DONE) errx(EX_SOFTWARE, "%s", sqlite3_errmsg(db));