You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ba...@apache.org on 2006/10/10 10:35:02 UTC
svn commit: r454662 [3/15] - in /james/server/sandbox/imap-integration: ./
src/java/org/apache/james/imapserver/
src/java/org/apache/james/imapserver/commands/
src/java/org/apache/james/imapserver/debug/
src/java/org/apache/james/imapserver/store/ src/...
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/SelectedMailboxSession.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/SelectedMailboxSession.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/SelectedMailboxSession.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/SelectedMailboxSession.java Tue Oct 10 01:34:56 2006
@@ -1,115 +1,115 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.imapserver;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-import javax.mail.Flags;
-
-import org.apache.james.imapserver.store.MailboxException;
-import org.apache.james.mailboxmanager.MailboxListener;
-import org.apache.james.mailboxmanager.MailboxManagerException;
-import org.apache.james.mailboxmanager.MessageResult;
-import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
-
-public class SelectedMailboxSession implements MailboxListener {
-
- private ImapSession _session;
- private boolean _readonly;
- private boolean _sizeChanged;
- private List expungedMsn = new ArrayList();
- private ImapMailboxSession mailbox;
-
- public SelectedMailboxSession(ImapMailboxSession mailbox, ImapSession session, boolean readonly) throws MailboxManagerException {
- this.mailbox = mailbox;
- _session = session;
- _readonly = readonly;
- // TODO make this a weak reference (or make sure deselect() is *always* called).
- mailbox.addListener(this,MessageResult.MSN | MessageResult.UID);
- }
-
- public void deselect() {
- mailbox.removeListener(this);
- mailbox = null;
- }
-
-
- public void mailboxDeleted() {
- try {
- _session.closeConnection("Mailbox " + mailbox.getName() + " has been deleted");
- } catch (MailboxManagerException e) {
- }
- }
-
-
- public boolean isSizeChanged() {
- return _sizeChanged;
- }
-
- public void setSizeChanged(boolean sizeChanged) {
- _sizeChanged = sizeChanged;
- }
-
-
- public void close()
- {
- mailbox.close();
- mailbox=null;
- }
-
- public void create()
- {
- throw new RuntimeException("should not create a selected mailbox");
-
- }
-
- public void expunged(MessageResult mr) {
- expungedMsn.add(new Integer(mr.getSize()));
- }
-
- public void added(MessageResult mr) {
- _sizeChanged = true;
- }
-
- public void flagsUpdated(MessageResult mr,MailboxListener silentListener) {
- }
-
- public ImapMailboxSession getMailbox() {
- return mailbox;
- }
-
- public void mailboxRenamed(String origName, String newName) {
- // TODO Auto-generated method stub
-
- }
-
- public void mailboxRenamed(String newName) {
- // TODO Auto-generated method stub
-
- }
-
-}
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.imapserver;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.mail.Flags;
+
+import org.apache.james.imapserver.store.MailboxException;
+import org.apache.james.mailboxmanager.MailboxListener;
+import org.apache.james.mailboxmanager.MailboxManagerException;
+import org.apache.james.mailboxmanager.MessageResult;
+import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
+
+public class SelectedMailboxSession implements MailboxListener {
+
+ private ImapSession _session;
+ private boolean _readonly;
+ private boolean _sizeChanged;
+ private List expungedMsn = new ArrayList();
+ private ImapMailboxSession mailbox;
+
+ public SelectedMailboxSession(ImapMailboxSession mailbox, ImapSession session, boolean readonly) throws MailboxManagerException {
+ this.mailbox = mailbox;
+ _session = session;
+ _readonly = readonly;
+ // TODO make this a weak reference (or make sure deselect() is *always* called).
+ mailbox.addListener(this,MessageResult.MSN | MessageResult.UID);
+ }
+
+ public void deselect() {
+ mailbox.removeListener(this);
+ mailbox = null;
+ }
+
+
+ public void mailboxDeleted() {
+ try {
+ _session.closeConnection("Mailbox " + mailbox.getName() + " has been deleted");
+ } catch (MailboxManagerException e) {
+ }
+ }
+
+
+ public boolean isSizeChanged() {
+ return _sizeChanged;
+ }
+
+ public void setSizeChanged(boolean sizeChanged) {
+ _sizeChanged = sizeChanged;
+ }
+
+
+ public void close()
+ {
+ mailbox.close();
+ mailbox=null;
+ }
+
+ public void create()
+ {
+ throw new RuntimeException("should not create a selected mailbox");
+
+ }
+
+ public void expunged(MessageResult mr) {
+ expungedMsn.add(new Integer(mr.getSize()));
+ }
+
+ public void added(MessageResult mr) {
+ _sizeChanged = true;
+ }
+
+ public void flagsUpdated(MessageResult mr,MailboxListener silentListener) {
+ }
+
+ public ImapMailboxSession getMailbox() {
+ return mailbox;
+ }
+
+ public void mailboxRenamed(String origName, String newName) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void mailboxRenamed(String newName) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/SelectedMailboxSession.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AppendCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AppendCommand.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AppendCommand.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AppendCommand.java Tue Oct 10 01:34:56 2006
@@ -1,319 +1,319 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.imapserver.commands;
-
-import java.io.ByteArrayInputStream;
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Date;
-
-import javax.mail.Flags;
-import javax.mail.internet.MimeMessage;
-
-import org.apache.james.imapserver.ImapRequestLineReader;
-import org.apache.james.imapserver.ImapResponse;
-import org.apache.james.imapserver.ImapSession;
-import org.apache.james.imapserver.ProtocolException;
-import org.apache.james.imapserver.store.MailboxException;
-import org.apache.james.mailboxmanager.MailboxManagerException;
-import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
-
-/**
- * Handles processeing for the APPEND imap command.
- *
- * @author Darrell DeBoer <da...@apache.org>
- *
- * @version $Revision: 109034 $
- */
-class AppendCommand extends AuthenticatedStateCommand
-{
- public static final String NAME = "APPEND";
- public static final String ARGS = "<mailbox> [<flag_list>] [<date_time>] literal";
-
- private AppendCommandParser parser = new AppendCommandParser();
-
- /** @see CommandTemplate#doProcess */
- protected void doProcess( ImapRequestLineReader request,
- ImapResponse response,
- ImapSession session )
- throws ProtocolException, MailboxException
- {
- String mailboxName = parser.mailbox( request );
- Flags flags = parser.optionalAppendFlags( request );
- if ( flags == null ) {
- flags = new Flags();
- }
- Date datetime = parser.optionalDateTime( request );
- if ( datetime == null ) {
- datetime = new Date();
- }
- MimeMessage message = parser.mimeMessage( request );
- parser.endLine( request );
-
- ImapMailboxSession mailbox = null;
- try {
- mailboxName=session.buildFullName(mailboxName);
- mailbox = (ImapMailboxSession) session.getMailboxManager().getGenericGeneralMailboxSession(mailboxName);
- }
- catch ( MailboxManagerException mme ) {
- MailboxException me = new MailboxException(mme);
- me.setResponseCode( "TRYCREATE" );
- throw me;
- }
-
- try {
- mailbox.appendMessage( message, datetime ,0);
- } catch (MailboxManagerException e) {
- // TODO why not TRYCREATE?
- throw new MailboxException(e);
- }
-
- session.unsolicitedResponses( response, false);
- response.commandComplete( this );
- }
-
- /** @see ImapCommand#getName */
- public String getName()
- {
- return NAME;
- }
-
- /** @see CommandTemplate#getArgSyntax */
- public String getArgSyntax()
- {
- return ARGS;
- }
-
- private class AppendCommandParser extends CommandParser
- {
- /**
- * If the next character in the request is a '(', tries to read
- * a "flag_list" argument from the request. If not, returns a
- * MessageFlags with no flags set.
- */
- public Flags optionalAppendFlags( ImapRequestLineReader request )
- throws ProtocolException
- {
- char next = request.nextWordChar();
- if ( next == '(' ) {
- return flagList( request );
- }
- else {
- return null;
- }
- }
-
- /**
- * If the next character in the request is a '"', tries to read
- * a DateTime argument. If not, returns null.
- */
- public Date optionalDateTime( ImapRequestLineReader request )
- throws ProtocolException
- {
- char next = request.nextWordChar();
- if ( next == '"' ) {
- return dateTime( request );
- }
- else {
- return null;
- }
- }
-
- /**
- * Reads a MimeMessage encoded as a string literal from the request.
- * TODO shouldn't need to read as a string and write out bytes
- * use FixedLengthInputStream instead. Hopefully it can then be dynamic.
- * @param request The Imap APPEND request
- * @return A MimeMessage read off the request.
- */
- public MimeMessage mimeMessage( ImapRequestLineReader request )
- throws ProtocolException
- {
- request.nextWordChar();
- String mailString = consumeLiteral(request);
- MimeMessage mm = null;
-
- try {
- byte[] messageBytes = mailString.getBytes("US-ASCII");
- mm = new MimeMessage(null, new ByteArrayInputStream(
- messageBytes));
- } catch (Exception e) {
- throw new ProtocolException("UnexpectedException: "
- + e.getMessage());
-
- }
- return mm;
- }
- }
-
- /**
- * This class is not yet used in the AppendCommand.
- *
- * An input stream which reads a fixed number of bytes from the underlying
- * input stream. Once the number of bytes has been read, the FixedLengthInputStream
- * will act as thought the end of stream has been reached, even if more bytes are
- * present in the underlying input stream.
- */
- class FixedLengthInputStream extends FilterInputStream
- {
- private long pos = 0;
- private long length;
-
- public FixedLengthInputStream( InputStream in, long length )
- {
- super( in );
- this.length = length;
- }
-
- public int read() throws IOException
- {
- if ( pos >= length ) {
- return -1;
- }
- pos++;
- return super.read();
- }
-
- public int read( byte b[] ) throws IOException
- {
- if ( pos >= length ) {
- return -1;
- }
-
- if ( pos + b.length >= length ) {
- pos = length;
- return super.read( b, 0, (int) (length - pos) );
- }
-
- pos += b.length;
- return super.read( b );
- }
-
- public int read( byte b[], int off, int len ) throws IOException
- {
- throw new IOException("Not implemented");
-// return super.read( b, off, len );
- }
-
- public long skip( long n ) throws IOException
- {
- throw new IOException( "Not implemented" );
-// return super.skip( n );
- }
-
- public int available() throws IOException
- {
- return super.available();
- }
-
- public void close() throws IOException
- {
- // Don't do anything to the underlying stream.
- }
-
- public synchronized void mark( int readlimit )
- {
- // Don't do anything.
- }
-
- public synchronized void reset() throws IOException
- {
- throw new IOException( "mark not supported" );
- }
-
- public boolean markSupported()
- {
- return false;
- }
- }
-}
-/*
-6.3.11. APPEND Command
-
- Arguments: mailbox name
- OPTIONAL flag parenthesized list
- OPTIONAL date/time string
- message literal
-
- Responses: no specific responses for this command
-
- Result: OK - append completed
- NO - append error: can't append to that mailbox, error
- in flags or date/time or message text
- BAD - command unknown or arguments invalid
-
- The APPEND command appends the literal argument as a new message
- to the end of the specified destination mailbox. This argument
- SHOULD be in the format of an [RFC-822] message. 8-bit characters
- are permitted in the message. A server implementation that is
- unable to preserve 8-bit data properly MUST be able to reversibly
- convert 8-bit APPEND data to 7-bit using a [MIME-IMB] content
- transfer encoding.
-
- Note: There MAY be exceptions, e.g. draft messages, in which
- required [RFC-822] header lines are omitted in the message literal
- argument to APPEND. The full implications of doing so MUST be
- understood and carefully weighed.
-
- If a flag parenthesized list is specified, the flags SHOULD be set in
- the resulting message; otherwise, the flag list of the resulting
- message is set empty by default.
-
- If a date_time is specified, the internal date SHOULD be set in the
- resulting message; otherwise, the internal date of the resulting
- message is set to the current date and time by default.
-
- If the append is unsuccessful for any reason, the mailbox MUST be
- restored to its state before the APPEND attempt; no partial appending
- is permitted.
-
- If the destination mailbox does not exist, a server MUST return an
- error, and MUST NOT automatically create the mailbox. Unless it is
- certain that the destination mailbox can not be created, the server
- MUST send the response code "[TRYCREATE]" as the prefix of the text
- of the tagged NO response. This gives a hint to the client that it
- can attempt a CREATE command and retry the APPEND if the CREATE is
- successful.
-
- If the mailbox is currently selected, the normal new mail actions
- SHOULD occur. Specifically, the server SHOULD notify the client
- immediately via an untagged EXISTS response. If the server does not
- do so, the client MAY issue a NOOP command (or failing that, a CHECK
- command) after one or more APPEND commands.
-
- Example: C: A003 APPEND saved-messages (\Seen) {310}
- C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
- C: From: Fred Foobar <fo...@Blurdybloop.COM>
- C: Subject: afternoon meeting
- C: To: mooch@owatagu.siam.edu
- C: Message-Id: <B2...@Blurdybloop.COM>
- C: MIME-Version: 1.0
- C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
- C:
- C: Hello Joe, do you think we can meet at 3:30 tomorrow?
- C:
- S: A003 OK APPEND completed
-
- Note: the APPEND command is not used for message delivery, because
- it does not provide a mechanism to transfer [SMTP] envelope
- information.
-
-*/
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.imapserver.commands;
+
+import java.io.ByteArrayInputStream;
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+
+import javax.mail.Flags;
+import javax.mail.internet.MimeMessage;
+
+import org.apache.james.imapserver.ImapRequestLineReader;
+import org.apache.james.imapserver.ImapResponse;
+import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.store.MailboxException;
+import org.apache.james.mailboxmanager.MailboxManagerException;
+import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
+
+/**
+ * Handles processeing for the APPEND imap command.
+ *
+ * @author Darrell DeBoer <da...@apache.org>
+ *
+ * @version $Revision: 109034 $
+ */
+class AppendCommand extends AuthenticatedStateCommand
+{
+ public static final String NAME = "APPEND";
+ public static final String ARGS = "<mailbox> [<flag_list>] [<date_time>] literal";
+
+ private AppendCommandParser parser = new AppendCommandParser();
+
+ /** @see CommandTemplate#doProcess */
+ protected void doProcess( ImapRequestLineReader request,
+ ImapResponse response,
+ ImapSession session )
+ throws ProtocolException, MailboxException
+ {
+ String mailboxName = parser.mailbox( request );
+ Flags flags = parser.optionalAppendFlags( request );
+ if ( flags == null ) {
+ flags = new Flags();
+ }
+ Date datetime = parser.optionalDateTime( request );
+ if ( datetime == null ) {
+ datetime = new Date();
+ }
+ MimeMessage message = parser.mimeMessage( request );
+ parser.endLine( request );
+
+ ImapMailboxSession mailbox = null;
+ try {
+ mailboxName=session.buildFullName(mailboxName);
+ mailbox = (ImapMailboxSession) session.getMailboxManager().getGenericGeneralMailboxSession(mailboxName);
+ }
+ catch ( MailboxManagerException mme ) {
+ MailboxException me = new MailboxException(mme);
+ me.setResponseCode( "TRYCREATE" );
+ throw me;
+ }
+
+ try {
+ mailbox.appendMessage( message, datetime ,0);
+ } catch (MailboxManagerException e) {
+ // TODO why not TRYCREATE?
+ throw new MailboxException(e);
+ }
+
+ session.unsolicitedResponses( response, false);
+ response.commandComplete( this );
+ }
+
+ /** @see ImapCommand#getName */
+ public String getName()
+ {
+ return NAME;
+ }
+
+ /** @see CommandTemplate#getArgSyntax */
+ public String getArgSyntax()
+ {
+ return ARGS;
+ }
+
+ private class AppendCommandParser extends CommandParser
+ {
+ /**
+ * If the next character in the request is a '(', tries to read
+ * a "flag_list" argument from the request. If not, returns a
+ * MessageFlags with no flags set.
+ */
+ public Flags optionalAppendFlags( ImapRequestLineReader request )
+ throws ProtocolException
+ {
+ char next = request.nextWordChar();
+ if ( next == '(' ) {
+ return flagList( request );
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * If the next character in the request is a '"', tries to read
+ * a DateTime argument. If not, returns null.
+ */
+ public Date optionalDateTime( ImapRequestLineReader request )
+ throws ProtocolException
+ {
+ char next = request.nextWordChar();
+ if ( next == '"' ) {
+ return dateTime( request );
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Reads a MimeMessage encoded as a string literal from the request.
+ * TODO shouldn't need to read as a string and write out bytes
+ * use FixedLengthInputStream instead. Hopefully it can then be dynamic.
+ * @param request The Imap APPEND request
+ * @return A MimeMessage read off the request.
+ */
+ public MimeMessage mimeMessage( ImapRequestLineReader request )
+ throws ProtocolException
+ {
+ request.nextWordChar();
+ String mailString = consumeLiteral(request);
+ MimeMessage mm = null;
+
+ try {
+ byte[] messageBytes = mailString.getBytes("US-ASCII");
+ mm = new MimeMessage(null, new ByteArrayInputStream(
+ messageBytes));
+ } catch (Exception e) {
+ throw new ProtocolException("UnexpectedException: "
+ + e.getMessage());
+
+ }
+ return mm;
+ }
+ }
+
+ /**
+ * This class is not yet used in the AppendCommand.
+ *
+ * An input stream which reads a fixed number of bytes from the underlying
+ * input stream. Once the number of bytes has been read, the FixedLengthInputStream
+ * will act as thought the end of stream has been reached, even if more bytes are
+ * present in the underlying input stream.
+ */
+ class FixedLengthInputStream extends FilterInputStream
+ {
+ private long pos = 0;
+ private long length;
+
+ public FixedLengthInputStream( InputStream in, long length )
+ {
+ super( in );
+ this.length = length;
+ }
+
+ public int read() throws IOException
+ {
+ if ( pos >= length ) {
+ return -1;
+ }
+ pos++;
+ return super.read();
+ }
+
+ public int read( byte b[] ) throws IOException
+ {
+ if ( pos >= length ) {
+ return -1;
+ }
+
+ if ( pos + b.length >= length ) {
+ pos = length;
+ return super.read( b, 0, (int) (length - pos) );
+ }
+
+ pos += b.length;
+ return super.read( b );
+ }
+
+ public int read( byte b[], int off, int len ) throws IOException
+ {
+ throw new IOException("Not implemented");
+// return super.read( b, off, len );
+ }
+
+ public long skip( long n ) throws IOException
+ {
+ throw new IOException( "Not implemented" );
+// return super.skip( n );
+ }
+
+ public int available() throws IOException
+ {
+ return super.available();
+ }
+
+ public void close() throws IOException
+ {
+ // Don't do anything to the underlying stream.
+ }
+
+ public synchronized void mark( int readlimit )
+ {
+ // Don't do anything.
+ }
+
+ public synchronized void reset() throws IOException
+ {
+ throw new IOException( "mark not supported" );
+ }
+
+ public boolean markSupported()
+ {
+ return false;
+ }
+ }
+}
+/*
+6.3.11. APPEND Command
+
+ Arguments: mailbox name
+ OPTIONAL flag parenthesized list
+ OPTIONAL date/time string
+ message literal
+
+ Responses: no specific responses for this command
+
+ Result: OK - append completed
+ NO - append error: can't append to that mailbox, error
+ in flags or date/time or message text
+ BAD - command unknown or arguments invalid
+
+ The APPEND command appends the literal argument as a new message
+ to the end of the specified destination mailbox. This argument
+ SHOULD be in the format of an [RFC-822] message. 8-bit characters
+ are permitted in the message. A server implementation that is
+ unable to preserve 8-bit data properly MUST be able to reversibly
+ convert 8-bit APPEND data to 7-bit using a [MIME-IMB] content
+ transfer encoding.
+
+ Note: There MAY be exceptions, e.g. draft messages, in which
+ required [RFC-822] header lines are omitted in the message literal
+ argument to APPEND. The full implications of doing so MUST be
+ understood and carefully weighed.
+
+ If a flag parenthesized list is specified, the flags SHOULD be set in
+ the resulting message; otherwise, the flag list of the resulting
+ message is set empty by default.
+
+ If a date_time is specified, the internal date SHOULD be set in the
+ resulting message; otherwise, the internal date of the resulting
+ message is set to the current date and time by default.
+
+ If the append is unsuccessful for any reason, the mailbox MUST be
+ restored to its state before the APPEND attempt; no partial appending
+ is permitted.
+
+ If the destination mailbox does not exist, a server MUST return an
+ error, and MUST NOT automatically create the mailbox. Unless it is
+ certain that the destination mailbox can not be created, the server
+ MUST send the response code "[TRYCREATE]" as the prefix of the text
+ of the tagged NO response. This gives a hint to the client that it
+ can attempt a CREATE command and retry the APPEND if the CREATE is
+ successful.
+
+ If the mailbox is currently selected, the normal new mail actions
+ SHOULD occur. Specifically, the server SHOULD notify the client
+ immediately via an untagged EXISTS response. If the server does not
+ do so, the client MAY issue a NOOP command (or failing that, a CHECK
+ command) after one or more APPEND commands.
+
+ Example: C: A003 APPEND saved-messages (\Seen) {310}
+ C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+ C: From: Fred Foobar <fo...@Blurdybloop.COM>
+ C: Subject: afternoon meeting
+ C: To: mooch@owatagu.siam.edu
+ C: Message-Id: <B2...@Blurdybloop.COM>
+ C: MIME-Version: 1.0
+ C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+ C:
+ C: Hello Joe, do you think we can meet at 3:30 tomorrow?
+ C:
+ S: A003 OK APPEND completed
+
+ Note: the APPEND command is not used for message delivery, because
+ it does not provide a mechanism to transfer [SMTP] envelope
+ information.
+
+*/
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AppendCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AuthenticateCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AuthenticateCommand.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AuthenticateCommand.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AuthenticateCommand.java Tue Oct 10 01:34:56 2006
@@ -1,132 +1,132 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.imapserver.commands;
-
-import org.apache.james.imapserver.ImapRequestLineReader;
-import org.apache.james.imapserver.ImapResponse;
-import org.apache.james.imapserver.ImapSession;
-import org.apache.james.imapserver.ProtocolException;
-
-/**
- * Handles processeing for the AUTHENTICATE imap command.
- *
- * @author Darrell DeBoer <da...@apache.org>
- *
- * @version $Revision: 109034 $
- */
-class AuthenticateCommand extends NonAuthenticatedStateCommand
-{
- public static final String NAME = "AUTHENTICATE";
- public static final String ARGS = "<auth_type> *(CRLF base64)";
-
- /** @see CommandTemplate#doProcess */
- protected void doProcess( ImapRequestLineReader request,
- ImapResponse response,
- ImapSession session
- ) throws ProtocolException
- {
- String authType = parser.astring( request );
- parser.endLine( request );
-
- response.commandFailed( this, "Unsupported authentication mechanism '" +
- authType + "'" );
- }
-
- /** @see ImapCommand#getName */
- public String getName()
- {
- return NAME;
- }
-
- /** @see CommandTemplate#getArgSyntax */
- public String getArgSyntax()
- {
- return ARGS;
- }
-}
-
-/*
-6.2.1. AUTHENTICATE Command
-
- Arguments: authentication mechanism name
-
- Responses: continuation data can be requested
-
- Result: OK - authenticate completed, now in authenticated state
- NO - authenticate failure: unsupported authentication
- mechanism, credentials rejected
- BAD - command unknown or arguments invalid,
- authentication exchange cancelled
-
- The AUTHENTICATE command indicates an authentication mechanism,
- such as described in [IMAP-AUTH], to the server. If the server
- supports the requested authentication mechanism, it performs an
- authentication protocol exchange to authenticate and identify the
- client. It MAY also negotiate an OPTIONAL protection mechanism
- for subsequent protocol interactions. If the requested
- authentication mechanism is not supported, the server SHOULD
- reject the AUTHENTICATE command by sending a tagged NO response.
-
- The authentication protocol exchange consists of a series of
- server challenges and client answers that are specific to the
- authentication mechanism. A server challenge consists of a
- command continuation request response with the "+" token followed
- by a BASE64 encoded string. The client answer consists of a line
- consisting of a BASE64 encoded string. If the client wishes to
- cancel an authentication exchange, it issues a line with a single
- "*". If the server receives such an answer, it MUST reject the
- AUTHENTICATE command by sending a tagged BAD response.
-
- A protection mechanism provides integrity and privacy protection
- to the connection. If a protection mechanism is negotiated, it is
- applied to all subsequent data sent over the connection. The
- protection mechanism takes effect immediately following the CRLF
- that concludes the authentication exchange for the client, and the
- CRLF of the tagged OK response for the server. Once the
- protection mechanism is in effect, the stream of command and
- response octets is processed into buffers of ciphertext. Each
- buffer is transferred over the connection as a stream of octets
- prepended with a four octet field in network byte order that
- represents the length of the following data. The maximum
- ciphertext buffer length is defined by the protection mechanism.
-
- Authentication mechanisms are OPTIONAL. Protection mechanisms are
- also OPTIONAL; an authentication mechanism MAY be implemented
- without any protection mechanism. If an AUTHENTICATE command
- fails with a NO response, the client MAY try another
- authentication mechanism by issuing another AUTHENTICATE command,
- or MAY attempt to authenticate by using the LOGIN command. In
- other words, the client MAY request authentication types in
- decreasing order of preference, with the LOGIN command as a last
- resort.
-
- Example: S: * OK KerberosV4 IMAP4rev1 Server
- C: A001 AUTHENTICATE KERBEROS_V4
- S: + AmFYig==
- C: BAcAQU5EUkVXLkNNVS5FRFUAOCAsho84kLN3/IJmrMG+25a4DT
- +nZImJjnTNHJUtxAA+o0KPKfHEcAFs9a3CL5Oebe/ydHJUwYFd
- WwuQ1MWiy6IesKvjL5rL9WjXUb9MwT9bpObYLGOKi1Qh
- S: + or//EoAADZI=
- C: DiAF5A4gA+oOIALuBkAAmw==
- S: A001 OK Kerberos V4 authentication successful
-
- Note: the line breaks in the first client answer are for editorial
- clarity and are not in real authenticators.
-*/
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.imapserver.commands;
+
+import org.apache.james.imapserver.ImapRequestLineReader;
+import org.apache.james.imapserver.ImapResponse;
+import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.ProtocolException;
+
+/**
+ * Handles processeing for the AUTHENTICATE imap command.
+ *
+ * @author Darrell DeBoer <da...@apache.org>
+ *
+ * @version $Revision: 109034 $
+ */
+class AuthenticateCommand extends NonAuthenticatedStateCommand
+{
+ public static final String NAME = "AUTHENTICATE";
+ public static final String ARGS = "<auth_type> *(CRLF base64)";
+
+ /** @see CommandTemplate#doProcess */
+ protected void doProcess( ImapRequestLineReader request,
+ ImapResponse response,
+ ImapSession session
+ ) throws ProtocolException
+ {
+ String authType = parser.astring( request );
+ parser.endLine( request );
+
+ response.commandFailed( this, "Unsupported authentication mechanism '" +
+ authType + "'" );
+ }
+
+ /** @see ImapCommand#getName */
+ public String getName()
+ {
+ return NAME;
+ }
+
+ /** @see CommandTemplate#getArgSyntax */
+ public String getArgSyntax()
+ {
+ return ARGS;
+ }
+}
+
+/*
+6.2.1. AUTHENTICATE Command
+
+ Arguments: authentication mechanism name
+
+ Responses: continuation data can be requested
+
+ Result: OK - authenticate completed, now in authenticated state
+ NO - authenticate failure: unsupported authentication
+ mechanism, credentials rejected
+ BAD - command unknown or arguments invalid,
+ authentication exchange cancelled
+
+ The AUTHENTICATE command indicates an authentication mechanism,
+ such as described in [IMAP-AUTH], to the server. If the server
+ supports the requested authentication mechanism, it performs an
+ authentication protocol exchange to authenticate and identify the
+ client. It MAY also negotiate an OPTIONAL protection mechanism
+ for subsequent protocol interactions. If the requested
+ authentication mechanism is not supported, the server SHOULD
+ reject the AUTHENTICATE command by sending a tagged NO response.
+
+ The authentication protocol exchange consists of a series of
+ server challenges and client answers that are specific to the
+ authentication mechanism. A server challenge consists of a
+ command continuation request response with the "+" token followed
+ by a BASE64 encoded string. The client answer consists of a line
+ consisting of a BASE64 encoded string. If the client wishes to
+ cancel an authentication exchange, it issues a line with a single
+ "*". If the server receives such an answer, it MUST reject the
+ AUTHENTICATE command by sending a tagged BAD response.
+
+ A protection mechanism provides integrity and privacy protection
+ to the connection. If a protection mechanism is negotiated, it is
+ applied to all subsequent data sent over the connection. The
+ protection mechanism takes effect immediately following the CRLF
+ that concludes the authentication exchange for the client, and the
+ CRLF of the tagged OK response for the server. Once the
+ protection mechanism is in effect, the stream of command and
+ response octets is processed into buffers of ciphertext. Each
+ buffer is transferred over the connection as a stream of octets
+ prepended with a four octet field in network byte order that
+ represents the length of the following data. The maximum
+ ciphertext buffer length is defined by the protection mechanism.
+
+ Authentication mechanisms are OPTIONAL. Protection mechanisms are
+ also OPTIONAL; an authentication mechanism MAY be implemented
+ without any protection mechanism. If an AUTHENTICATE command
+ fails with a NO response, the client MAY try another
+ authentication mechanism by issuing another AUTHENTICATE command,
+ or MAY attempt to authenticate by using the LOGIN command. In
+ other words, the client MAY request authentication types in
+ decreasing order of preference, with the LOGIN command as a last
+ resort.
+
+ Example: S: * OK KerberosV4 IMAP4rev1 Server
+ C: A001 AUTHENTICATE KERBEROS_V4
+ S: + AmFYig==
+ C: BAcAQU5EUkVXLkNNVS5FRFUAOCAsho84kLN3/IJmrMG+25a4DT
+ +nZImJjnTNHJUtxAA+o0KPKfHEcAFs9a3CL5Oebe/ydHJUwYFd
+ WwuQ1MWiy6IesKvjL5rL9WjXUb9MwT9bpObYLGOKi1Qh
+ S: + or//EoAADZI=
+ C: DiAF5A4gA+oOIALuBkAAmw==
+ S: A001 OK Kerberos V4 authentication successful
+
+ Note: the line breaks in the first client answer are for editorial
+ clarity and are not in real authenticators.
+*/
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AuthenticateCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AuthenticatedStateCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AuthenticatedStateCommand.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AuthenticatedStateCommand.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AuthenticatedStateCommand.java Tue Oct 10 01:34:56 2006
@@ -1,42 +1,42 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.imapserver.commands;
-
-import org.apache.james.imapserver.ImapSessionState;
-
-/**
- * A base class for ImapCommands only valid in AUTHENTICATED and SELECTED states.
- *
- * @author Darrell DeBoer <da...@apache.org>
- *
- * @version $Revision: 109034 $
- */
-abstract class AuthenticatedStateCommand extends CommandTemplate
-{
- /**
- * Check that the state is {@link ImapSessionState#AUTHENTICATED } or
- * {@link ImapSessionState#SELECTED}
- */
- public boolean validForState( ImapSessionState state )
- {
- return ( state == ImapSessionState.AUTHENTICATED
- || state == ImapSessionState.SELECTED );
- }
-}
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.imapserver.commands;
+
+import org.apache.james.imapserver.ImapSessionState;
+
+/**
+ * A base class for ImapCommands only valid in AUTHENTICATED and SELECTED states.
+ *
+ * @author Darrell DeBoer <da...@apache.org>
+ *
+ * @version $Revision: 109034 $
+ */
+abstract class AuthenticatedStateCommand extends CommandTemplate
+{
+ /**
+ * Check that the state is {@link ImapSessionState#AUTHENTICATED } or
+ * {@link ImapSessionState#SELECTED}
+ */
+ public boolean validForState( ImapSessionState state )
+ {
+ return ( state == ImapSessionState.AUTHENTICATED
+ || state == ImapSessionState.SELECTED );
+ }
+}
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/AuthenticatedStateCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CapabilityCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CapabilityCommand.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CapabilityCommand.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CapabilityCommand.java Tue Oct 10 01:34:56 2006
@@ -1,135 +1,135 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.imapserver.commands;
-
-import org.apache.james.imapserver.ImapRequestLineReader;
-import org.apache.james.imapserver.ImapResponse;
-import org.apache.james.imapserver.ImapSession;
-import org.apache.james.imapserver.ProtocolException;
-import org.apache.james.imapserver.store.MailboxException;
-
-/**
- * Handles processeing for the CAPABILITY imap command.
- *
- * @author Darrell DeBoer <da...@apache.org>
- *
- * @version $Revision: 109034 $
- */
-class CapabilityCommand extends CommandTemplate
-{
- public static final String NAME = "CAPABILITY";
- public static final String ARGS = null;
-
- public static final String CAPABILITY_RESPONSE = NAME + SP + VERSION + SP + CAPABILITIES;
-
- /** @see CommandTemplate#doProcess */
- protected void doProcess( ImapRequestLineReader request,
- ImapResponse response,
- ImapSession session )
- throws ProtocolException, MailboxException
- {
- parser.endLine( request );
- response.untaggedResponse( CAPABILITY_RESPONSE );
- session.unsolicitedResponses( response, false);
- response.commandComplete( this );
- }
-
- /** @see ImapCommand#getName */
- public String getName()
- {
- return NAME;
- }
-
- /** @see CommandTemplate#getArgSyntax */
- public String getArgSyntax()
- {
- return ARGS;
- }
-}
-
-/*
-6.1.1. CAPABILITY Command
-
- Arguments: none
-
- Responses: REQUIRED untagged response: CAPABILITY
-
- Result: OK - capability completed
- BAD - command unknown or arguments invalid
-
- The CAPABILITY command requests a listing of capabilities that the
- server supports. The server MUST send a single untagged
- CAPABILITY response with "IMAP4rev1" as one of the listed
- capabilities before the (tagged) OK response. This listing of
- capabilities is not dependent upon connection state or user. It
- is therefore not necessary to issue a CAPABILITY command more than
- once in a connection.
-
- A capability name which begins with "AUTH=" indicates that the
- server supports that particular authentication mechanism. All
- such names are, by definition, part of this specification. For
- example, the authorization capability for an experimental
- "blurdybloop" authenticator would be "AUTH=XBLURDYBLOOP" and not
- "XAUTH=BLURDYBLOOP" or "XAUTH=XBLURDYBLOOP".
-
- Other capability names refer to extensions, revisions, or
- amendments to this specification. See the documentation of the
- CAPABILITY response for additional information. No capabilities,
- beyond the base IMAP4rev1 set defined in this specification, are
- enabled without explicit client action to invoke the capability.
-
- See the section entitled "Client Commands -
- Experimental/Expansion" for information about the form of site or
- implementation-specific capabilities.
-
- Example: C: abcd CAPABILITY
- S: * CAPABILITY IMAP4rev1 AUTH=KERBEROS_V4
- S: abcd OK CAPABILITY completed
-
-
-7.2.1. CAPABILITY Response
-
- Contents: capability listing
-
- The CAPABILITY response occurs as a result of a CAPABILITY
- command. The capability listing contains a space-separated
- listing of capability names that the server supports. The
- capability listing MUST include the atom "IMAP4rev1".
-
- A capability name which begins with "AUTH=" indicates that the
- server supports that particular authentication mechanism.
- Other capability names indicate that the server supports an
- extension, revision, or amendment to the IMAP4rev1 protocol.
- Server responses MUST conform to this document until the client
- issues a command that uses the associated capability.
-
- Capability names MUST either begin with "X" or be standard or
- standards-track IMAP4rev1 extensions, revisions, or amendments
- registered with IANA. A server MUST NOT offer unregistered or
- non-standard capability names, unless such names are prefixed with
- an "X".
-
- Client implementations SHOULD NOT require any capability name
- other than "IMAP4rev1", and MUST ignore any unknown capability
- names.
-
- Example: S: * CAPABILITY IMAP4rev1 AUTH=KERBEROS_V4 XPIG-LATIN
-
-*/
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.imapserver.commands;
+
+import org.apache.james.imapserver.ImapRequestLineReader;
+import org.apache.james.imapserver.ImapResponse;
+import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.store.MailboxException;
+
+/**
+ * Handles processeing for the CAPABILITY imap command.
+ *
+ * @author Darrell DeBoer <da...@apache.org>
+ *
+ * @version $Revision: 109034 $
+ */
+class CapabilityCommand extends CommandTemplate
+{
+ public static final String NAME = "CAPABILITY";
+ public static final String ARGS = null;
+
+ public static final String CAPABILITY_RESPONSE = NAME + SP + VERSION + SP + CAPABILITIES;
+
+ /** @see CommandTemplate#doProcess */
+ protected void doProcess( ImapRequestLineReader request,
+ ImapResponse response,
+ ImapSession session )
+ throws ProtocolException, MailboxException
+ {
+ parser.endLine( request );
+ response.untaggedResponse( CAPABILITY_RESPONSE );
+ session.unsolicitedResponses( response, false);
+ response.commandComplete( this );
+ }
+
+ /** @see ImapCommand#getName */
+ public String getName()
+ {
+ return NAME;
+ }
+
+ /** @see CommandTemplate#getArgSyntax */
+ public String getArgSyntax()
+ {
+ return ARGS;
+ }
+}
+
+/*
+6.1.1. CAPABILITY Command
+
+ Arguments: none
+
+ Responses: REQUIRED untagged response: CAPABILITY
+
+ Result: OK - capability completed
+ BAD - command unknown or arguments invalid
+
+ The CAPABILITY command requests a listing of capabilities that the
+ server supports. The server MUST send a single untagged
+ CAPABILITY response with "IMAP4rev1" as one of the listed
+ capabilities before the (tagged) OK response. This listing of
+ capabilities is not dependent upon connection state or user. It
+ is therefore not necessary to issue a CAPABILITY command more than
+ once in a connection.
+
+ A capability name which begins with "AUTH=" indicates that the
+ server supports that particular authentication mechanism. All
+ such names are, by definition, part of this specification. For
+ example, the authorization capability for an experimental
+ "blurdybloop" authenticator would be "AUTH=XBLURDYBLOOP" and not
+ "XAUTH=BLURDYBLOOP" or "XAUTH=XBLURDYBLOOP".
+
+ Other capability names refer to extensions, revisions, or
+ amendments to this specification. See the documentation of the
+ CAPABILITY response for additional information. No capabilities,
+ beyond the base IMAP4rev1 set defined in this specification, are
+ enabled without explicit client action to invoke the capability.
+
+ See the section entitled "Client Commands -
+ Experimental/Expansion" for information about the form of site or
+ implementation-specific capabilities.
+
+ Example: C: abcd CAPABILITY
+ S: * CAPABILITY IMAP4rev1 AUTH=KERBEROS_V4
+ S: abcd OK CAPABILITY completed
+
+
+7.2.1. CAPABILITY Response
+
+ Contents: capability listing
+
+ The CAPABILITY response occurs as a result of a CAPABILITY
+ command. The capability listing contains a space-separated
+ listing of capability names that the server supports. The
+ capability listing MUST include the atom "IMAP4rev1".
+
+ A capability name which begins with "AUTH=" indicates that the
+ server supports that particular authentication mechanism.
+ Other capability names indicate that the server supports an
+ extension, revision, or amendment to the IMAP4rev1 protocol.
+ Server responses MUST conform to this document until the client
+ issues a command that uses the associated capability.
+
+ Capability names MUST either begin with "X" or be standard or
+ standards-track IMAP4rev1 extensions, revisions, or amendments
+ registered with IANA. A server MUST NOT offer unregistered or
+ non-standard capability names, unless such names are prefixed with
+ an "X".
+
+ Client implementations SHOULD NOT require any capability name
+ other than "IMAP4rev1", and MUST ignore any unknown capability
+ names.
+
+ Example: S: * CAPABILITY IMAP4rev1 AUTH=KERBEROS_V4 XPIG-LATIN
+
+*/
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CapabilityCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CheckCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CheckCommand.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CheckCommand.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CheckCommand.java Tue Oct 10 01:34:56 2006
@@ -1,61 +1,61 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.imapserver.commands;
-
-import org.apache.james.imapserver.ImapRequestLineReader;
-import org.apache.james.imapserver.ImapResponse;
-import org.apache.james.imapserver.ImapSession;
-import org.apache.james.imapserver.ProtocolException;
-import org.apache.james.imapserver.store.MailboxException;
-
-/**
- * Handles processeing for the CHECK imap command.
- *
- * @author Darrell DeBoer <da...@apache.org>
- *
- * @version $Revision: 109034 $
- */
-class CheckCommand extends SelectedStateCommand
-{
- public static final String NAME = "CHECK";
- public static final String ARGS = null;
-
- /** @see CommandTemplate#doProcess */
- protected void doProcess( ImapRequestLineReader request,
- ImapResponse response,
- ImapSession session ) throws ProtocolException, MailboxException
- {
- parser.endLine( request );
- session.unsolicitedResponses( response , false);
- response.commandComplete( this );
- }
-
- /** @see ImapCommand#getName */
- public String getName()
- {
- return NAME;
- }
-
- /** @see CommandTemplate#getArgSyntax */
- public String getArgSyntax()
- {
- return ARGS;
- }
-}
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.imapserver.commands;
+
+import org.apache.james.imapserver.ImapRequestLineReader;
+import org.apache.james.imapserver.ImapResponse;
+import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.store.MailboxException;
+
+/**
+ * Handles processeing for the CHECK imap command.
+ *
+ * @author Darrell DeBoer <da...@apache.org>
+ *
+ * @version $Revision: 109034 $
+ */
+class CheckCommand extends SelectedStateCommand
+{
+ public static final String NAME = "CHECK";
+ public static final String ARGS = null;
+
+ /** @see CommandTemplate#doProcess */
+ protected void doProcess( ImapRequestLineReader request,
+ ImapResponse response,
+ ImapSession session ) throws ProtocolException, MailboxException
+ {
+ parser.endLine( request );
+ session.unsolicitedResponses( response , false);
+ response.commandComplete( this );
+ }
+
+ /** @see ImapCommand#getName */
+ public String getName()
+ {
+ return NAME;
+ }
+
+ /** @see CommandTemplate#getArgSyntax */
+ public String getArgSyntax()
+ {
+ return ARGS;
+ }
+}
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CheckCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CloseCommand.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CloseCommand.java?view=diff&rev=454662&r1=454661&r2=454662
==============================================================================
--- james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CloseCommand.java (original)
+++ james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CloseCommand.java Tue Oct 10 01:34:56 2006
@@ -1,110 +1,110 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.imapserver.commands;
-
-import org.apache.james.imapserver.ImapRequestLineReader;
-import org.apache.james.imapserver.ImapResponse;
-import org.apache.james.imapserver.ImapSession;
-import org.apache.james.imapserver.ProtocolException;
-import org.apache.james.imapserver.store.MailboxException;
-import org.apache.james.mailboxmanager.GeneralMessageSet;
-import org.apache.james.mailboxmanager.MailboxManagerException;
-import org.apache.james.mailboxmanager.impl.GeneralMessageSetImpl;
-import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
-
-/**
- * Handles processeing for the CHECK imap command.
- *
- * @author Darrell DeBoer <da...@apache.org>
- *
- * @version $Revision: 109034 $
- */
-class CloseCommand extends SelectedStateCommand
-{
- public static final String NAME = "CLOSE";
- public static final String ARGS = null;
-
- /** @see CommandTemplate#doProcess */
- protected void doProcess( ImapRequestLineReader request,
- ImapResponse response,
- ImapSession session )
- throws ProtocolException, MailboxException
- {
- parser.endLine( request );
- ImapMailboxSession mailbox = session.getSelected().getMailbox();
- if ( session.getSelected().getMailbox().isWriteable() ) {
- try {
- mailbox.expunge(GeneralMessageSetImpl.all(),GeneralMessageSet.TYPE_NONE);
- } catch (MailboxManagerException e) {
- throw new MailboxException(e);
- }
- }
- session.deselect();
-
-// Don't send unsolicited responses on close.
- session.unsolicitedResponses( response, false );
- response.commandComplete( this );
- }
-
-
- /** @see ImapCommand#getName */
- public String getName()
- {
- return NAME;
- }
-
- /** @see CommandTemplate#getArgSyntax */
- public String getArgSyntax()
- {
- return ARGS;
- }
-}
-/*
-6.4.2. CLOSE Command
-
- Arguments: none
-
- Responses: no specific responses for this command
-
- Result: OK - close completed, now in authenticated state
- NO - close failure: no mailbox selected
- BAD - command unknown or arguments invalid
-
- The CLOSE command permanently removes from the currently selected
- mailbox all messages that have the \Deleted flag set, and returns
- to authenticated state from selected state. No untagged EXPUNGE
- responses are sent.
-
- No messages are removed, and no error is given, if the mailbox is
- selected by an EXAMINE command or is otherwise selected read-only.
-
- Even if a mailbox is selected, a SELECT, EXAMINE, or LOGOUT
- command MAY be issued without previously issuing a CLOSE command.
- The SELECT, EXAMINE, and LOGOUT commands implicitly close the
- currently selected mailbox without doing an expunge. However,
- when many messages are deleted, a CLOSE-LOGOUT or CLOSE-SELECT
-
- sequence is considerably faster than an EXPUNGE-LOGOUT or
- EXPUNGE-SELECT because no untagged EXPUNGE responses (which the
- client would probably ignore) are sent.
-
- Example: C: A341 CLOSE
- S: A341 OK CLOSE completed
-*/
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.imapserver.commands;
+
+import org.apache.james.imapserver.ImapRequestLineReader;
+import org.apache.james.imapserver.ImapResponse;
+import org.apache.james.imapserver.ImapSession;
+import org.apache.james.imapserver.ProtocolException;
+import org.apache.james.imapserver.store.MailboxException;
+import org.apache.james.mailboxmanager.GeneralMessageSet;
+import org.apache.james.mailboxmanager.MailboxManagerException;
+import org.apache.james.mailboxmanager.impl.GeneralMessageSetImpl;
+import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
+
+/**
+ * Handles processeing for the CHECK imap command.
+ *
+ * @author Darrell DeBoer <da...@apache.org>
+ *
+ * @version $Revision: 109034 $
+ */
+class CloseCommand extends SelectedStateCommand
+{
+ public static final String NAME = "CLOSE";
+ public static final String ARGS = null;
+
+ /** @see CommandTemplate#doProcess */
+ protected void doProcess( ImapRequestLineReader request,
+ ImapResponse response,
+ ImapSession session )
+ throws ProtocolException, MailboxException
+ {
+ parser.endLine( request );
+ ImapMailboxSession mailbox = session.getSelected().getMailbox();
+ if ( session.getSelected().getMailbox().isWriteable() ) {
+ try {
+ mailbox.expunge(GeneralMessageSetImpl.all(),GeneralMessageSet.TYPE_NONE);
+ } catch (MailboxManagerException e) {
+ throw new MailboxException(e);
+ }
+ }
+ session.deselect();
+
+// Don't send unsolicited responses on close.
+ session.unsolicitedResponses( response, false );
+ response.commandComplete( this );
+ }
+
+
+ /** @see ImapCommand#getName */
+ public String getName()
+ {
+ return NAME;
+ }
+
+ /** @see CommandTemplate#getArgSyntax */
+ public String getArgSyntax()
+ {
+ return ARGS;
+ }
+}
+/*
+6.4.2. CLOSE Command
+
+ Arguments: none
+
+ Responses: no specific responses for this command
+
+ Result: OK - close completed, now in authenticated state
+ NO - close failure: no mailbox selected
+ BAD - command unknown or arguments invalid
+
+ The CLOSE command permanently removes from the currently selected
+ mailbox all messages that have the \Deleted flag set, and returns
+ to authenticated state from selected state. No untagged EXPUNGE
+ responses are sent.
+
+ No messages are removed, and no error is given, if the mailbox is
+ selected by an EXAMINE command or is otherwise selected read-only.
+
+ Even if a mailbox is selected, a SELECT, EXAMINE, or LOGOUT
+ command MAY be issued without previously issuing a CLOSE command.
+ The SELECT, EXAMINE, and LOGOUT commands implicitly close the
+ currently selected mailbox without doing an expunge. However,
+ when many messages are deleted, a CLOSE-LOGOUT or CLOSE-SELECT
+
+ sequence is considerably faster than an EXPUNGE-LOGOUT or
+ EXPUNGE-SELECT because no untagged EXPUNGE responses (which the
+ client would probably ignore) are sent.
+
+ Example: C: A341 CLOSE
+ S: A341 OK CLOSE completed
+*/
Propchange: james/server/sandbox/imap-integration/src/java/org/apache/james/imapserver/commands/CloseCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org