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 e0e4f90775bc4b23e27ef394c072b1b1e40bc96a Author: Benoit Tellier <btell...@linagora.com> AuthorDate: Tue Mar 8 08:33:59 2022 +0700 JAMES-3722 IMAP SELECT should return CLOSED responses upon implicit selected mailbox changes --- .../james/imap/processor/AbstractSelectionProcessor.java | 11 ++++++----- .../org/apache/james/imapserver/netty/IMAPServerTest.java | 1 - 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java index d6ad78a..5dfa2dc 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java @@ -116,7 +116,7 @@ abstract class AbstractSelectionProcessor<R extends AbstractMailboxSelectionRequ return; } - final MailboxMetaData metaData = selectMailbox(fullMailboxPath, session); + final MailboxMetaData metaData = selectMailbox(fullMailboxPath, session, responder); final SelectedMailbox selected = session.getSelected(); MessageUid firstUnseen = metaData.getFirstUnseen(); @@ -136,7 +136,7 @@ abstract class AbstractSelectionProcessor<R extends AbstractMailboxSelectionRequ LOGGER.info("Unable to uid for unseen message {} in mailbox {}", firstUnseen, selected.getMailboxId().serialize()); break; } - firstUnseen = selectMailbox(fullMailboxPath, session).getFirstUnseen(); + firstUnseen = selectMailbox(fullMailboxPath, session, responder).getFirstUnseen(); retryCount++; } @@ -384,7 +384,7 @@ abstract class AbstractSelectionProcessor<R extends AbstractMailboxSelectionRequ responder.respond(existsResponse); } - private MailboxMetaData selectMailbox(MailboxPath mailboxPath, ImapSession session) throws MailboxException { + private MailboxMetaData selectMailbox(MailboxPath mailboxPath, ImapSession session, Responder responder) throws MailboxException { final MailboxManager mailboxManager = getMailboxManager(); final MailboxSession mailboxSession = session.getMailboxSession(); final MessageManager mailbox = mailboxManager.getMailbox(mailboxPath, mailboxSession); @@ -398,8 +398,9 @@ abstract class AbstractSelectionProcessor<R extends AbstractMailboxSelectionRequ // Response with the CLOSE return-code when the currently selected mailbox is closed implicitly using the SELECT/EXAMINE command on another mailbox // // See rfc5162 3.7. CLOSED Response Code - if (currentMailbox != null) { - getStatusResponseFactory().untaggedOk(HumanReadableText.QRESYNC_CLOSED, ResponseCode.closed()); + if (currentMailbox != null && EnableProcessor.getEnabledCapabilities(session).contains(ImapConstants.SUPPORTS_QRESYNC)) { + responder.respond(getStatusResponseFactory() + .untaggedOk(HumanReadableText.QRESYNC_CLOSED, ResponseCode.closed())); } session.selected(new SelectedMailboxImpl(getMailboxManager(), eventBus, session, mailbox)); diff --git a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java index 8b470b5..fb2d92b 100644 --- a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java +++ b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java @@ -1731,7 +1731,6 @@ class IMAPServerTest { .hasSize(1); } - @Disabled("JAMES-3722 Closed notifications were never sent upon implicit selected mailbox changes") @Test void implicitMailboxSelectionChangesShouldReturnClosedNotifications() throws Exception { memoryIntegrationResources.getMailboxManager() --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org