3 our ($ng,$staticfiles,@ARGV) = @ARGV;
9 use CGI qw/:standard *table end_* -no_xhtml/;
15 our ($processline,$needmap);
16 our ($selectmid,$selectnum);
19 my ($taccat, $fn)= @_;
20 open F, "$taccat $fn |" or die $!;
25 $s[0]= strftime "%Y-%m-%d %H:%M:%S %Z", localtime $s[0];
32 my (@logs) = qw(event.log.0 event.log);
33 @logs= reverse @logs if $taccat eq 'tac';
34 processlog($taccat, $_) foreach @logs;
37 sub processline_print () {
39 $sp[3] =~ s/\@\w{0,2}/ at .. /;
40 @sp= map { escapeHTML($_) } @sp[0..5];
41 $sp[3] =~ s/</\<br></;
42 $sp[2]=~s/\@/\@<span class='hole'><\/span>/;
44 s/\W/ sprintf "%%%02x", ord $& /ge;
47 if (length $s[1] && length $s[2]) {
48 my $url= url().'/message/'.$spu[1].'/'.$spu[2];
49 foreach my $i (qw(1 2)) {
50 $sp[$i]= a({ href=>$url }, $sp[$i]."<br>" );
54 $sp[5]= a({ href=>"$staticfiles/nr-$s[6].txt" }, $sp[5] );
57 print "<tr class='$oddeven'><td>$sp[0]</td>";
58 print "<td class='ref'>$sp[1] $sp[2]</td>";
59 print td([@sp[3..5]]),"</tr>\n";
62 sub processline_print_ifsingle () {
63 return unless $s[1] eq $selectnum
64 or $s[2] eq $selectmid;
68 our (%done_num,%done_id,%num2id,%id2num);
69 sub processline_queue_prescan () {
70 my ($num,$id,$e) = @s[1..2,5];
71 if (length $id and length $num) {
75 return unless $e =~ m/^decide reject discard|^notify reject|^post/;
76 #print STDERR "finishing $e $s[1] $s[2]\n";
77 $num= $id2num{$id} if !length $num;
78 $id= $num2id{$num} if !length $id;
79 #print STDERR "finishing $e $num $id\n";
80 $done_num{$num}++ if defined $num;
81 $done_id{$id}++ if defined $id;
83 sub processline_queue () {
84 return if $done_num{$s[1]};
85 return if $done_id{$s[2]};
93 $processline= \&processline_print;
95 if ($pi =~ m,^/message/(\d+)/(.*)$,) {
96 ($selectnum, $selectmid) = ($1,$2);
97 $title= "Single message ".escapeHTML($selectmid);
98 $processline= \&processline_print_ifsingle;
99 } elsif ($pi =~ m/^$/) {
100 $title= "Recent activity - $ng";
101 } elsif ($pi =~ m,^/queue,) {
102 $title= "Activity regarding still-queued messages";
103 $processline= \&processline_queue_prescan;
105 $processline= \&processline_queue;
109 span.hole:before { content: " "; }
110 td.ref { font-size: 0.75em; }
111 tr.o { background: #ddddff; }
115 start_html(-title=>$title, -style=>{'-code'=>$css}),
116 h1($title), start_table();
118 print Tr(td([map { strong($_) } (qw(
131 print a({ href=>url() }, "All recent activity"), '; ';
132 print a({ href=>url().'/queue' }, "Unfinished business");