1 21 22 27 28 package com.sun.mail.imap.protocol; 29 30 import javax.mail.Flags ; 31 import com.sun.mail.iap.*; 32 33 39 40 public class MailboxInfo { 41 public Flags availableFlags = null; 42 public Flags permanentFlags = null; 43 public int total = -1; 44 public int recent = -1; 45 public int first = -1; 46 public int uidvalidity = -1; 47 public int uidnext = -1; 48 public int mode; 49 50 public MailboxInfo(Response[] r) throws ParsingException { 51 for (int i = 0; i < r.length; i++) { 52 if (r[i] == null || !(r[i] instanceof IMAPResponse)) 53 continue; 54 55 IMAPResponse ir = (IMAPResponse)r[i]; 56 57 if (ir.keyEquals("EXISTS")) { 58 total = ir.getNumber(); 59 r[i] = null; } 61 else if (ir.keyEquals("RECENT")) { 62 recent = ir.getNumber(); 63 r[i] = null; } 65 else if (ir.keyEquals("FLAGS")) { 66 availableFlags = new FLAGS(ir); 67 r[i] = null; } 69 else if (ir.isUnTagged() && ir.isOK()) { 70 76 ir.skipSpaces(); 77 78 if (ir.readByte() != '[') { ir.reset(); 80 continue; 81 } 82 83 boolean handled = true; 84 String s = ir.readAtom(); 85 if (s.equalsIgnoreCase("UNSEEN")) 86 first = ir.readNumber(); 87 else if (s.equalsIgnoreCase("UIDVALIDITY")) 88 uidvalidity = ir.readNumber(); 89 else if (s.equalsIgnoreCase("PERMANENTFLAGS")) 90 permanentFlags = new FLAGS(ir); 91 else if (s.equalsIgnoreCase("UIDNEXT")) 92 uidnext = ir.readNumber(); 93 else 94 handled = false; 96 if (handled) 97 r[i] = null; else 99 ir.reset(); } 101 } 102 103 108 if (permanentFlags == null) { 109 if (availableFlags != null) 110 permanentFlags = new Flags (availableFlags); 111 else 112 permanentFlags = new Flags (); 113 } 114 } 115 } 116 | Popular Tags |