diff options
author | June McEnroe <june@causal.agency> | 2020-07-10 14:54:45 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-07-10 14:54:45 -0400 |
commit | 3926094bc216277ff6c58e6e9efba64fc7af91da (patch) | |
tree | 55362740094489c3e59fbc125ed181dd18cf0077 /events.c | |
parent | Add -l and -r options (diff) | |
download | scooper-3926094bc216277ff6c58e6e9efba64fc7af91da.tar.gz scooper-3926094bc216277ff6c58e6e9efba64fc7af91da.zip |
Implement partial table output of events
This should work for both events and search pages.
Diffstat (limited to 'events.c')
-rw-r--r-- | events.c | 19 |
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)); |