| 1 | gateway | 1.1 | package rules; | 
| 2 |  |  |  | 
| 3 |  |  | use strict; | 
| 4 |  |  | # don't use warnings; | 
| 5 |  |  |  | 
| 6 |  |  |  | 
| 7 |  |  | my $mc = 0; | 
| 8 |  |  | sub mark { | 
| 9 |  |  | $mc++; | 
| 10 |  |  | #report("mark $mc"); | 
| 11 |  |  | } | 
| 12 |  |  |  | 
| 13 |  |  | sub dispatch { | 
| 14 |  |  |  | 
| 15 |  |  | my $self = shift; | 
| 16 |  |  |  | 
| 17 |  |  | my $incoming = $self->{incoming}; | 
| 18 |  |  | my $MAILDIR = $self->{settings}->{MAILDIR}; | 
| 19 |  |  |  | 
| 20 |  |  | my $from    = $incoming->from; | 
| 21 |  |  | my $to      = $incoming->to; | 
| 22 |  |  | my $subject = $incoming->subject; | 
| 23 |  |  |  | 
| 24 |  |  | chomp($from); | 
| 25 |  |  | chomp($to); | 
| 26 |  |  | chomp($subject); | 
| 27 |  |  |  | 
| 28 |  |  | # ----- | 
| 29 |  |  | # target-based-routing (gateway to news in this case...) | 
| 30 |  |  | print "to: $to", "\n"; | 
| 31 |  |  | if ($to =~ /links-computing/) { | 
| 32 |  |  | print "COPY", "\n"; | 
| 33 |  |  | #$self->copy('Newsgate', 'alt.test'); | 
| 34 |  |  | $self->copy('Newsgate', 'nfo.links.computing'); | 
| 35 |  |  | #my $prg = $0; | 
| 36 |  |  | #my $prg = '/data/opt/dispatchmail/bin/dispatchmail'; | 
| 37 |  |  | #my $prg = '/etc/mail/smrsh/dispatchmail'; | 
| 38 |  |  | #my $pipeTo = $prg . ' --mode=mail2news --thread=alt.test --base=/home/collector'; | 
| 39 |  |  | #$self->report("PIPE: " . $pipeTo); | 
| 40 |  |  | #$incoming->pipe($pipeTo); | 
| 41 |  |  | } | 
| 42 |  |  |  | 
| 43 |  |  | $self->ignore(); | 
| 44 |  |  | #$self->accept("$MAILDIR/Inbox"); | 
| 45 |  |  |  | 
| 46 |  |  | } | 
| 47 |  |  |  | 
| 48 |  |  | 1; |