account.pm
branchfoerste
changeset 53 a1399e17cca4
parent 52 aad3d38deac0
child 55 ef65e9adf0f6
--- 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 $@;