/[mws]/trunk/httpd.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/httpd.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 16 by dpavlin, Thu May 6 23:06:08 2004 UTC revision 19 by dpavlin, Fri May 7 20:52:34 2004 UTC
# Line 14  use MWS; Line 14  use MWS;
14    
15  use Data::Dumper;  use Data::Dumper;
16    
17    my $debug = 1;
18    
19  my $d = HTTP::Daemon->new( Reuse => 1, LocalPort => 6969 ) || die;  my $d = HTTP::Daemon->new( Reuse => 1, LocalPort => 6969 ) || die;
20  my $cgi = new CGI::Lite;  my $cgi = new CGI::Lite;
21  my $mws = MWS->new('global.conf');  my $mws = MWS->new('global.conf');
# Line 68  while ( my $c = $d->accept ) { Line 70  while ( my $c = $d->accept ) {
70                  my $url = $r->url->path;                  my $url = $r->url->path;
71    
72                  # XXX LOG                  # XXX LOG
73                  print $r->method," ",$url,Dumper($param);                  print $r->method," ",$url,"\n",Dumper($param),"\n" if ($debug);
74    
75                  # template file name (use ?format=html as default)                  # template file name (use ?format=html as default)
76                  my $tpl_file = 'master.';                  my $tpl_file = 'master.';
# Line 99  while ( my $c = $d->accept ) { Line 101  while ( my $c = $d->accept ) {
101                          my @res = $mws->fetch_all_results();                          my @res = $mws->fetch_all_results();
102    
103                          $tpl_var->{results} = \@res;                          $tpl_var->{results} = \@res;
104                            $tpl_var->{total_hits} = $mws->{total_hits};
105    
106    
107                  #                  #
108                  # ?show_id=XXXXxxxx___message_id___xxxxXXXX                  # ?show_id=XXXXxxxx___message_id___xxxxXXXX
109                  } elsif ($param->{'show_id'}) {                  } elsif ($param->{'show_id'}) {
110                            
111                            $mws->reset_counters;
112                          my $row = $mws->fetch_result_by_id($param->{'show_id'});                          my $row = $mws->fetch_result_by_id($param->{'show_id'});
113                          $tpl_var->{message} = $row;                          $tpl_var->{message} = $row;
114                  }                  }
115    
116    print Dumper($mws->{counter});
117    
118                    # push counters to template
119                    foreach my $f (qw(from to cc bcc)) {
120                            my $h = $mws->counter($f) || next;
121                            my @a;
122                            foreach my $k (sort { $h->{$b}->{usage} <=> $h->{$a}->{usage} } keys %$h) {
123                                    push @a, $h->{$k};
124                            }
125                            $tpl_var->{counters}->{$f} = [ @a ] if (@a);
126                    }
127    
128                  $tt->process($tpl_file, $tpl_var, \$html) || die $tt->error();                  $tt->process($tpl_file, $tpl_var, \$html) || die $tt->error();
129    
130                  #                  #
# Line 151  sub subject_search_filter { Line 167  sub subject_search_filter {
167          while ( $s =~ s/^\s*\[(?:re|fwd|fw):\s+(.+)\]\s*$/$1/ig ||          while ( $s =~ s/^\s*\[(?:re|fwd|fw):\s+(.+)\]\s*$/$1/ig ||
168                  $s =~ s/^\s*(?:re|fwd|fw):\s+(.+?)\s*$/$1/ig ||                  $s =~ s/^\s*(?:re|fwd|fw):\s+(.+?)\s*$/$1/ig ||
169                  $s =~ s/^\[\S+\]\s*//ig ||                  $s =~ s/^\[\S+\]\s*//ig ||
170                  $s =~ s/^\[[^@]+@\w+\.\w+\s*:\s+(.+)\s*\]\s*$/$1/g                  $s =~ s/^\[[^@]+@\w+\.\w+\s*:\s+(.+)\s*\]\s*$/$1/g ||
171                    $s =~ s/\(fwd\)\s*$//ig ||
172                    $s =~ s/\"//g
173          ) { };          ) { };
174          return $s;          return $s;
175  }  }

Legend:
Removed from v.16  
changed lines
  Added in v.19

  ViewVC Help
Powered by ViewVC 1.1.26