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 |
|
|
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 |
|
|
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<--[cut]--8<--</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); |
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 |
|
} |