exit 0;
}
+# FIXME: separate 'lacemail'-transfer together with lacemail-submit away
sub inetd
{
die "Excessive arguments" if @ARGV;
return "";
}
+# FIXME: rewrite &send_cz_eurotel properly by own code
# patch for http://kiwi.ms.mff.cuni.cz/%7Etom/programming/src/sendsms.tar.gz/sendsms.pl
my $agent=LWP::UserAgent->new();
$agent->agent("LaceMail $VERSION; contact=$SMScontact; ");
{
# razor-check has exit code 1 if NOT spam, code 0 if IS spam
local *CHILD;
+ local $SIG{"PIPE"}=sub { warn "razor2 gave me SIGPIPE: broken pipe"; };
# prevent Razor2's: Can't call method "log" on unblessed reference at Razor2/Client/Agent.pm line 212.
local $ENV{"HOME"}=$HOME;
open CHILD,'|'
return wantarray() ? @r : join("",map("$_\n",@r));
}
+my %mutteval_charmap=( # WARNING: Don't use "" or "0" here, see below for "|| warn"!
+ '\\'=>"\\",
+ 'r'=>"\r",
+ 'n'=>"\n",
+ 't'=>"\t",
+ 'f'=>"\f",
+ 'e'=>"\e",
+ );
+# mutt/init.c/mutt_extract_token()
+sub mutteval
+{
+ local $_=$_[0];
+ return $_ if !s/^"//;
+ do { warn "Missing trailing quote in: $_"; return $_; } if !s/"$//;
+ s/\\(.)/$mutteval_charmap{$1} || warn "Undefined '\\$1' sequence in: $_";/ges;
+ return $_;
+}
+
sub muttrc_get
{
my(@headers)=@_;
- my @r=map({ (ref $_ ? $_ : qr/^\s*set\s+\Q$_\E\s*=\s*"([^"]*)"\s*$/si); } @headers);
+ my @r=map({ (ref $_ ? $_ : qr/^\s*set\s+\Q$_\E\s*=\s*(.*?)\s*$/si); } @headers);
my %r=map(($_=>undef()),@r);
for (muttrc()) {
for my $ritem (@r) {
/$ritem/si or next;
- $r{$ritem}=$1;
+ $r{$ritem}=mutteval $1;
}
}
for my $var (grep { !defined($r{$_}) } @r) {
return %r;
}
+# FIXME: host may get multiple recipients and thus not showing "for <...>"
+# FIXME: muttrc_get("from") is too strict
sub store_muttrc_alternates
{
my($prefix,$profile)=@_;
my $alternates=muttrc_get("alternates") or return;
my $alternatesre=qr/$alternates/si;
- my $From=muttrc_get(qr/^\s*my_hdr\s+From:.*\<(\S+)\>\s*$/si) or return;
+ my $From=muttrc_get("from") or return;
my $Fromre=qr/^\Q$From\E$/si;
warn "'From' \"$From\" not matches by 'alternates': $alternatesre"
if $From!~/$alternates/si;