You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2022/11/16 05:04:40 UTC

[GitHub] [james-project] quantranhong1999 commented on a diff in pull request #1311: JAMES-3856 RFC-9208 Implement IMAP QUOTA revision

quantranhong1999 commented on code in PR #1311:
URL: https://github.com/apache/james-project/pull/1311#discussion_r1023506336


##########
protocols/imap/src/main/java/org/apache/james/imap/api/message/StatusDataItems.java:
##########
@@ -30,10 +30,15 @@ public enum StatusItem {
         MESSAGES,
         RECENT,
         UID_NEXT,
-        SIZE,
         UID_VALIDITY,
         UNSEEN,
-        HIGHEST_MODSEQ
+        HIGHEST_MODSEQ,
+        // See https://www.iana.org/go/rfc8438
+        SIZE,
+        // See https://www.rfc-editor.org/rfc/rfc9208.html
+        DELETED,
+        // See https://www.rfc-editor.org/rfc/rfc9208.html
+        DELETED_STORAGE

Review Comment:
   ```suggestion
           DELETED-STORAGE
   ```



##########
protocols/imap/src/test/java/org/apache/james/imap/encode/MailboxStatusResponseEncoderTest.java:
##########
@@ -53,10 +53,13 @@ void testDoEncode() throws Exception {
         final MessageUid uidNext = MessageUid.of(5);
         final UidValidity uidValidity = UidValidity.of(7L);
         final Long unseen = 11L;
+        final Long size = 42L;
+        final Long deleted = 23L;
+        final Long deletedStorage = 13L;
         final String mailbox = "A mailbox named desire";
 
-        encoder.encode(new MailboxStatusResponse(null, messages, recent, uidNext,
+        encoder.encode(new MailboxStatusResponse(null, null, deletedStorage, messages, recent, uidNext,
                 null, uidValidity, unseen, mailbox), composer);
-        assertThat(writer.getString()).isEqualTo("* STATUS \"A mailbox named desire\" (MESSAGES 2 RECENT 3 UIDNEXT 5 UIDVALIDITY 7 UNSEEN 11)\r\n");
+        assertThat(writer.getString()).isEqualTo("* STATUS \"A mailbox named desire\" (MESSAGES 2 DELETED_STORAGE 13 RECENT 3 UIDNEXT 5 UIDVALIDITY 7 UNSEEN 11)\r\n");

Review Comment:
   ```suggestion
           assertThat(writer.getString()).isEqualTo("* STATUS \"A mailbox named desire\" (MESSAGES 2 DELETED-STORAGE 13 RECENT 3 UIDNEXT 5 UIDVALIDITY 7 UNSEEN 11)\r\n");
   ```



##########
protocols/imap/src/main/java/org/apache/james/imap/api/ImapConstants.java:
##########
@@ -152,6 +154,10 @@ public interface ImapConstants {
 
     String STATUS_SIZE = "SIZE";
 
+    String STATUS_DELETED = "DELETED";
+
+    String STATUS_DELETED_STORAGE = "DELETED_STORAGE";

Review Comment:
   ```suggestion
       String STATUS_DELETED_STORAGE = "DELETED-STORAGE";
   ```
   
   `The DELETED and DELETED-STORAGE status data items allow for estimation of the amount of resources that could be freed by an EXPUNGE on a mailbox.`



##########
protocols/imap/src/main/java/org/apache/james/imap/api/message/StatusDataItems.java:
##########
@@ -70,6 +75,14 @@ public boolean isSize() {
         return statusItems.contains(StatusItem.SIZE);
     }
 
+    public boolean isDeleted() {
+        return statusItems.contains(StatusItem.DELETED);
+    }
+
+    public boolean isDeletedStorage() {
+        return statusItems.contains(StatusItem.DELETED_STORAGE);

Review Comment:
   ```suggestion
           return statusItems.contains(StatusItem.DELETED-STORAGE);
   ```



##########
protocols/imap/src/main/java/org/apache/james/imap/decode/parser/StatusCommandParser.java:
##########
@@ -182,6 +185,29 @@ private StatusDataItems.StatusItem readMessages(ImapRequestLineReader request) t
         return StatusDataItems.StatusItem.MESSAGES;
     }
 
+    private StatusDataItems.StatusItem readDeleted(ImapRequestLineReader request) throws DecodingException {
+        assertChar(request, 'd', 'D');
+        assertChar(request, 'e', 'E');
+        assertChar(request, 'l', 'L');
+        assertChar(request, 'e', 'E');
+        assertChar(request, 't', 'T');
+        assertChar(request, 'e', 'E');
+        assertChar(request, 'd', 'D');
+        char c = request.nextWordChar();
+        if (c == '_') {
+            assertChar(request, '_', '_');
+            assertChar(request, 's', 'S');
+            assertChar(request, 't', 'T');
+            assertChar(request, 'o', 'O');
+            assertChar(request, 'r', 'R');
+            assertChar(request, 'a', 'A');
+            assertChar(request, 'g', 'G');
+            assertChar(request, 'e', 'E');
+            return StatusDataItems.StatusItem.DELETED_STORAGE;

Review Comment:
   ```suggestion
               return StatusDataItems.StatusItem.DELETED-STORAGE;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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