git://git.jankratochvil.net
/
PerlMail.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
32ab14b
)
+Option --dry: Everything w/o write_message(), smssend() or bell()
author
short
<>
Mon, 14 Oct 2002 11:27:37 +0000
(11:27 +0000)
committer
short
<>
Mon, 14 Oct 2002 11:27:37 +0000
(11:27 +0000)
perlmail-accept
patch
|
blob
|
history
diff --git
a/perlmail-accept
b/perlmail-accept
index
cf545e9
..
ab934b0
100755
(executable)
--- a/
perlmail-accept
+++ b/
perlmail-accept
@@
-75,6
+75,7
@@
our $procmailFROM_MAILER=qr'^(((Resent-)?(From|Sender)|X-Envelope-From):|>?From
my $opt_mode;
my $opt_smstest; # 1 or $smscount
my $opt_idle;
my $opt_mode;
my $opt_smstest; # 1 or $smscount
my $opt_idle;
+my $opt_dry;
sub process;
sub process;
@@
-525,15
+526,16
@@
my($folder,$profile,%args)=@_;
$profile=$store_profile if !$profile;
my %do=map({ (!/=/ ? ($_=>1) : ($`=>$')); } profile_eval($profile));
$profile=$store_profile if !$profile;
my %do=map({ (!/=/ ? ($_=>1) : ($`=>$')); } profile_eval($profile));
- Sys::Syslog::syslog("info","%s%s: %s: %s",
+ Sys::Syslog::syslog("info","%s%s%s: %s: %s",
+ (!$opt_dry ? "" : "--dry: "),
(!$store_ignore ? "" : "IGNORED[$store_ignore]: "),
map({ cut($_); } $folder,address_show(unmime($Audit->from())),unmime($Audit->subject())),
)
(!$store_ignore ? "" : "IGNORED[$store_ignore]: "),
map({ cut($_); } $folder,address_show(unmime($Audit->from())),unmime($Audit->subject())),
)
- if $do{"syslog"};
+ if $do{"syslog"}
|| $opt_dry
;
$folder=~s/;.*$//s;
$folder="$Mail/".$' if $folder=~/^=/;
push @AuditStored,$folder if $do{"did"};
$folder=~s/;.*$//s;
$folder="$Mail/".$' if $folder=~/^=/;
push @AuditStored,$folder if $do{"did"};
- return if $store_ignore;
+ return if $store_ignore
|| $opt_dry
;
$DoBell++ if $do{"bell"};
write_message($folder);
smssend_tryall $store_ignorenewmail,$do{"sms"},%args if $do{"sms"};
$DoBell++ if $do{"bell"};
write_message($folder);
smssend_tryall $store_ignorenewmail,$do{"sms"},%args if $do{"sms"};
@@
-558,6
+560,7
@@
sub write_message
{
my($folder)=@_;
{
my($folder)=@_;
+ return if $opt_dry;
local *F;
open F,">>$folder" or do { warn "Append \"$folder\": $!"; return 0; };
{
local *F;
open F,">>$folder" or do { warn "Append \"$folder\": $!"; return 0; };
{
@@
-865,6
+868,7
@@
$Getopt::Long::ignorecase=0;
die "GetOptions error" if !Getopt::Long::GetOptions(
"inetd" ,sub { $opt_mode=\&inetd; },
"stdin" ,sub { $opt_mode=\&stdin; },
die "GetOptions error" if !Getopt::Long::GetOptions(
"inetd" ,sub { $opt_mode=\&inetd; },
"stdin" ,sub { $opt_mode=\&stdin; },
+ "dry" ,\$opt_dry,
"smstest:s",sub { $opt_mode=\&stdin; $opt_smstest=($_[1] || 1); },
"idle!" ,\$opt_idle,
"idletest" ,sub { syslogging_restore(); print((defined($_=useridle()) ? $_ : "<undef>")."\n"); exit 0; },
"smstest:s",sub { $opt_mode=\&stdin; $opt_smstest=($_[1] || 1); },
"idle!" ,\$opt_idle,
"idletest" ,sub { syslogging_restore(); print((defined($_=useridle()) ? $_ : "<undef>")."\n"); exit 0; },