224 |
my $escape_re = join '|' => keys %escape; |
my $escape_re = join '|' => keys %escape; |
225 |
|
|
226 |
$text =~ s/($escape_re)/$escape{$1}/gs; |
$text =~ s/($escape_re)/$escape{$1}/gs; |
227 |
|
|
228 |
|
while ($text =~ s/#-#(quote|signature)(\d*)##(.+?)##\1\2#-#/<span class="$1">$3<\/span>/gs) { } ; |
229 |
|
|
230 |
return $text; |
return $text; |
231 |
} |
} |
232 |
|
|
243 |
$text =~ s/#-q-#[\n\r]*//gs; |
$text =~ s/#-q-#[\n\r]*//gs; |
244 |
# outlook quoting |
# outlook quoting |
245 |
$text =~ s/(\s*--+\s*Original\s+Message\s*--+.*)$//si; |
$text =~ s/(\s*--+\s*Original\s+Message\s*--+.*)$//si; |
246 |
$text =~ s/(\s*--+\s*Forwarded\s+message\s*from\s+.+\s*--+.*)$//si; |
$text =~ s/(\s*--+\s*Forwarded\s+message.+\s*--+.*)$//si; |
247 |
|
|
248 |
# remove signature |
# remove signature |
249 |
$text =~ s/[\n\r]+--\s*[\n\r]+.*$//s; |
$text =~ s/[\n\r]+--\s*[\n\r]+.*$//s; |
255 |
$text =~ s/^\n+//gs; |
$text =~ s/^\n+//gs; |
256 |
$text =~ s/[\s\n]+$//gs; |
$text =~ s/[\s\n]+$//gs; |
257 |
|
|
258 |
|
if ($text eq "") { |
259 |
|
$text="#-#quote##forwarded message##quote#-#"; |
260 |
|
} |
261 |
|
|
262 |
# cut to 5 lines; |
# cut to 5 lines; |
263 |
if ($text =~ s,^((?:.*?[\n\r]){5}).*$,$1,s) { |
if ($text =~ s,^((?:.*?[\n\r]){5}).*$,$1,s) { |
264 |
$text =~ s/[\n\r]*$/ .../; |
$text =~ s/[\n\r]*$/ .../; |
283 |
# find quoted text |
# find quoted text |
284 |
$text =~ s/^([\>:\|=]+\s*.*?)$/#-#quote1##$1##quote1#-#/msg; |
$text =~ s/^([\>:\|=]+\s*.*?)$/#-#quote1##$1##quote1#-#/msg; |
285 |
$text =~ s/(--+\s*Original\s+Message\s*--+.*)$/#-#quote2##$1##quote2#-#/si; |
$text =~ s/(--+\s*Original\s+Message\s*--+.*)$/#-#quote2##$1##quote2#-#/si; |
286 |
$text =~ s/(--+\s*Forwarded\s+message\s*from\s+.+\s*--+.*)$/#-#quote3##$1##quote3#-#/si; |
$text =~ s/(--+\s*Forwarded\s+message.+\s*--+.*)$/#-#quote3##$1##quote3#-#/si; |
287 |
|
|
288 |
$text = html_escape($text . $sig); |
$text = html_escape($text . $sig); |
|
while ($text =~ s/#-#(quote|signature)(\d*)##(.+?)##\1\2#-#/<span class="$1">$3<\/span>/gs) { } ; |
|
289 |
return $text; |
return $text; |
290 |
} |
} |
291 |
|
|