--- trunk/irc-logger.pl 2006/03/26 17:49:54 24 +++ trunk/irc-logger.pl 2006/05/22 16:19:00 27 @@ -116,6 +116,7 @@ $args->{limit} ||= 10; $args->{fmt} ||= { + date => '[%s] ', time => '{%s} ', time_channel => '{%s %s} ', nick => '%s: ', @@ -144,7 +145,7 @@ my $sql = $context ? $sql_context : $sql_message; - $sql .= " where message ilike ? " if ($args->{search}); + $sql .= " where message ilike ? or nick ilike ? " if ($args->{search}); $sql .= " order by log.time desc"; $sql .= " limit " . $args->{limit}; @@ -152,7 +153,7 @@ if (my $search = $args->{search}) { $search =~ s/^\s+//; $search =~ s/\s+$//; - $sth->execute( '%' . $search . '%' ); + $sth->execute( ( '%' . $search . '%' ) x 2 ); warn "search for '$search' returned ", $sth->rows, " results ", $context || '', "\n"; } else { $sth->execute(); @@ -202,12 +203,11 @@ $row->{time} =~ s#\.\d+##; - my $t; - $t = $row->{date} . ' ' if ($last_row->{date} ne $row->{date}); - $t .= $row->{time}; - my $msg = ''; + $msg = sprintf($args->{fmt}->{date}, $row->{date}) . ' ' if ($last_row->{date} ne $row->{date}); + my $t = $row->{time}; + if ($last_row->{channel} ne $row->{channel}) { $msg .= sprintf($args->{fmt}->{time_channel}, $t, $row->{channel}); } else { @@ -487,6 +487,7 @@ my $style = <<'_END_OF_STYLE_'; p { margin: 0; padding: 0.1em; } .time, .channel { color: #808080; font-size: 60%; } +.date { float: right; clear: right; background: #e0e0e0; color: #404040; font-size: 120%; padding: 0.25em; border: 1px dashed #808080; } .nick { color: #000000; font-size: 80%; padding: 2px; font-family: courier, courier new, monospace ; } .message { color: #000000; font-size: 100%; } .search { float: right; } @@ -531,6 +532,7 @@ limit => $q->param('last') || 100, search => $q->param('search') || $q->param('grep') || undef, fmt => { + date => '
%s
', time => '%s ', time_channel => '%s %s ', nick => '%s: ',