| 1 |
collector |
1.1 |
#!/usr/bin/perl |
| 2 |
|
|
|
| 3 |
collector |
1.2 |
# ============================================================ |
| 4 |
collector |
1.1 |
# |
| 5 |
collector |
1.2 |
# dispatchmail v0.05 |
| 6 |
|
|
# A simple mail filter done in perl |
| 7 |
|
|
# with the Perl-module "Mail::Audit" |
| 8 |
|
|
# available from CPAN. |
| 9 |
|
|
# |
| 10 |
root |
1.5 |
# $Id: dispatchmail,v 1.4 2003/01/22 17:50:56 root Exp $ |
| 11 |
collector |
1.2 |
# |
| 12 |
|
|
# ============================================================ |
| 13 |
root |
1.3 |
# $Log: dispatchmail,v $ |
| 14 |
root |
1.5 |
# Revision 1.4 2003/01/22 17:50:56 root |
| 15 |
|
|
# - refactored most code to Mail::Audit::Dispath |
| 16 |
|
|
# |
| 17 |
root |
1.4 |
# Revision 1.3 2003/01/22 07:16:51 root |
| 18 |
|
|
# + sub traceEntry |
| 19 |
|
|
# + further refactorings |
| 20 |
|
|
# |
| 21 |
root |
1.3 |
# Revision 1.2 2003/01/22 05:38:44 collector |
| 22 |
|
|
# + prepared refactoring to 'dispatchmail' |
| 23 |
|
|
# |
| 24 |
collector |
1.2 |
# ============================================================ |
| 25 |
collector |
1.1 |
|
| 26 |
|
|
use strict; |
| 27 |
|
|
# don't use warnings; |
| 28 |
|
|
|
| 29 |
|
|
use Data::Dumper; |
| 30 |
|
|
use Getopt::Long; |
| 31 |
root |
1.4 |
use Hash::Merge qw( merge ); |
| 32 |
collector |
1.1 |
|
| 33 |
root |
1.3 |
use lib qw( /data/libs/nfo/perl/libs ); |
| 34 |
root |
1.4 |
use Mail::Audit::Dispatch; |
| 35 |
root |
1.3 |
|
| 36 |
|
|
|
| 37 |
collector |
1.1 |
# - - - - - - - - - - - - - - - - - - - - |
| 38 |
|
|
# options |
| 39 |
|
|
# - - - - - - - - - - - - - - - - - - - - |
| 40 |
root |
1.4 |
|
| 41 |
|
|
my $defaults = { |
| 42 |
|
|
LOG => 1, # writes reports to logfile |
| 43 |
|
|
VERBOSE => 1, # writes reports to STDOUT |
| 44 |
|
|
TRACE => 1, # writes contents of messages to logfile |
| 45 |
|
|
}; |
| 46 |
|
|
|
| 47 |
|
|
my $args; |
| 48 |
collector |
1.1 |
GetOptions( |
| 49 |
root |
1.5 |
'user=s' => \$args->{user}, |
| 50 |
|
|
'base=s' => \$args->{base}, |
| 51 |
|
|
'rules=s' => \$args->{rules}, |
| 52 |
|
|
'mode=s' => \$args->{mode}, |
| 53 |
|
|
'newsgroup=s' => \$args->{newsgroup}, |
| 54 |
collector |
1.1 |
); |
| 55 |
root |
1.3 |
|
| 56 |
root |
1.4 |
my $args_dispatch = merge($defaults, $args); |
| 57 |
root |
1.3 |
|
| 58 |
root |
1.4 |
#print Dumper($args_dispatch); |
| 59 |
|
|
#exit; |
| 60 |
collector |
1.1 |
|
| 61 |
root |
1.4 |
my @args_array = %$args_dispatch; |
| 62 |
|
|
my $dispatcher = Mail::Audit::Dispatch->new(@args_array); |
| 63 |
|
|
$dispatcher->run(); |
| 64 |
collector |
1.1 |
|
| 65 |
root |
1.4 |
1; |