prosgarz35 commented on PR #3198:
URL: https://github.com/apache/james-project/pull/3198#issuecomment-5934123723

       Thanks for the review!
   
       Regarding the alternative proposal to reject `IDLE` with `BAD` when no 
mailbox is selected: per **RFC 2177, Section 3**:
   
       > *"The IDLE command may be used in any state where client commands are 
accepted, including the authenticated and selected states... If issued while no 
mailbox is selected, the server simply waits until client sends DONE."*
   
       This is also explicitly covered by existing integration tests in 
`IMAPServerIdleTest` (e.g., `idleShouldBeAllowedWhenAuthenticatedState` and 
`idleShouldBeInterruptibleWhenAuthenticatedState`), where clients issue `IDLE` 
in the authenticated state prior to selecting any mailbox. Rejecting this state 
would break RFC compliance and those tests.
   
       Therefore, `selectedMailbox` can legitimately be `null`, and its guards 
remain necessary.
   
       However, I have fully addressed the type-safety concern by replacing the 
raw `null` with `Optional<IdleMailboxListener>`:
   
       ```java
       Optional<IdleMailboxListener> idleListener = 
Optional.ofNullable(selectedMailbox)
           .map(mailbox -> new IdleMailboxListener(session, safeResponder, 
idleReadySink, idleActive));


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to