Skip to content

Commit

Permalink
individual copy to sender
Browse files Browse the repository at this point in the history
by Carlos Canau
  • Loading branch information
Christopher Zimmermann committed Nov 22, 2014
1 parent d4a18af commit 21e3ca2
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions minimalist.pl
Expand Up @@ -493,6 +493,7 @@
my @recipients;
my @rw;
my @writeany;
my @dontcopyme;

# normalize to exact directory name.
if (exists $lists{lc $list}) {
Expand Down Expand Up @@ -579,12 +580,16 @@
$ent = lc($1);

# Get and remove per-user settings from e-mail
my ($userSet) = $ent =~ s/(>.*)$//;
my $userSet;
($ent, $userSet) = split (/>/, $ent);

# Check for '+' (write access) or '-' (read only access)
if (defined $userSet && $userSet =~ /-/) { push (@readonly, $ent); }
elsif (defined $userSet && $userSet =~ /\+/) { push (@writeany, $ent); }

# Check for 'd' (dont copy me)
if (defined $userSet && $userSet =~ /d/) { push (@dontcopyme, $ent); }

# If user's maxsize
my $usrMaxSize = 0;
if (defined $userSet && $userSet =~ /#ms([0-9]+)/) { $usrMaxSize = $1; }
Expand All @@ -608,12 +613,16 @@
chomp($ent); $ent = lc($ent);

# Get and remove per-user settings from e-mail
my ($userSet) = $ent =~ s/(>.*)$//;
my $userSet;
($ent, $userSet) = split (/>/, $ent);

# Check for '+' (write access) or '-' (read only access)
if (defined $userSet && $userSet =~ /-/) { push (@readonly, $ent); }
elsif (defined $userSet && $userSet =~ /\+/) { push (@writeany, $ent); }

# Check for 'd' (dont copy me)
if (defined $userSet && $userSet =~ /d/) { push (@dontcopyme, $ent); }

push (@rw, $ent); }
}
close LIST;
Expand Down Expand Up @@ -943,10 +952,22 @@
my @t;
@members = sort @t = Invert ('@', '!', @members);
@rcpts = sort @t = Invert ('@', '!', @rcpts);
@dontcopyme = sort @t = Invert ('@', '!', @dontcopyme);

for (my $r = my $m = 0; $m < @members; ) {
if ($r >= @rcpts || $members[$m] lt $rcpts[$r]) {
push (@recipients, $members[$m++]); }
my $qmember = quotemeta($members[$m]);
if (!grep(/^$qmember$/i, @dontcopyme)) {
push (@recipients, $members[$m++]); }
else {
my ($dom, $us) = split ('!', $members[$m]);
if ($us.'@'.$dom ne $from) {
push (@recipients, $members[$m++]); }
else {
$m++;
}
}
}
elsif ($members[$m] eq $rcpts[$r]) { $r++; $m++; }
elsif ($members[$m] gt $rcpts[$r]) { $r++ };
}
Expand Down Expand Up @@ -1566,6 +1587,10 @@ sub txtUserSet {
if ($userSet =~ /!/) {
$usrmsg .= ($i++ ? '; ' : ''). mt('subscription suspended');
};
# Don't Copy Me
if ($userSet =~ /d/) {
$usrmsg .= ($i++ ? '; ' : ''). mt('no post to self');
};
# Maxsize
if ($userSet =~ /#ms([0-9]+)/) {
$usrmsg .= ($i++ ? ';' : '').
Expand Down Expand Up @@ -1627,6 +1652,10 @@ ($$$$;@)
$newSet = chgUserSet($currentSet, '!+', '!'); }
when ('resume') {
$newSet = chgUserSet($currentSet, '!+'); }
when ('not-self') {
$newSet = chgUserSet($currentSet, 'd+', 'd'); }
when ('add-self') {
$newSet = chgUserSet($currentSet, 'd+'); }
when ('maxsize') {
if ($params[0]+0 == 0) {
$newSet = chgUserSet($currentSet, '(#ms[0-9]+)+'); }
Expand Down

0 comments on commit 21e3ca2

Please sign in to comment.