From: Matthew Vernon Date: Thu, 23 Jan 2014 11:15:03 +0000 (+0000) Subject: Make "list" command suppress rejected addresses by default X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=ac4dc024f587f368b758f7fc7eaa0bd859ad4d01;p=evade-mail-usrlocal.git Make "list" command suppress rejected addresses by default The "list" command now suppresses addresses that reject incoming mail by default. If the -a command is specified, then they are listed as before. The administrator's "list-user" command always shows all aliases for a user, regardless of whether or not they are delivered. Signed-off-by: Matthew Vernon --- diff --git a/evade-mail-admin b/evade-mail-admin index fb22d39..6a6af06 100755 --- a/evade-mail-admin +++ b/evade-mail-admin @@ -22,7 +22,7 @@ actions choose [] [] [#] (interactively allocate) update [] [#] show - list + list [-a] (-a also lists aliases set to reject) list-actions empty string for redirect means reject remember to quote comments (to protect # from your shell) @@ -408,10 +408,23 @@ sub listq ($) { } } -sub action_list { +sub action_list (;$) { + my ($q, $listall); + my ($x) = @_; + if ( defined $x ) { $listall = 1; } + my $v =shift @ARGV; + if ( defined $v ) { + if ($v ne "-a") {die "only legal argument to list is -a";} + else { $listall=1; } + } nomoreargs; - my $q = $dbh->prepare("SELECT * FROM addrs WHERE user=?". - " ORDER BY localpart"); + if($listall){ + $q = $dbh->prepare("SELECT * FROM addrs WHERE user=?". + " ORDER BY localpart"); + }else{ + $q = $dbh->prepare("SELECT * FROM addrs WHERE user=?". + " AND redirect <>'' ORDER BY localpart"); + } $q->execute($user); listq($q); } @@ -420,7 +433,7 @@ sub action_list_user { die unless $priv; $user = nextarg; nomoreargs; - action_list; + action_list "-a"; } sub action_list_all {