/[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 13 by dpavlin, Thu May 6 16:53:40 2004 UTC revision 14 by dpavlin, Thu May 6 19:46:58 2004 UTC
# Line 21  my $tt = Template->new({ Line 21  my $tt = Template->new({
21          INCLUDE_PATH => $mws->{config}->val('global', 'templates'),          INCLUDE_PATH => $mws->{config}->val('global', 'templates'),
22          FILTERS => {          FILTERS => {
23                  'body5' => \&body5_filter,                  'body5' => \&body5_filter,
24                    'subject_search' => \&subject_search_filter,
25          },          },
26  });  });
27    
# Line 113  while ( my $c = $d->accept ) { Line 114  while ( my $c = $d->accept ) {
114                  #                  #
115    
116                  my $res = HTTP::Response->new(RC_OK);                  my $res = HTTP::Response->new(RC_OK);
117                  $res->header( 'Content-type' => 'text/html; charset=UTF-8' );                  $res->header( 'Content-type' => 'text/html; charset=ISO-8859-2' );
118                  $res->content($html);                  $res->content($html);
119                  $c->send_response($res);                  $c->send_response($res);
120    
# Line 131  sub body5_filter { Line 132  sub body5_filter {
132          $text =~ s/^\s+//gs;          $text =~ s/^\s+//gs;
133          $text =~ s/^[\>:\|=]+\s*.*?$//msg;      # remove quoted text          $text =~ s/^[\>:\|=]+\s*.*?$//msg;      # remove quoted text
134          $text =~ s/[\n\r]+/\n/gs;               # compress cr/lf          $text =~ s/[\n\r]+/\n/gs;               # compress cr/lf
135          $text =~ s,^((?:.*?[\n\r]){5}).*$,$1<span style="color:#808080">--8&lt;--[cut]--8&lt;--</span>,s;          if ($text =~ s,^((?:.*?[\n\r]){5}).*$,$1,s) {
136                    $text =~ s/[\n\r]*$/ .../;
137            }
138          $text =~ s/[\n\r]+--\s*[\n\r]+.*$//s;          $text =~ s/[\n\r]+--\s*[\n\r]+.*$//s;
139    
140  #       my $context = Text::Context::EitherSide->new($text, context => 5);  #       my $context = Text::Context::EitherSide->new($text, context => 5);
# Line 140  sub body5_filter { Line 143  sub body5_filter {
143          return $text;          return $text;
144  }  }
145    
146    sub subject_search_filter {
147            my $s = shift;
148            # remove re: fdw: [list] preffixes from e-mail
149            while ( $s =~ s/^\s*\[(?:re|fwd):\s+(.+)\]\s*$/$1/ig ||
150                    $s =~ s/^\s*(?:re|fwd):\s+(.+?)\s*$/$1/ig ||
151                    $s =~ s/^\[\w+\]\s*//ig
152            ) { };
153            return $s;
154    }

Legend:
Removed from v.13  
changed lines
  Added in v.14

  ViewVC Help
Powered by ViewVC 1.1.26