--- trunk/httpd.pl 2004/05/06 16:53:40 13 +++ trunk/httpd.pl 2004/05/06 19:46:58 14 @@ -21,6 +21,7 @@ INCLUDE_PATH => $mws->{config}->val('global', 'templates'), FILTERS => { 'body5' => \&body5_filter, + 'subject_search' => \&subject_search_filter, }, }); @@ -113,7 +114,7 @@ # my $res = HTTP::Response->new(RC_OK); - $res->header( 'Content-type' => 'text/html; charset=UTF-8' ); + $res->header( 'Content-type' => 'text/html; charset=ISO-8859-2' ); $res->content($html); $c->send_response($res); @@ -131,7 +132,9 @@ $text =~ s/^\s+//gs; $text =~ s/^[\>:\|=]+\s*.*?$//msg; # remove quoted text $text =~ s/[\n\r]+/\n/gs; # compress cr/lf - $text =~ s,^((?:.*?[\n\r]){5}).*$,$1--8<--[cut]--8<--,s; + if ($text =~ s,^((?:.*?[\n\r]){5}).*$,$1,s) { + $text =~ s/[\n\r]*$/ .../; + } $text =~ s/[\n\r]+--\s*[\n\r]+.*$//s; # my $context = Text::Context::EitherSide->new($text, context => 5); @@ -140,3 +143,12 @@ return $text; } +sub subject_search_filter { + my $s = shift; + # remove re: fdw: [list] preffixes from e-mail + while ( $s =~ s/^\s*\[(?:re|fwd):\s+(.+)\]\s*$/$1/ig || + $s =~ s/^\s*(?:re|fwd):\s+(.+?)\s*$/$1/ig || + $s =~ s/^\[\w+\]\s*//ig + ) { }; + return $s; +}