Hi Friedrich, *;

On Fri, Dec 10, 2010 at 3:22 PM, Friedrich Strohmaier
<damokles4-lis...@bits-fritz.de> wrote:
>
> long time no see .. ;o))

:-)

> Christian Lohmaier schrieb:
>>On Fri, Dec 10, 2010 at 12:11 PM, Friedrich Strohmaier
> [...]
> in this case - I fear <AddressModifyCode> isn't the right thing to do or
> the "feeding" code has to be adapted to get whole string between
> \s(pace) containing $adress.

I had a quick look at MHonArc sources and there are two possible
points where the behavriour can be tweaked.

One is the expression that identifies email-addresses in lib/mhinit.pl

##  Regexp for address/msg-id detection (looks like cussing in cartoons)
$AddrExp  = '[^()<>@,;:\/\s"\'&|]...@[^()<>@,;:\/\s"\'&|]+';
$HAddrExp = '[^()<>@,;:\/\s"\'&|]+(?:@|&\#[xX]0*40;|&64;)[^()<>@,;:\/\s"\'&|]+';

(I guess cussing should read cursing :-))
Fix would be to prefix the expression with a negative match for
(?<!(?:http://(?:www\.)?)?mail-archive\.com/)[^().....

I'm not sure though whether it is possible to use optional items
within lookbehind (maybe only fixed strings work)

the non-grouping is important, as it later is used in lib/mhopt.pl
(the second point to tackle it) like this:

    ## Check if rewriting addresses in bodies
    if ($AddrModifyBodies) {
        $readmail::TextPreFilter = sub {
            my $fields = shift;
            my $data_r = shift;
            # do not rewrite cid: URLs.
            #$$data_r =~ s{($AddrExp)}{rewrite_raw_address($1)}geox;
            $$data_r =~ s{
                ((?:cid:)?)($AddrExp)
            }{
                ($1 eq "") ? rewrite_raw_address($2) : $1.$2;
            }gieox;
        }
    }

i.e. if you'd use grouping parentheses, the $2 would not match what is expected.
You could also add the prefix to the method, as alternative to the
already existing cid case.
((?:cid:)?|(?:(?:http://(?:www\.)?)?mail-archive\.com/)?)($AddrExp)

This one should work in any case (but I didn't test it)

ciao
Christian


-- 
To unsubscribe, send mail to gossip-unsubscr...@jab.org.

Reply via email to