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 no...@apache.org on 2011/04/07 21:59:50 UTC

svn commit: r1089965 - in /james/imap/trunk: api/src/main/java/org/apache/james/imap/api/display/HumanReadableText.java processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java

Author: norman
Date: Thu Apr  7 19:59:42 2011
New Revision: 1089965

URL: http://svn.apache.org/viewvc?rev=1089965&view=rev
Log:
Add status responses which 100% match rfc3501. See IMAP-280

Modified:
    james/imap/trunk/api/src/main/java/org/apache/james/imap/api/display/HumanReadableText.java
    james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java

Modified: james/imap/trunk/api/src/main/java/org/apache/james/imap/api/display/HumanReadableText.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/api/src/main/java/org/apache/james/imap/api/display/HumanReadableText.java?rev=1089965&r1=1089964&r2=1089965&view=diff
==============================================================================
--- james/imap/trunk/api/src/main/java/org/apache/james/imap/api/display/HumanReadableText.java (original)
+++ james/imap/trunk/api/src/main/java/org/apache/james/imap/api/display/HumanReadableText.java Thu Apr  7 19:59:42 2011
@@ -21,6 +21,8 @@ package org.apache.james.imap.api.displa
 
 import java.util.Arrays;
 
+import javax.mail.Flags;
+
 import org.apache.james.imap.api.ImapConstants;
 
 /**
@@ -34,14 +36,26 @@ public class HumanReadableText {
     public static final HumanReadableText SELECT = new HumanReadableText(
             "org.apache.james.imap.SELECT", "completed.");
 
-    public static final HumanReadableText UNSEEN = new HumanReadableText(
-            "org.apache.james.imap.UNSEEN", "");
+    public static final HumanReadableText unseen(long numberUnseen) {
+        return new HumanReadableText("org.apache.james.imap.UNSEEN","Message "+ numberUnseen + " is first unseen");
+    }
+    
+    public static final HumanReadableText UIDNEXT = new HumanReadableText(
+            "org.apache.james.imap.UIDNEXT", "Predicted next UID");
 
     public static final HumanReadableText UID_VALIDITY = new HumanReadableText(
-            "org.apache.james.imap.UID_VALIDITY", "");
-
-    public static final HumanReadableText PERMANENT_FLAGS = new HumanReadableText(
-            "org.apache.james.imap.PERMANENT_FLAGS", "");
+            "org.apache.james.imap.UID_VALIDITY", "UIDs valid");
+    
+    public static final HumanReadableText permanentFlags(Flags flags) {
+        String text;
+        if (flags.getSystemFlags() != null && flags.getSystemFlags().length > 0) {
+            text = "Limited";
+        } else {
+            text = "No permanent flags permitted";
+        }
+        return new HumanReadableText("org.apache.james.imap.PERMANENT_FLAGS", text);
+    }
+   
 
     public static final HumanReadableText GENERIC_LSUB_FAILURE = new HumanReadableText(
             "org.apache.james.imap.GENERIC_SUBSCRIPTION_FAILURE",

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java?rev=1089965&r1=1089964&r2=1089965&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java Thu Apr  7 19:59:42 2011
@@ -109,7 +109,7 @@ abstract class AbstractSelectionProcesso
     throws MailboxException {
         final long uid = metaData.getUidNext();
         final StatusResponse untaggedOk = statusResponseFactory.untaggedOk(
-                HumanReadableText.UNSEEN, ResponseCode.uidNext(uid));
+                HumanReadableText.UIDNEXT, ResponseCode.uidNext(uid));
         responder.respond(untaggedOk);
     }
     
@@ -134,7 +134,7 @@ abstract class AbstractSelectionProcesso
     private void permanentFlags(Responder responder, MessageManager.MetaData metaData) {
         final Flags permanentFlags = metaData.getPermanentFlags();
         final StatusResponse untaggedOk = statusResponseFactory.untaggedOk(
-                HumanReadableText.PERMANENT_FLAGS, ResponseCode
+                HumanReadableText.permanentFlags(permanentFlags), ResponseCode
                         .permanentFlags(permanentFlags));
         responder.respond(untaggedOk);
     }
@@ -149,7 +149,7 @@ abstract class AbstractSelectionProcesso
             if (msn == SelectedMailbox.NO_SUCH_MESSAGE) throw new MailboxException("No message found with uid " + unseenUid);
 
             final StatusResponse untaggedOk = statusResponseFactory.untaggedOk(
-                    HumanReadableText.UNSEEN, ResponseCode.unseen(msn));
+                    HumanReadableText.unseen(msn), ResponseCode.unseen(msn));
             responder.respond(untaggedOk);
         }
 



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