commit e44f1cbec64ccfc49521b579e979642f7f3d97fb Author: Halton Huo Date: Tue Oct 28 16:46:31 2008 +0800 Add output to ck-history. Bug #18261 diff --git a/tools/ck-history.c b/tools/ck-history.c index 716c3ef..dd8682c 100644 --- a/tools/ck-history.c +++ b/tools/ck-history.c @@ -62,6 +62,11 @@ typedef enum { static GList *all_events = NULL; +static void +print_last_report_record (GList *list, + CkLogEvent *event, + gboolean legacy_compat); + static gboolean process_event_line (const char *line) { @@ -220,6 +225,38 @@ generate_report_summary (int uid, const char *seat, const char *session_type) { + GList *oldest; + CkLogEvent *oldest_event; + GList *l; + + for (l = g_list_first (all_events); l != NULL; l = l->next) { + CkLogEvent *event = l->data; + + if (event->type == CK_LOG_EVENT_SEAT_SESSION_ADDED) { + CkLogSeatSessionAddedEvent *e; + e = (CkLogSeatSessionAddedEvent *)event; + + if (uid >= 0 && e->session_unix_user != uid) { + continue; + } + + if (seat != NULL && e->seat_id != NULL && strcmp (e->seat_id, seat) != 0) { + continue; + } + + if (session_type != NULL && e->session_type != NULL && strcmp (e->session_type, session_type) != 0) { + continue; + } + } + + print_last_report_record (l, event, FALSE); + } + + oldest = g_list_last (all_events); + if (oldest != NULL) { + oldest_event = oldest->data; + g_print ("\nLog ends %s", ctime (&oldest_event->timestamp.tv_sec)); + } } static CkLogEvent *