diff options
| author | fukachan <fukachan> | 2001-04-12 13:39:56 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-04-12 13:39:56 +0000 |
| commit | 50bc0c3897c191e328e8c9383bc1daf98b5e1d9b (patch) | |
| tree | 25388170ffdc8233ef71d4725a8c2c45bb253565 | |
| parent | fac12daba9821a671531ed339bc097823ea85c9d (diff) | |
| download | fml8-50bc0c3897c191e328e8c9383bc1daf98b5e1d9b.tar.gz fml8-50bc0c3897c191e328e8c9383bc1daf98b5e1d9b.tar.bz2 fml8-50bc0c3897c191e328e8c9383bc1daf98b5e1d9b.zip | |
define _reach_end() to check the end of the error message part.
We ignore Japanese part and check the end by considering Japanese too.
So @ISA = (Mail::Bounce) now.
| -rw-r--r-- | fml/lib/Mail/Bounce/SimpleMatch.pm | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/fml/lib/Mail/Bounce/SimpleMatch.pm b/fml/lib/Mail/Bounce/SimpleMatch.pm index 56b1236a..6d125e49 100644 --- a/fml/lib/Mail/Bounce/SimpleMatch.pm +++ b/fml/lib/Mail/Bounce/SimpleMatch.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: SimpleMatch.pm,v 1.5 2001/04/12 04:43:05 fukachan Exp $ +# $FML: SimpleMatch.pm,v 1.6 2001/04/12 11:47:16 fukachan Exp $ # @@ -14,6 +14,8 @@ use strict; use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); use Carp; +@ISA = qw(Mail::Bounce); + =head1 NAME Mail::Bounce::SimpleMatch - SimpleState error message format parser @@ -69,6 +71,12 @@ my $address_trap_regexp = { }, + 'freeml.com' => { + 'start' => '.', + 'end' => 'http\:\/\/www\.freeml\.com\/help\/', + }, + + 'smail' => { 'start' => 'Failed addresses follow:', 'end' => 'Message text follows:', @@ -110,9 +118,15 @@ sub analyze for (my $i = 0; $i < $n; $i++) { my $buf = $m->nth_paragraph($i + 1); # 1 not 0 for 1st paragraph - if ($debug) { print "{$buf}\n";} $args->{ buf } = \$buf; - $self->_address_match($args); + + unless ( $self->look_japanese( $buf ) ) { + if ($debug) { print "{$buf}\n";} + $self->_address_match($args); + } + + # we found the mark of "end of error message part". + last if $self->_reach_end($args); } } else { @@ -121,6 +135,23 @@ sub analyze } +sub _reach_end +{ + my ($self, $args) = @_; + my $result = $args->{ result }; + my $rbuf = $args->{ buf }; + + for my $mta_type (keys %$address_trap_regexp) { + next unless $mta_type; + + my $end_regexp = $address_trap_regexp->{ $mta_type }->{ 'end' }; + return 1 if ($$rbuf =~ /$end_regexp/); + } + + 0; +} + + sub _address_match { my ($self, $args) = @_; |
