1 19 20 package org.apache.james.imapserver.client; 21 22 import java.io.IOException ; 23 import java.util.ArrayList ; 24 import java.util.Iterator ; 25 import java.util.LinkedList ; 26 import java.util.List ; 27 28 import javax.mail.Flags ; 29 import javax.mail.MessagingException ; 30 import javax.mail.internet.MimeMessage ; 31 32 public class ExpungeClientCommand extends AbstractCommand { 33 34 List expungedMsns = new ArrayList (); 35 36 public ExpungeClientCommand(MimeMessage [] msgs) throws MessagingException { 37 int msnOffset = 0; 38 39 command = "EXPUNGE"; 40 statusResponse = "OK EXPUNGE completed."; 41 for (int i = 0; i < msgs.length; i++) { 42 if (msgs[i].getFlags().contains(Flags.Flag.DELETED)) { 43 expungedMsns.add(new Integer (i + msnOffset + 1)); 44 msnOffset--; 45 } 46 } 47 } 48 49 public List getExpectedResponseList() throws MessagingException , 50 IOException { 51 List responseList = new LinkedList (); 52 53 for (Iterator it = expungedMsns.iterator(); it.hasNext();) { 54 final int no = ((Integer ) it.next()).intValue(); 55 String line = "* " + no + " EXPUNGE"; 56 responseList.add(line); 57 } 58 return responseList; 59 } 60 61 } 62 | Popular Tags |