You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2023/03/17 22:10:23 UTC

[james-project] branch master updated (b2e2070771 -> 85d4adf8bc)

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git


    from b2e2070771 [FIX] Prevent sending invalid content type upon downloads
     new fdce761d2d JAMES-3854 [FIX] IMAP STATUS should allow fetching Deleted and Deleted-Storage individually
     new 85d4adf8bc JAMES-3754 MDC context for LIST EXTENDED (RFC-5258)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/james/imap/scripts/Status.test          | 16 ++++++++++++----
 .../org/apache/james/imap/processor/ListProcessor.java |  6 +++++-
 .../apache/james/imap/processor/StatusProcessor.java   | 18 +++++++++++++++---
 3 files changed, 32 insertions(+), 8 deletions(-)


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


[james-project] 01/02: JAMES-3854 [FIX] IMAP STATUS should allow fetching Deleted and Deleted-Storage individually

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit fdce761d2d98870014a348d1acb68223c8c9c6ce
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Mar 17 09:02:21 2023 +0700

    JAMES-3854 [FIX] IMAP STATUS should allow fetching Deleted and Deleted-Storage individually
---
 .../org/apache/james/imap/scripts/Status.test          | 16 ++++++++++++----
 .../apache/james/imap/processor/StatusProcessor.java   | 18 +++++++++++++++---
 2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Status.test b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Status.test
index 89eb6f8640..a148eaaed4 100644
--- a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Status.test
+++ b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Status.test
@@ -122,18 +122,26 @@ C: A013 STATUS statustest (UNSEEN SIZE MESSAGES DELETED DELETED-STORAGE)
 S: \* STATUS \"statustest\" \(MESSAGES 4 SIZE 1016 DELETED 2 DELETED-STORAGE 508 UNSEEN 4\)
 S: A013 OK STATUS completed.
 
-C: a014 STATUS statustest (MAILBOXID)
+C: A014 STATUS statustest (DELETED)
+S: \* STATUS \"statustest\" \(DELETED 2\)
+S: A014 OK STATUS completed.
+
+C: A015 STATUS statustest (DELETED-STORAGE)
+S: \* STATUS \"statustest\" \(DELETED-STORAGE 508\)
+S: A015 OK STATUS completed.
+
+C: a016 STATUS statustest (MAILBOXID)
 S: \* STATUS \"statustest\" \(MAILBOXID \(.+\)\)
-S: a014 OK STATUS completed.
+S: a016 OK STATUS completed.
 
-C: a015 LIST "" * RETURN (STATUS (UNSEEN SIZE MESSAGES DELETED DELETED-STORAGE MAILBOXID))
+C: a017 LIST "" * RETURN (STATUS (UNSEEN SIZE MESSAGES DELETED DELETED-STORAGE MAILBOXID))
 SUB {
 S: \* LIST \(\\HasNoChildren\) "." "INBOX"
 S: \* STATUS \"INBOX\" \(MESSAGES 0 SIZE 0 DELETED 0 DELETED-STORAGE 0 UNSEEN 0 MAILBOXID \(.+\)\)
 S: \* LIST \(\\HasNoChildren\) "." "statustest"
 S: \* STATUS "statustest" \(MESSAGES 4 SIZE 1016 DELETED 2 DELETED-STORAGE 508 UNSEEN 4 MAILBOXID \(.+\)\)
 }
-S: a015 OK LIST completed.
+S: a017 OK LIST completed.
 
 # Cleanup
 C: a1 DELETE statustest
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
index c8af849e96..97f8cedeb8 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
@@ -45,6 +45,7 @@ import org.apache.james.mailbox.MessageManager.MailboxMetaData.RecentMode;
 import org.apache.james.mailbox.MessageUid;
 import org.apache.james.mailbox.ModSeq;
 import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.model.ComposedMessageIdWithMetaData;
 import org.apache.james.mailbox.model.FetchGroup;
 import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MailboxPath;
@@ -254,13 +255,17 @@ public class StatusProcessor extends AbstractMailboxProcessor<StatusRequest> imp
     }
 
     private Mono<Optional<MailboxIterationResult>> iterateMailbox(StatusDataItems statusDataItems, MessageManager messageManager, MailboxSession session) {
-        if (statusDataItems.isSize()) {
+        if (statusDataItems.isSize() || statusDataItems.isDeletedStorage()) {
             return Flux.from(messageManager.getMessagesReactive(MessageRange.all(), FetchGroup.MINIMAL, session))
                 .reduce(new MailboxIterationResult(), MailboxIterationResult::accumulate)
                 .map(Optional::of);
-        } else {
-            return Mono.just(Optional.empty());
         }
+        if (statusDataItems.isDeleted()) {
+            return Flux.from(messageManager.listMessagesMetadata(MessageRange.all(), session))
+                .reduce(new MailboxIterationResult(), MailboxIterationResult::accumulateDeleted)
+                .map(Optional::of);
+        }
+        return Mono.just(Optional.empty());
     }
 
     public static class MailboxIterationResult {
@@ -277,6 +282,13 @@ public class StatusProcessor extends AbstractMailboxProcessor<StatusRequest> imp
             return this;
         }
 
+        public MailboxIterationResult accumulateDeleted(ComposedMessageIdWithMetaData metaData) {
+            if (metaData.getFlags().contains(Flags.Flag.DELETED)) {
+                deleted++;
+            }
+            return this;
+        }
+
         public Optional<Long> getSize(StatusDataItems items) {
             if (items.isSize()) {
                 return Optional.of(size);


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


[james-project] 02/02: JAMES-3754 MDC context for LIST EXTENDED (RFC-5258)

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 85d4adf8bcd0645942b9d229cfc208655c977750
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Mar 17 09:42:16 2023 +0700

    JAMES-3754 MDC context for LIST EXTENDED (RFC-5258)
---
 .../main/java/org/apache/james/imap/processor/ListProcessor.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
index a39cd7f1af..7f7ad6b6be 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
@@ -39,6 +39,7 @@ import org.apache.commons.lang3.tuple.Triple;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.display.ModifiedUtf7;
 import org.apache.james.imap.api.message.Capability;
+import org.apache.james.imap.api.message.StatusDataItems;
 import org.apache.james.imap.api.message.response.ImapResponseMessage;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapSession;
@@ -382,6 +383,9 @@ public class ListProcessor<T extends ListRequest> extends AbstractMailboxProcess
         return MDCBuilder.create()
             .addToContext(MDCBuilder.ACTION, "LIST")
             .addToContext("base", request.getBaseReferenceName())
-            .addToContext("pattern", request.getMailboxPattern());
+            .addToContext("pattern", request.getMailboxPattern())
+            .addToContext("returnOptions", request.getReturnOptions().toString())
+            .addToContext("selectOptions", request.getSelectOptions().toString())
+            .addToContextIfPresent("statusItems", request.getStatusDataItems().map(StatusDataItems::toString));
     }
 }


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