fix handling of LIST/LSUB in IMAP
authoradam <adam@megacz.com>
Sat, 9 Sep 2006 01:55:15 +0000 (01:55 +0000)
committeradam <adam@megacz.com>
Sat, 9 Sep 2006 01:55:15 +0000 (01:55 +0000)
darcs-hash:20060909015515-5007d-4be7a93d5c436681acdc12ddd50edad0474ae799.gz

src/org/ibex/mail/protocol/IMAP.java

index 9730436..22ff402 100644 (file)
@@ -138,17 +138,21 @@ public class IMAP {
             for(int i=0; i<children.length; i++) {
                 String s = children[i], pre = ref, kid = start + (start.length() > 0 ? sep+"" : "") + s;                
                 if (mailbox(kid, false) == null) continue;
-                boolean phantom = mailbox(kid, false).phantom();
-                while(true) {
-                    if (pre.length() == 0) {
-                        if (s.length() == 0)       client.list(sep, kid, lsub, phantom);
-                    } else switch(pre.charAt(0)) {
-                        case sep:        if (s.length() == 0) list(kid, pre.substring(1), lsub);                    break;
-                        case '%':        client.list(sep,kid,lsub,phantom);pre=pre.substring(1); s = "";            continue;
-                        case '*':        client.list(sep,kid,lsub,phantom);list(kid,pre,lsub);pre=pre.substring(1); break;
-                        default:         if (s.length()==0)                                                         break;
-                                         if (s.charAt(0) != pre.charAt(0))                                          break;
-                                         s = s.substring(1); pre = pre.substring(1);                                continue;
+                Mailbox phant = mailbox(kid, false, false);
+                if (phant != null) {
+                    boolean phantom = phant.phantom();
+                    while(true) {
+                        if (pre.length() == 0) {
+                            if (s.length() == 0)       client.list(sep, kid, lsub, phantom);
+                        } else switch(pre.charAt(0)) {
+                            case sep:        if (s.length() == 0) list(kid, pre.substring(1), lsub);                    break;
+                            case '%':        client.list(sep,kid,lsub,phantom);pre=pre.substring(1); s = "";            continue;
+                            case '*':        client.list(sep,kid,lsub,phantom);list(kid,pre,lsub);pre=pre.substring(1); break;
+                            default:         if (s.length()==0)                                                         break;
+                                if (s.charAt(0) != pre.charAt(0))                                          break;
+                                s = s.substring(1); pre = pre.substring(1);                                continue;
+                        }
+                        break;
                     }
                 }
             }