1 21 22 27 28 package com.sun.mail.imap.protocol; 29 30 import com.sun.mail.iap.*; 31 32 38 39 public class Status { 40 public String mbox = null; 41 public int total = -1; 42 public int recent = -1; 43 public long uidnext = -1; 44 public long uidvalidity = -1; 45 public int unseen = -1; 46 47 public static String [] standardItems = 48 { "MESSAGES", "RECENT", "UNSEEN", "UIDNEXT", "UIDVALIDITY" }; 49 50 public Status(Response r) throws ParsingException { 51 mbox = r.readAtomString(); r.skipSpaces(); 53 if (r.readByte() != '(') 54 throw new ParsingException("parse error in STATUS"); 55 56 do { 57 String attr = r.readAtom(); 58 if (attr.equalsIgnoreCase("MESSAGES")) 59 total = r.readNumber(); 60 else if (attr.equalsIgnoreCase("RECENT")) 61 recent = r.readNumber(); 62 else if (attr.equalsIgnoreCase("UIDNEXT")) 63 uidnext = r.readLong(); 64 else if (attr.equalsIgnoreCase("UIDVALIDITY")) 65 uidvalidity = r.readLong(); 66 else if (attr.equalsIgnoreCase("UNSEEN")) 67 unseen = r.readNumber(); 68 } while (r.readByte() != ')'); 69 } 70 71 public static void add(Status s1, Status s2) { 72 if (s2.total != -1) 73 s1.total = s2.total; 74 if (s2.recent != -1) 75 s1.recent = s2.recent; 76 if (s2.uidnext != -1) 77 s1.uidnext = s2.uidnext; 78 if (s2.uidvalidity != -1) 79 s1.uidvalidity = s2.uidvalidity; 80 if (s2.unseen != -1) 81 s1.unseen = s2.unseen; 82 } 83 } 84 | Popular Tags |