james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r730705 - in /james/protocols/imap/trunk: api/src/main/java/org/apache/james/api/imap/ message/src/main/java/org/apache/james/imap/encode/ message/src/main/java/org/apache/james/imap/encode/base/ message/src/main/java/org/apache/james/imap/...
Date Fri, 02 Jan 2009 12:19:40 GMT
Author: rdonkin
Date: Fri Jan  2 04:19:39 2009
New Revision: 730705

URL: http://svn.apache.org/viewvc?rev=730705&view=rev
Log:
Switch CAPABILITY response from old framework.

Added:
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/imap4rev1/server/CapabilityResponseEncoder.java
  (contents, props changed)
      - copied, changed from r730681, james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/imap4rev1/legacy/CapabilityResponseEncoder.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/imap4rev1/server/CapabilityResponse.java
  (contents, props changed)
      - copied, changed from r730681, james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/imap4rev1/legacy/CapabilityResponse.java
Removed:
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/imap4rev1/legacy/
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/base/AbstractImapResponse.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/imap4rev1/legacy/
Modified:
    james/protocols/imap/trunk/api/src/main/java/org/apache/james/api/imap/ImapConstants.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/AbstractChainedImapEncoder.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java
    james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/main/DefaultImapEncoderFactory.java
    james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/ImapResponseCommandTest.java
    james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/ImapSessionUtils.java
    james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/CapabilityProcessor.java
    james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/Imap4Rev1ProcessorFactory.java

Modified: james/protocols/imap/trunk/api/src/main/java/org/apache/james/api/imap/ImapConstants.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/api/src/main/java/org/apache/james/api/imap/ImapConstants.java?rev=730705&r1=730704&r2=730705&view=diff
==============================================================================
--- james/protocols/imap/trunk/api/src/main/java/org/apache/james/api/imap/ImapConstants.java
(original)
+++ james/protocols/imap/trunk/api/src/main/java/org/apache/james/api/imap/ImapConstants.java
Fri Jan  2 04:19:39 2009
@@ -97,7 +97,7 @@
 
     String VERSION = "IMAP4rev1";
 
-    String CAPABILITIES = "LITERAL+";
+    String SUPPORTS_LITERAL_PLUS = "LITERAL+";
 
     String USER_NAMESPACE = "#mail";
 
@@ -203,9 +203,6 @@
 
     public static final String APPEND_COMMAND_NAME = "APPEND";
 
-    public static final String CAPABILITY_RESPONSE = CAPABILITY_COMMAND_NAME
-            + SP + VERSION + SP + CAPABILITIES;
-
     public static final String LIST_RESPONSE_NAME = "LIST";
 
     public static final String LSUB_RESPONSE_NAME = "LSUB";

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java?rev=730705&r1=730704&r2=730705&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java
(original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/ImapResponseComposer.java
Fri Jan  2 04:19:39 2009
@@ -31,36 +31,6 @@
 public interface ImapResponseComposer {
 
     /**
-     * Writes a standard tagged OK response on completion of a command. Response
-     * is writen as:
-     * 
-     * <pre>
-     *        a01 OK COMMAND_NAME completed.
-     * </pre>
-     * 
-     * @param command
-     *            The ImapCommand which was completed.
-     */
-    public abstract void commandComplete(final ImapCommand command,
-            final String tag) throws IOException;
-
-    /**
-     * Writes a standard tagged OK response on completion of a command, with a
-     * response code (eg READ-WRITE) Response is writen as:
-     * 
-     * <pre>
-     *        a01 OK [responseCode] COMMAND_NAME completed.
-     * </pre>
-     * 
-     * @param command
-     *            The ImapCommand which was completed.
-     * @param responseCode
-     *            A string response code to send to the client.
-     */
-    public abstract void commandComplete(final ImapCommand command,
-            final String responseCode, final String tag) throws IOException;
-
-    /**
      * Writes a standard NO response on command failure, together with a
      * descriptive message. Response is writen as:
      * 
@@ -386,4 +356,13 @@
             String[] quotes) throws IOException;
 
     public void skipNextSpace() throws IOException;
+
+    /**
+     * Composes a <code>CAPABILITY</code> response.
+     * See <code>7.2.1</code> of 
+     * <a href='http://james.apache.org/server/rfclist/imap4/rfc2060.txt' rel='tag'>RFC2060</a>.
+     * @param capabilities not null
+     * @throws IOException 
+     */
+    public ImapResponseComposer capabilities(List<String> capabilities) throws IOException;
 }
\ No newline at end of file

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/AbstractChainedImapEncoder.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/AbstractChainedImapEncoder.java?rev=730705&r1=730704&r2=730705&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/AbstractChainedImapEncoder.java
(original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/AbstractChainedImapEncoder.java
Fri Jan  2 04:19:39 2009
@@ -20,8 +20,6 @@
 package org.apache.james.imap.encode.base;
 
 import java.io.IOException;
-import java.util.Collection;
-import java.util.Iterator;
 
 import org.apache.commons.logging.Log;
 import org.apache.james.api.imap.AbstractLogEnabled;
@@ -54,14 +52,6 @@
         }
     }
 
-    protected void chainEncodeAll(final Collection messages,
-            final ImapResponseComposer composer) throws IOException {
-        for (Iterator iter = messages.iterator(); iter.hasNext();) {
-            ImapMessage message = (ImapMessage) iter.next();
-            chainEncode(message, composer);
-        }
-    }
-
     protected void chainEncode(ImapMessage message,
             ImapResponseComposer composer) throws IOException {
         next.encode(message, composer);

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java?rev=730705&r1=730704&r2=730705&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java
(original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java
Fri Jan  2 04:19:39 2009
@@ -61,15 +61,6 @@
         this.writer = writer;
     }
 
-    /**
-     * @throws IOException
-     * @see org.apache.james.imap.encode.ImapResponseComposer#commandComplete(org.apache.james.api.imap.ImapCommand,
-     *      java.lang.String)
-     */
-    public void commandComplete(final ImapCommand command, final String tag)
-            throws IOException {
-        commandComplete(command, null, tag);
-    }
 
     /**
      * @throws IOException
@@ -638,4 +629,14 @@
         }
         return this;
     }
+
+    public ImapResponseComposer capabilities(List<String> capabilities) throws IOException
{
+        untagged();
+        message(CAPABILITY_COMMAND_NAME);
+        for(String capability:capabilities) {
+            message(capability);
+        }
+        end();
+        return this;
+    }
 }

Copied: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/imap4rev1/server/CapabilityResponseEncoder.java
(from r730681, james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/imap4rev1/legacy/CapabilityResponseEncoder.java)
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/imap4rev1/server/CapabilityResponseEncoder.java?p2=james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/imap4rev1/server/CapabilityResponseEncoder.java&p1=james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/imap4rev1/legacy/CapabilityResponseEncoder.java&r1=730681&r2=730705&rev=730705&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/imap4rev1/legacy/CapabilityResponseEncoder.java
(original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/imap4rev1/server/CapabilityResponseEncoder.java
Fri Jan  2 04:19:39 2009
@@ -16,21 +16,20 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imap.encode.imap4rev1.legacy;
+package org.apache.james.imap.encode.imap4rev1.server;
 
 import java.io.IOException;
-import java.util.List;
 
-import org.apache.james.api.imap.ImapCommand;
-import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.api.imap.ImapMessage;
 import org.apache.james.imap.encode.ImapEncoder;
 import org.apache.james.imap.encode.ImapResponseComposer;
 import org.apache.james.imap.encode.base.AbstractChainedImapEncoder;
-import org.apache.james.imap.message.response.imap4rev1.legacy.CapabilityResponse;
+import org.apache.james.imap.message.response.imap4rev1.server.CapabilityResponse;
 
 /**
- * @deprecated use specification model
+ * Encodes <code>CAPABILITY</code> response.
+ * See <code>7.2.1</code> of 
+ * <a href='http://james.apache.org/server/rfclist/imap4/rfc2060.txt' rel='tag'>RFC2060</a>.
  */
 public class CapabilityResponseEncoder extends AbstractChainedImapEncoder {
 
@@ -40,18 +39,11 @@
 
     protected void doEncode(ImapMessage acceptableMessage,
             ImapResponseComposer composer) throws IOException {
-        CapabilityResponse response = (CapabilityResponse) acceptableMessage;
-        // TODO: inject capability text
-        composer.untaggedResponse(ImapConstants.CAPABILITY_RESPONSE);
-        List unsolicitedResponses = response.getUnsolicatedResponses();
-        chainEncodeAll(unsolicitedResponses, composer);
-        String tag = response.getTag();
-        ImapCommand command = response.getCommand();
-        composer.commandComplete(command, tag);
+        final CapabilityResponse response = (CapabilityResponse) acceptableMessage;
+        composer.capabilities(response.getCapabilities());
     }
 
     protected boolean isAcceptable(ImapMessage message) {
         return (message instanceof CapabilityResponse);
     }
-
 }

Propchange: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/imap4rev1/server/CapabilityResponseEncoder.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Modified: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/main/DefaultImapEncoderFactory.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/main/DefaultImapEncoderFactory.java?rev=730705&r1=730704&r2=730705&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/main/DefaultImapEncoderFactory.java
(original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/encode/main/DefaultImapEncoderFactory.java
Fri Jan  2 04:19:39 2009
@@ -28,7 +28,7 @@
 import org.apache.james.imap.encode.imap4rev1.FlagsResponseEncoder;
 import org.apache.james.imap.encode.imap4rev1.RecentResponseEncoder;
 import org.apache.james.imap.encode.imap4rev1.StatusResponseEncoder;
-import org.apache.james.imap.encode.imap4rev1.legacy.CapabilityResponseEncoder;
+import org.apache.james.imap.encode.imap4rev1.server.CapabilityResponseEncoder;
 import org.apache.james.imap.encode.imap4rev1.server.LSubResponseEncoder;
 import org.apache.james.imap.encode.imap4rev1.server.ListResponseEncoder;
 import org.apache.james.imap.encode.imap4rev1.server.STATUSResponseEncoder;

Copied: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/imap4rev1/server/CapabilityResponse.java
(from r730681, james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/imap4rev1/legacy/CapabilityResponse.java)
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/imap4rev1/server/CapabilityResponse.java?p2=james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/imap4rev1/server/CapabilityResponse.java&p1=james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/imap4rev1/legacy/CapabilityResponse.java&r1=730681&r2=730705&rev=730705&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/imap4rev1/legacy/CapabilityResponse.java
(original)
+++ james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/imap4rev1/server/CapabilityResponse.java
Fri Jan  2 04:19:39 2009
@@ -16,17 +16,75 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.imap.message.response.imap4rev1.legacy;
+package org.apache.james.imap.message.response.imap4rev1.server;
 
-import org.apache.james.api.imap.ImapCommand;
-import org.apache.james.imap.message.response.base.AbstractImapResponse;
+import java.util.List;
+
+import org.apache.james.api.imap.message.response.ImapResponseMessage;
 
 /**
- * @deprecated responses should correspond directly to the specification
+ * A <code>CAPABILITY</code> response. See <code>7.2.1</code> of

+ * <a href='http://james.apache.org/server/rfclist/imap4/rfc2060.txt' rel='tag'>RFC2060</a>.
  */
-public class CapabilityResponse extends AbstractImapResponse {
+public class CapabilityResponse implements ImapResponseMessage {
+
+    private final List<String> capabilities;
+
+    /**
+     * Constructs a response based on the given capabilities.
+     * @param capabilities not null
+     */
+    public CapabilityResponse(final List<String> capabilities) {
+        super();
+        this.capabilities = capabilities;
+    }
+
+    /**
+     * Gets a list containing the capabilities of this server.
+     * @return not null
+     */
+    public List<String> getCapabilities() {
+        return capabilities;
+    }
+
+    @Override
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + ((capabilities == null) ? 0 : capabilities.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        final CapabilityResponse other = (CapabilityResponse) obj;
+        if (capabilities == null) {
+            if (other.capabilities != null)
+                return false;
+        } else if (!capabilities.equals(other.capabilities))
+            return false;
+        return true;
+    }
 
-    public CapabilityResponse(ImapCommand command, String tag) {
-        super(command, tag);
+    /**
+     * Renders a description suitable for debugging.
+     *
+     * @return a description suitable for debugging
+     */
+    public String toString()
+    {
+        final String retValue = "CapabilityResponse ( "
+            + "capabilities = " + this.capabilities 
+            + " )";
+    
+        return retValue;
     }
+    
+    
 }

Propchange: james/protocols/imap/trunk/message/src/main/java/org/apache/james/imap/message/response/imap4rev1/server/CapabilityResponse.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Modified: james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/ImapResponseCommandTest.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/ImapResponseCommandTest.java?rev=730705&r1=730704&r2=730705&view=diff
==============================================================================
--- james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/ImapResponseCommandTest.java
(original)
+++ james/protocols/imap/trunk/message/src/test/java/org/apache/james/imap/encode/ImapResponseCommandTest.java
Fri Jan  2 04:19:39 2009
@@ -56,39 +56,6 @@
         super.tearDown();
     }
 
-    public void testCommandCompleteImapCommand() throws Exception {
-        response.commandComplete(command, TAG);
-        assertEquals(5, writer.operations.size());
-        assertEquals(new MockImapResponseWriter.TagOperation(TAG),
-                writer.operations.get(0));
-        assertEquals(new MockImapResponseWriter.TextMessageOperation(
-                ImapConstants.OK), writer.operations.get(1));
-        assertEquals(new MockImapResponseWriter.CommandNameOperation(NAME),
-                writer.operations.get(2));
-        assertEquals(new MockImapResponseWriter.TextMessageOperation(
-                "completed."), writer.operations.get(3));
-        assertEquals(new MockImapResponseWriter.EndOperation(),
-                writer.operations.get(4));
-    }
-
-    public void testCommandCompleteImapCommandString() throws Exception {
-        final String code = "responseCode";
-        response.commandComplete(command, code, TAG);
-        assertEquals(6, writer.operations.size());
-        assertEquals(new MockImapResponseWriter.TagOperation(TAG),
-                writer.operations.get(0));
-        assertEquals(new MockImapResponseWriter.TextMessageOperation(
-                ImapConstants.OK), writer.operations.get(1));
-        assertEquals(new MockImapResponseWriter.ResponseCodeOperation(code),
-                writer.operations.get(2));
-        assertEquals(new MockImapResponseWriter.CommandNameOperation(NAME),
-                writer.operations.get(3));
-        assertEquals(new MockImapResponseWriter.TextMessageOperation(
-                "completed."), writer.operations.get(4));
-        assertEquals(new MockImapResponseWriter.EndOperation(),
-                writer.operations.get(5));
-    }
-
     public void testCommandFailedImapCommandString() throws Exception {
         final String reason = "A reason";
         response.commandFailed(command, reason, TAG);
@@ -127,19 +94,4 @@
         assertEquals(new MockImapResponseWriter.EndOperation(),
                 writer.operations.get(6));
     }
-
-    public void testCommandResponse() throws Exception {
-        String message = "A message";
-        response.commandResponse(command, message);
-        assertEquals(4, writer.operations.size());
-        assertEquals(new MockImapResponseWriter.UntaggedOperation(),
-                writer.operations.get(0));
-        assertEquals(new MockImapResponseWriter.CommandNameOperation(command
-                .getName()), writer.operations.get(1));
-        assertEquals(new MockImapResponseWriter.TextMessageOperation(message),
-                writer.operations.get(2));
-        assertEquals(new MockImapResponseWriter.EndOperation(),
-                writer.operations.get(3));
-
-    }
 }

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/ImapSessionUtils.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/ImapSessionUtils.java?rev=730705&r1=730704&r2=730705&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/ImapSessionUtils.java
(original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/base/ImapSessionUtils.java
Fri Jan  2 04:19:39 2009
@@ -27,7 +27,6 @@
 import org.apache.james.api.imap.process.ImapProcessor.Responder;
 import org.apache.james.imap.mailbox.Mailbox;
 import org.apache.james.imap.mailbox.MailboxSession;
-import org.apache.james.imap.message.response.base.AbstractImapResponse;
 
 public class ImapSessionUtils {
 
@@ -39,12 +38,6 @@
 
     public static final String MAILBOX_SESSION_ATTRIBUTE_SESSION_KEY = "org.apache.james.api.imap.MAILBOX_SESSION_ATTRIBUTE_SESSION_KEY";
 
-    public static void addUnsolicitedResponses(AbstractImapResponse response,
-            ImapSession session, boolean useUids) {
-        List unsolicitedResponses = session.unsolicitedResponses(useUids);
-        response.addUnsolicitedResponses(unsolicitedResponses);
-    }
-
     public static void addUnsolicitedResponses(ImapSession session,
             boolean useUids, final Responder responder) {
         final List unsolicitedResponses = session.unsolicitedResponses(useUids);

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/CapabilityProcessor.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/CapabilityProcessor.java?rev=730705&r1=730704&r2=730705&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/CapabilityProcessor.java
(original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/CapabilityProcessor.java
Fri Jan  2 04:19:39 2009
@@ -19,6 +19,8 @@
 
 package org.apache.james.imap.processor.imap4rev1;
 
+import java.util.List;
+
 import org.apache.james.api.imap.ImapCommand;
 import org.apache.james.api.imap.ImapMessage;
 import org.apache.james.api.imap.message.request.ImapRequest;
@@ -27,17 +29,17 @@
 import org.apache.james.api.imap.process.ImapProcessor;
 import org.apache.james.api.imap.process.ImapSession;
 import org.apache.james.imap.message.request.imap4rev1.CapabilityRequest;
-import org.apache.james.imap.message.response.imap4rev1.legacy.CapabilityResponse;
+import org.apache.james.imap.message.response.imap4rev1.server.CapabilityResponse;
 import org.apache.james.imap.processor.base.AbstractImapRequestProcessor;
-import org.apache.james.imap.processor.base.ImapSessionUtils;
 
 public class CapabilityProcessor extends AbstractImapRequestProcessor {
 
-    // TODO: capability text should be injected
+    private final List<String> capabilities;
 
     public CapabilityProcessor(final ImapProcessor next,
-            final StatusResponseFactory factory) {
+            final StatusResponseFactory factory, final List<String> capabilities) {
         super(next, factory);
+        this.capabilities = capabilities;
     }
 
     protected boolean isAcceptable(ImapMessage message) {
@@ -50,13 +52,13 @@
         final ImapResponseMessage result = doProcess(request, session, tag,
                 command);
         responder.respond(result);
+        unsolicitedResponses(session, responder, false);
+        okComplete(command, tag, responder);
     }
 
     private ImapResponseMessage doProcess(CapabilityRequest request,
             ImapSession session, String tag, ImapCommand command) {
-        // TODO: accurately report the capabilities of the server
-        final CapabilityResponse result = new CapabilityResponse(command, tag);
-        ImapSessionUtils.addUnsolicitedResponses(result, session, false);
+        final CapabilityResponse result = new CapabilityResponse(capabilities);
         return result;
     }
 }

Modified: james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/Imap4Rev1ProcessorFactory.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/Imap4Rev1ProcessorFactory.java?rev=730705&r1=730704&r2=730705&view=diff
==============================================================================
--- james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/Imap4Rev1ProcessorFactory.java
(original)
+++ james/protocols/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/imap4rev1/Imap4Rev1ProcessorFactory.java
Fri Jan  2 04:19:39 2009
@@ -19,6 +19,10 @@
 
 package org.apache.james.imap.processor.imap4rev1;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.apache.james.api.imap.ImapConstants.*;
 import org.apache.james.api.imap.message.response.imap4rev1.StatusResponseFactory;
 import org.apache.james.api.imap.process.ImapProcessor;
 import org.apache.james.imap.mailbox.MailboxManagerProvider;
@@ -33,11 +37,14 @@
             final ImapProcessor chainEndProcessor,
             final MailboxManagerProvider mailboxManagerProvider,
             final StatusResponseFactory statusResponseFactory) {
-
+        
         final LogoutProcessor logoutProcessor = new LogoutProcessor(
                 chainEndProcessor, statusResponseFactory);
+        final List<String> capabilities = new ArrayList<String>();
+        capabilities.add(VERSION);
+        capabilities.add(SUPPORTS_LITERAL_PLUS);
         final CapabilityProcessor capabilityProcessor = new CapabilityProcessor(
-                logoutProcessor, statusResponseFactory);
+                logoutProcessor, statusResponseFactory, capabilities);
         final CheckProcessor checkProcessor = new CheckProcessor(
                 capabilityProcessor, statusResponseFactory);
         final LoginProcessor loginProcessor = new LoginProcessor(



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message