dont check quota if it is not supported by the imap server; dont attempt to check quota on folders we cannot select; dont fail when attempting to check quota on a shared folder foerste
authorMatthias Förste foerste@schlittermann.de
Thu, 08 Dec 2011 16:55:43 +0100
branchfoerste
changeset 52 aad3d38deac0
parent 51 fd55e111838d
child 53 a1399e17cca4
dont check quota if it is not supported by the imap server; dont attempt to check quota on folders we cannot select; dont fail when attempting to check quota on a shared folder
account.pm
--- a/account.pm	Tue Nov 29 13:19:44 2011 +0100
+++ b/account.pm	Thu Dec 08 16:55:43 2011 +0100
@@ -452,15 +452,26 @@
           or die "Can't connect to IMAP Server '", $Cf->imap_server,
           "', Port '", $Cf->imap_port, "': ", $@;
         $imap->login( "$uid*" . $Cf->imap_admin, $imap_password ) or die $@;
-        my $folders = $imap->list( '', '*' ) or die $@;
+
         my %q;
-        for my $f ( @{$folders} ) {
+        if ($imap->capability->{quota}) {
+
+            my $folders = $imap->list( '', '*' ) or die $@;
+
+            for my $f ( @{$folders} ) {
 
-            # single folder sieht wie folgt aus: [[flag1, flag2, ...], separator, foldername]
-            my $q = $imap->getquotaroot( $f->[2] ) or die $@;
-            delete $q->{quotaroot};
-            %q = ( %q, %{$q} );
+                # single folder sieht wie folgt aus: [[flag1, flag2, ...], separator, foldername]
+                next if '\\Noselect' ~~ $f->[0];
+                my $q = $imap->getquotaroot( $f->[2] )
+                    or $@ eq q{IMAP Command : 'getquotaroot' failed. Response was : no - Not showing other users' quota.}
+                    or die $@;
+                delete $q->{quotaroot};
+                %q = ( %q, %{$q} );
+
+            }
+
         }
+
         $imap->logout or die $@;
 
         # da wir uns anmelden konnten haben wir auch eine 'mbox'