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 FLAGS extends Flags implements Item { 41 42 public static char[] name = {'F','L','A','G','S'}; 44 public int msgno; 45 46 private static final long serialVersionUID = 439049847053756670L; 47 48 51 public FLAGS(IMAPResponse r) throws ParsingException { 52 msgno = r.getNumber(); 53 54 r.skipSpaces(); 55 String [] flags = r.readSimpleList(); 56 if (flags != null) { for (int i = 0; i < flags.length; i++) { 58 String s = flags[i]; 59 if (s.length() >= 2 && s.charAt(0) == '\\') { 60 switch (Character.toUpperCase(s.charAt(1))) { 61 case 'S': add(Flags.Flag.SEEN); 63 break; 64 case 'R': add(Flags.Flag.RECENT); 66 break; 67 case 'D': 68 if (s.length() >= 3) { 69 char c = s.charAt(2); 70 if (c == 'e' || c == 'E') add(Flags.Flag.DELETED); 72 else if (c == 'r' || c == 'R') add(Flags.Flag.DRAFT); 74 } else 75 add(s); break; 77 case 'A': add(Flags.Flag.ANSWERED); 79 break; 80 case 'F': add(Flags.Flag.FLAGGED); 82 break; 83 case '*': add(Flags.Flag.USER); 85 break; 86 default: 87 add(s); break; 89 } 90 } else 91 add(s); 92 } 93 } 94 } 95 } 96 | Popular Tags |