# HG changeset patch # User Matthias Förste foerste@schlittermann.de # Date 1323375838 -3600 # Node ID a1399e17cca42160cf2664164e2a5201b0ee25b0 # Parent aad3d38deac0a2341076c9e5201fb4e32a5e5350 ignore shared folders in quota calculations diff -r aad3d38deac0 -r a1399e17cca4 account.pm --- a/account.pm Thu Dec 08 16:55:43 2011 +0100 +++ b/account.pm Thu Dec 08 21:23:58 2011 +0100 @@ -456,12 +456,21 @@ my %q; if ($imap->capability->{quota}) { + # prepare patterns for shared folders - we want to ignore them in + # quota calculations (TODO: what happens if a user has/attempts to + # create a folder with the name of a namespace? he could avoid + # quota limits that way?) + my $ns = $imap->namespace() or die $@; + my @p = map qr{^\Q$_->[0]\E}, (@{$ns->[1]}, @{$ns->[2]}); + my $folders = $imap->list( '', '*' ) or die $@; for my $f ( @{$folders} ) { # single folder sieht wie folgt aus: [[flag1, flag2, ...], separator, foldername] - next if '\\Noselect' ~~ $f->[0]; + #next if '\\Noselect' ~~ $f->[0]; + # ignore shared folders + map { next if ( $f->[2] . $f->[1]) =~ $_ } @p; my $q = $imap->getquotaroot( $f->[2] ) or $@ eq q{IMAP Command : 'getquotaroot' failed. Response was : no - Not showing other users' quota.} or die $@;