--- a/acl.pm Tue Dec 13 14:02:11 2011 +0100
+++ b/acl.pm Tue Dec 13 21:45:06 2011 +0100
@@ -87,6 +87,8 @@
die "IMAP Server does not advertise acl support"
unless $imap->capability->{acl};
+ $imap->set_tracing(1) if $ENV{TRACE};
+
# requires an imap connection
my $ns = $imap->namespace() or die "No public namespaces available: $@";
$nspat = [];
@@ -149,7 +151,8 @@
or die "Can't create folder '$folder': $@"
if $Cf->create;
- for my $f ( @{ acl_folders($folder) } ) {
+ my @folders = @{ acl_folders($folder) } or die "Got empty folderlist - does '$folder' exist? (use --create if you want me to create it)";
+ for my $f ( @folders ) {
if ( $Cf->acl eq 'delete' ) {
$imap->deleteacl( $f, $user ) or die "Can't delete acl: $@";
@@ -360,8 +363,8 @@
while ( $u = shift @{$perms} and $p = shift @{$perms} ) {
# '#user' will be listed when we have a global acl for 'user'
- my $gl = $u =~ /^#/ ? ' [global acl]' : '';
- my $gr = $u =~ /^\$/ ? ' [group acl]' : '';
+ my $gl = $u =~ /^\$?#/ ? ' [global]' : '';
+ my $gr = $u =~ /^#?\$/ ? ' [group]' : '';
$hasacl = 1;
print "\t$u [$p]$gr$gl\n";
}