1 17 18 package org.apache.james.imapserver.commands; 19 20 import org.apache.james.imapserver.AccessControlException; 21 import org.apache.james.imapserver.AuthorizationException; 22 import org.apache.james.imapserver.ImapRequest; 23 import org.apache.james.imapserver.ImapSession; 24 25 import java.util.StringTokenizer ; 26 import java.util.List ; 27 28 class ExpungeCommand extends SelectedStateCommand 29 { 30 public ExpungeCommand() 31 { 32 this.commandName = "EXPUNGE"; 33 } 34 35 public boolean doProcess( ImapRequest request, ImapSession session, List argValues ) 36 { 37 String command = this.getCommand(); 38 39 try { 40 if ( session.getCurrentMailbox().expunge( session.getCurrentUser() ) ) { 41 session.checkExpunge(); 42 session.checkSize(); 43 session.okResponse( command ); 44 } 45 else { 46 session.noResponse( command, "Unknown server error." ); 47 } 48 return true; 49 } 50 catch ( AccessControlException ace ) { 51 session.noResponse( command, "No such mailbox" ); 52 session.logACE( ace ); 53 return true; 54 } 55 catch ( AuthorizationException aze ) { 56 session.noResponse( command, "You do not have the rights to expunge mailbox: " + session.getCurrentMailbox().getAbsoluteName() ); 57 session.logAZE( aze ); 58 return true; 59 } 60 catch ( Exception e ) { 61 session.noResponse( command, "Unknown server error." ); 62 getLogger().error( "Exception expunging mailbox " + 63 session.getCurrentMailbox().getAbsoluteName() + " by user " + 64 session.getCurrentUser() + " was : " + e ); 65 if ( DEEP_DEBUG ) { 66 e.printStackTrace(); 67 } 68 return true; 69 } 70 } 71 } 72 | Popular Tags |