chibenwa commented on code in PR #2728:
URL: https://github.com/apache/james-project/pull/2728#discussion_r3545467630


##########
protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java:
##########
@@ -106,6 +113,16 @@ public void addProcessor(CapabilityImplementingProcessor 
implementor) {
     public List<Capability> getImplementedCapabilities(ImapSession session) {
         return CAPS;
     }
+
+    @Override
+    public List<Capability> getPermitEnableCapabilities(ImapSession session) {
+        return ENABLEABLE_CAPS;
+    }
+
+    @Override
+    public Mono<Void> enable(ImapMessage message, Responder responder, 
ImapSession session, Capability capability) {
+        return Mono.empty();

Review Comment:
   Here shouldn't we set allowUtf8 in the encoder and the decoder when 
SUPPORTS_UTF8_ACCEPT capability is passed ?



##########
protocols/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java:
##########
@@ -291,6 +292,7 @@ public static boolean isQuotedSpecial(char chr) {
 
     protected char nextChar; // unknown
     protected boolean nextSeen = false;
+    private boolean utf8Accept;

Review Comment:
   ```suggestion
       private boolean utf8Accept = false;
   ```
   
   Let's make the default value explicit...



##########
protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/RcptCmdHandler.java:
##########
@@ -195,6 +221,15 @@ protected Response doFilterChecks(SMTPSession session, 
String command,
         return null;
     }
 
+    private static boolean containsNonAscii(String s) {
+        for (int i = 0; i < s.length(); i++) {
+            if (s.charAt(i) > 0x7F) {
+                return true;
+            }
+        }
+        return false;
+    }

Review Comment:
   Can we move this dulicated piece of code in AddressNormalization ?



##########
protocols/imap/src/main/java/org/apache/james/imap/encode/base/ImapResponseComposerImpl.java:
##########
@@ -64,6 +65,8 @@ public class ImapResponseComposerImpl implements 
ImapConstants, ImapResponseComp
 
     private boolean skipNextSpace;
 
+    private boolean utf8Accept;

Review Comment:
   ```suggestion
       private boolean utf8Accepted = false;
   ```



##########
protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java:
##########
@@ -106,6 +113,16 @@ public void addProcessor(CapabilityImplementingProcessor 
implementor) {
     public List<Capability> getImplementedCapabilities(ImapSession session) {
         return CAPS;
     }
+
+    @Override
+    public List<Capability> getPermitEnableCapabilities(ImapSession session) {
+        return ENABLEABLE_CAPS;
+    }
+
+    @Override
+    public Mono<Void> enable(ImapMessage message, Responder responder, 
ImapSession session, Capability capability) {
+        return Mono.empty();

Review Comment:
   Edit I see that we handle that while instanciating composer / parser.
   
   Maybe just a little comment here ?
   
   Or better: make smtpUtf8 a prime citizen of ImapSession. That way we can 
write here an explicit `session.enableUtf8()`  and in the 2 other places we can 
write `session.utf8Enabled()` when instanciating composer / parser.
   
   



##########
server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java:
##########
@@ -528,6 +542,20 @@ private void appendRecipient(StringBuilder buffer, 
MailAddress mailAddress, Stri
             .append(LINE_BREAK);
     }
 
+    private static String addrType(MailAddress mailAddress) {
+        return containsNonAscii(mailAddress) ? "utf-8" : "rfc822";
+    }
+
+    private static boolean containsNonAscii(MailAddress mailAddress) {

Review Comment:
   Maybe we can move this into the MailAdress class itself ?



-- 
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