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 2021/06/07 04:46:18 UTC

[GitHub] [james-project] quantranhong1999 opened a new pull request #481: JAMES-3516 Implement naive ThreadIdManager

quantranhong1999 opened a new pull request #481:
URL: https://github.com/apache/james-project/pull/481


   Just a few ideas want to show to you, not really some proper code yet.
   My idea is enabling setThreadId in MailboxMessage (just like MoqSeq). 
   Then in MessageStorer we can use message.setThreadId(with ThreadId from ThreadIdGuessingAlgorithm)
   ```
   MailboxMessage message = messageFactory.createMessage(messageId, mailbox, internalDate, size, bodyStartOctet, content, flags, propertyBuilder, attachments);
   threadId = ThreadIdManager.setThreadId(MailboxMessage message,...);
   message.setThreadId(threadId);
   return Mono.from(messageMapper.addReactive(mailbox, message))
       .map(metadata -> Pair.of(metadata, Optional.of(attachments)));
   ```


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

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


[GitHub] [james-project] chibenwa commented on a change in pull request #481: JAMES-3516 Implement naive ThreadIdManager

Posted by GitBox <gi...@apache.org>.
chibenwa commented on a change in pull request #481:
URL: https://github.com/apache/james-project/pull/481#discussion_r646301120



##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxMessage.java
##########
@@ -34,6 +34,8 @@
  */
 public interface MailboxMessage extends Message, Comparable<MailboxMessage> {
 
+    void setThreadId(ThreadId threadId);

Review comment:
       No I would definitly prefer to have threadId final and add the required onstructor parameters!

##########
File path: mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryThreadIdManager.java
##########
@@ -0,0 +1,44 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.inmemory.mail;
+
+import org.apache.james.mailbox.model.ThreadId;
+import org.apache.james.mailbox.store.mail.ThreadIdManager;
+import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+
+public class InMemoryThreadIdManager implements ThreadIdManager {
+
+    public static class InMemoryThreadIdGuessingAlgorithm implements ThreadIdManager.ThreadIdGuessingAlgorithm {
+        @Override
+        public ThreadId guessingThreadId(MailboxMessage mailboxMessage) {
+            return new ThreadId(mailboxMessage.getMessageId());
+        }
+    }
+
+    @Override
+    public ThreadId createThreadId(MailboxMessage mailboxMessage) {

Review comment:
       Do we take the mime message as an input? If I remember correctly MailboxMessage already has a ThreadId allocated to it...
   
   ThreadId guessing needs to happen before.
   
   Please consider...
   
    - The subject (string)
    - The references ( `List<String>` ) including `In-Reply-To`
    - The `MimeMessageId (`String`)
    - The James mailbox   `MessageId`
    
   https://jmap.io/spec-mail.html#threads
   
   ```
   The exact algorithm for determining whether two Emails belong to the same Thread is not mandated in this spec to allow for compatibility with different existing systems. For new implementations, it is suggested that two messages belong in the same Thread if both of the following conditions apply:
   
       An identical message id [@!RFC5322] appears in both messages in any of the Message-Id, In-Reply-To, and References header fields.
       After stripping automatically added prefixes such as “Fwd:”, “Re:”, “[List-Tag]”, etc., and ignoring white space, the subjects are the same. This avoids the situation where a person replies to an old message as a convenient way of finding the right recipient to send to but changes the subject and starts a new conversation.
   
   ```

##########
File path: mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryThreadIdManager.java
##########
@@ -0,0 +1,44 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.inmemory.mail;
+
+import org.apache.james.mailbox.model.ThreadId;
+import org.apache.james.mailbox.store.mail.ThreadIdManager;
+import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+
+public class InMemoryThreadIdManager implements ThreadIdManager {
+
+    public static class InMemoryThreadIdGuessingAlgorithm implements ThreadIdManager.ThreadIdGuessingAlgorithm {

Review comment:
       I don't see what is specific for memory here just yet.

##########
File path: mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/mail/InMemoryThreadIdManager.java
##########
@@ -0,0 +1,44 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.inmemory.mail;
+
+import org.apache.james.mailbox.model.ThreadId;
+import org.apache.james.mailbox.store.mail.ThreadIdManager;
+import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+
+public class InMemoryThreadIdManager implements ThreadIdManager {

Review comment:
       We don't need a manager just yet.

##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/ThreadIdManager.java
##########
@@ -0,0 +1,33 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail;
+
+import org.apache.james.mailbox.model.ThreadId;
+import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+
+public interface ThreadIdManager {
+    interface ThreadIdGuessingAlgorithm {

Review comment:
       I think only the ThreadIdGuessingAlgorithm makes sense and that we can drop ThreadIdManager.




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

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


[GitHub] [james-project] quantranhong1999 commented on pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
quantranhong1999 commented on pull request #481:
URL: https://github.com/apache/james-project/pull/481#issuecomment-859384531






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

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


[GitHub] [james-project] quantranhong1999 edited a comment on pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
quantranhong1999 edited a comment on pull request #481:
URL: https://github.com/apache/james-project/pull/481#issuecomment-858470927


   Hi, 
   I think there are some we need to discuss about.
   About the algorithm input, based on your suggestion, JMAP specs and what was proposed preliminary in GSoC proposal. I suppose the guessing algorithm method:
   ```
   ThreadId guessThreadId(Username username, MessageId messageId, Message-ID message-id, List<References> references, Subject subject);
   ```
   Where:
   - MessageId to be the naive ThreadId for now
   - Username so we can get all emails of that user => get all header fields like Message-ID, In-reply-to, References, Subject => compare to already having Message-ID, In-reply-to, References, Subject fields.
   
   Can someone explain me about the create and saving a message process in James? I doubt that in the final implementation of guessing thread id algorithm, there should not be MessageId messageId in the params because MessageId only available when we created a message (so threadId also).  After we have threadId, we can pass it into some create message params and save it. After that I suppose we can use ThreadIdManager to save a trio of accountId(Username), MessageId, ThreadId to the ThreadId table. 
   
   Beside that, I have some other question (Which could be nice if you can answer shortly and directly to me. Otherwise I think I can read RFC5322 about this by my self, I'm fine.)
   - What is Message-ID meaning? The difference between Message-ID and MessageId? Who decided Message-ID (client/ server...)?
   - What is References header field meaning?
   - What is In-Reply-To? Is this field mean the mail addresses this email should be replied to?
   - Why should we combine  In-Reply-To and References into a object?
   
   I know this is really a long discuss with many questions and I would very appreciate for your answers. :')
    


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

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


[GitHub] [james-project] chibenwa commented on pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
chibenwa commented on pull request #481:
URL: https://github.com/apache/james-project/pull/481#issuecomment-858475711


   Hi Quan
   
   > `ThreadId guessThreadId(Username username, MessageId messageId, Message-ID message-id, List<References> references, Subject subject);`
   
   I agree with that.
   
   > I know this is really a long discuss with many questions and I would very appreciate for your answers. :')
   
   When I have 5 minutes I will answer you, but likely on the server-dev mailing list :-) 
   
   This sounds like legitimate questions.


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

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


[GitHub] [james-project] quantranhong1999 commented on pull request #481: JAMES-3516 Implement naive ThreadIdManager

Posted by GitBox <gi...@apache.org>.
quantranhong1999 commented on pull request #481:
URL: https://github.com/apache/james-project/pull/481#issuecomment-856415091


   Not really fixed compilation, I want to received some reviews to make sure if I am going the right way. 


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

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


[GitHub] [james-project] quantranhong1999 commented on a change in pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
quantranhong1999 commented on a change in pull request #481:
URL: https://github.com/apache/james-project/pull/481#discussion_r650790999



##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/NaiveThreadIdGuessingAlgorithmImpl.java
##########
@@ -0,0 +1,35 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail;
+
+import java.util.List;
+
+import org.apache.james.core.Username;
+import org.apache.james.mailbox.model.ThreadId;
+import org.apache.james.mailbox.store.mail.model.MimeMessageId;
+import org.apache.james.mailbox.store.mail.model.Subject;
+
+public class NaiveThreadIdGuessingAlgorithmImpl implements ThreadIdGuessingAlgorithm {
+    @Override
+    public ThreadId guessThreadId(Username username, MimeMessageId thisMimeMessageId, MimeMessageId inReplyTo, List<MimeMessageId> references, Subject subject) {
+        // To be implemented
+        return null;

Review comment:
       This supposes to be the not naive implementation method without baseMessageId in params.
   I don't understand Benoit's point yet..




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

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


[GitHub] [james-project] chibenwa commented on pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
chibenwa commented on pull request #481:
URL: https://github.com/apache/james-project/pull/481#issuecomment-859418213


   > As i understand, JMAP email object based on RFC5322.
   
   Correct
   
   > When user client read a email (Email/get), I see server returns Jmap object (not Mime message).
   
   Correct. 
   
   To be more precise the server returns the properties the client asked for.
   
   Some are high level, directly matches use case and requires no Mime knowledge eg: `subject` but some others are lower lever and the client can do advanced mime stuff not accounted for by the base spec.
   
   Also a client might download the whole mime message if he wishes.
   
   > My question is how does the JMAP client read that Jmap object as a email?
   
   That's the point: a JMAP client might never end up dealing with any sort of MIME. He can work with the conveniant JMAP API without needing to understand MIME.
   
   This makes it easy to write clients like INBOX or LTT.RS.


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

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


[GitHub] [james-project] chibenwa commented on pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
chibenwa commented on pull request #481:
URL: https://github.com/apache/james-project/pull/481#issuecomment-858518362


   > About the difference between Message-ID and MessageId, Tung just sent me this : https://www.mail-archive.com/server-user@james.apache.org/msg16459.html?fbclid=IwAR11h5J8N2JzWntoPX-bsEXKnkliuvvc_QCPgs6hAomYVXcskPX1sEr-SoM
   
   Do you need more explanations regarding this?
   
   > What is In-Reply-To? 
   
   In reply to is a field holding the Mime message-Id of the message this mail is a rely of. This is a strong indicator that they are in the same thread... You can find explanations here: https://datatracker.ietf.org/doc/html/rfc4021#section-2.1.9.
   
   > What is References header field meaning?
   
   Idem references are emails being related. This could be previous replies of the thread for instance. https://datatracker.ietf.org/doc/html/rfc4021#section-2.1.10
   
   This could be used for instance also by forwards that technically are not replies.
   
   > Why should we combine In-Reply-To and References into a object?
   
   I personnally think we can wrap that into a `List<MimeMessageId> relatedMimeMessageIds` field instead of two fields.
   


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

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


[GitHub] [james-project] chibenwa commented on a change in pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
chibenwa commented on a change in pull request #481:
URL: https://github.com/apache/james-project/pull/481#discussion_r650638829



##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/ThreadIdGuessing.java
##########
@@ -0,0 +1,34 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail;
+
+import java.util.List;
+
+import org.apache.james.core.Username;
+import org.apache.james.mailbox.model.MessageId;
+import org.apache.james.mailbox.model.ThreadId;
+import org.apache.james.mailbox.store.mail.model.MimeMessageId;
+import org.apache.james.mailbox.store.mail.model.Subject;
+
+public interface ThreadIdGuessing {
+    ThreadId naiveGuessThreadId(Username username, MessageId messageId, MimeMessageId thisMimeMessageId, MimeMessageId inReplyTo, List<MimeMessageId> references, Subject subject);
+
+    ThreadId guessThreadId(Username username, MimeMessageId thisMimeMessageId, MimeMessageId inReplyTo, List<MimeMessageId> references, Subject subject);

Review comment:
       I disagree with two methods. We should have  methods, several implementation.

##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Subject.java
##########
@@ -0,0 +1,58 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail.model;
+
+import java.util.Objects;
+
+import com.google.common.base.MoreObjects;
+
+public class Subject {

Review comment:
       Technically it should be `BaseSubject`: `After stripping automatically added prefixes such as “Fwd:”, “Re:”, “[List-Tag]”, etc., and ignoring white space, the subjects are the same. This avoids the situation where a person replies to an old message as a convenient way of finding the right recipient to send to but changes the subject and starts a new conversation.`

##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/ThreadIdGuessing.java
##########
@@ -0,0 +1,34 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail;
+
+import java.util.List;
+
+import org.apache.james.core.Username;
+import org.apache.james.mailbox.model.MessageId;
+import org.apache.james.mailbox.model.ThreadId;
+import org.apache.james.mailbox.store.mail.model.MimeMessageId;
+import org.apache.james.mailbox.store.mail.model.Subject;
+
+public interface ThreadIdGuessing {
+    ThreadId naiveGuessThreadId(Username username, MessageId messageId, MimeMessageId thisMimeMessageId, MimeMessageId inReplyTo, List<MimeMessageId> references, Subject subject);

Review comment:
       The fact of being naive is an implementation detail that do not have its place in an interface.

##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Subject.java
##########
@@ -0,0 +1,58 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail.model;
+
+import java.util.Objects;
+
+import com.google.common.base.MoreObjects;
+
+public class Subject {

Review comment:
       As you want. Your proposal makes sense.

##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Subject.java
##########
@@ -0,0 +1,58 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail.model;
+
+import java.util.Objects;
+
+import com.google.common.base.MoreObjects;
+
+public class Subject {

Review comment:
       We already have code doing just that: `SearchUtil::getBaseSubject`... Though some more tests could be welcome, we can likely reuse it.

##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/ThreadIdGuessing.java
##########
@@ -28,7 +28,9 @@
 import org.apache.james.mailbox.store.mail.model.Subject;
 
 public interface ThreadIdGuessing {

Review comment:
       I liked the ThreadIdGuessingAlgorithm terminology <3




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

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


[GitHub] [james-project] chibenwa commented on a change in pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
chibenwa commented on a change in pull request #481:
URL: https://github.com/apache/james-project/pull/481#discussion_r650811215



##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/NaiveThreadIdGuessingAlgorithmImpl.java
##########
@@ -0,0 +1,35 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail;
+
+import java.util.List;
+
+import org.apache.james.core.Username;
+import org.apache.james.mailbox.model.ThreadId;
+import org.apache.james.mailbox.store.mail.model.MimeMessageId;
+import org.apache.james.mailbox.store.mail.model.Subject;
+
+public class NaiveThreadIdGuessingAlgorithmImpl implements ThreadIdGuessingAlgorithm {
+    @Override
+    public ThreadId guessThreadId(Username username, MimeMessageId thisMimeMessageId, MimeMessageId inReplyTo, List<MimeMessageId> references, Subject subject) {
+        // To be implemented
+        return null;

Review comment:
       Naive and real implementation should have the same API.




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

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


[GitHub] [james-project] Arsnael commented on a change in pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
Arsnael commented on a change in pull request #481:
URL: https://github.com/apache/james-project/pull/481#discussion_r650745613



##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/NaiveThreadIdGuessingAlgorithmImpl.java
##########
@@ -0,0 +1,35 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail;
+
+import java.util.List;
+
+import org.apache.james.core.Username;
+import org.apache.james.mailbox.model.ThreadId;
+import org.apache.james.mailbox.store.mail.model.MimeMessageId;
+import org.apache.james.mailbox.store.mail.model.Subject;
+
+public class NaiveThreadIdGuessingAlgorithmImpl implements ThreadIdGuessingAlgorithm {
+    @Override
+    public ThreadId guessThreadId(Username username, MimeMessageId thisMimeMessageId, MimeMessageId inReplyTo, List<MimeMessageId> references, Subject subject) {
+        // To be implemented
+        return null;

Review comment:
       Don't we throw a `NotImplementedException` in those cases usually?




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

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


[GitHub] [james-project] chibenwa commented on a change in pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
chibenwa commented on a change in pull request #481:
URL: https://github.com/apache/james-project/pull/481#discussion_r650811215



##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/NaiveThreadIdGuessingAlgorithmImpl.java
##########
@@ -0,0 +1,35 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail;
+
+import java.util.List;
+
+import org.apache.james.core.Username;
+import org.apache.james.mailbox.model.ThreadId;
+import org.apache.james.mailbox.store.mail.model.MimeMessageId;
+import org.apache.james.mailbox.store.mail.model.Subject;
+
+public class NaiveThreadIdGuessingAlgorithmImpl implements ThreadIdGuessingAlgorithm {
+    @Override
+    public ThreadId guessThreadId(Username username, MimeMessageId thisMimeMessageId, MimeMessageId inReplyTo, List<MimeMessageId> references, Subject subject) {
+        // To be implemented
+        return null;

Review comment:
       Naive and real implementation should have the same interface.
   
   We can add parameters if needed.




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

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


[GitHub] [james-project] quantranhong1999 commented on a change in pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
quantranhong1999 commented on a change in pull request #481:
URL: https://github.com/apache/james-project/pull/481#discussion_r648850201



##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/ThreadIdGuessingAlgorithm.java
##########
@@ -0,0 +1,27 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail;
+
+import org.apache.james.mailbox.model.ThreadId;
+import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+
+public interface ThreadIdGuessingAlgorithm {
+    ThreadId getThreadId(MailboxMessage mailboxMessage);

Review comment:
       Ok it looks like I understand wrong about naive implementation level. I will working on this.




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

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


[GitHub] [james-project] quantranhong1999 commented on a change in pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
quantranhong1999 commented on a change in pull request #481:
URL: https://github.com/apache/james-project/pull/481#discussion_r650856958



##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/NaiveThreadIdGuessingAlgorithmImpl.java
##########
@@ -0,0 +1,35 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail;
+
+import java.util.List;
+
+import org.apache.james.core.Username;
+import org.apache.james.mailbox.model.ThreadId;
+import org.apache.james.mailbox.store.mail.model.MimeMessageId;
+import org.apache.james.mailbox.store.mail.model.Subject;
+
+public class NaiveThreadIdGuessingAlgorithmImpl implements ThreadIdGuessingAlgorithm {
+    @Override
+    public ThreadId guessThreadId(Username username, MimeMessageId thisMimeMessageId, MimeMessageId inReplyTo, List<MimeMessageId> references, Subject subject) {
+        // To be implemented
+        return null;

Review comment:
       In the future when we already have the real implementation, can we delete the NaiveImpl and unnecessary basedMessageId param?




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

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


[GitHub] [james-project] chibenwa commented on a change in pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
chibenwa commented on a change in pull request #481:
URL: https://github.com/apache/james-project/pull/481#discussion_r650765841



##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/NaiveThreadIdGuessingAlgorithmImpl.java
##########
@@ -0,0 +1,35 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail;
+
+import java.util.List;
+
+import org.apache.james.core.Username;
+import org.apache.james.mailbox.model.ThreadId;
+import org.apache.james.mailbox.store.mail.model.MimeMessageId;
+import org.apache.james.mailbox.store.mail.model.Subject;
+
+public class NaiveThreadIdGuessingAlgorithmImpl implements ThreadIdGuessingAlgorithm {
+    @Override
+    public ThreadId guessThreadId(Username username, MimeMessageId thisMimeMessageId, MimeMessageId inReplyTo, List<MimeMessageId> references, Subject subject) {
+        // To be implemented
+        return null;

Review comment:
       We should implement the naive algorithm `new ThreadId(baseMessageId)` stuff....




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

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


[GitHub] [james-project] quantranhong1999 edited a comment on pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
quantranhong1999 edited a comment on pull request #481:
URL: https://github.com/apache/james-project/pull/481#issuecomment-858470927


   Hi, 
   I think there are some we need to discuss about.
   About the algorithm input, based on your suggestion, JMAP specs and what was proposed preliminary in GSoC proposal. I suppose the guessing algorithm method:
   ```
   ThreadId guessThreadId(Username username, MessageId messageId, Message-ID message-id, List<References> references, Subject subject);
   ```
   Where:
   - MessageId to be the naive ThreadId for now
   - Username so we can get all emails of that user => get all header fields like Message-ID, In-reply-to, References, Subject => compare to already having Message-ID, In-reply-to, References, Subject fields.
   
   Can someone explain me about the create and saving a message process in James? I doubt that in the final implementation of guessing thread id algorithm, there should not be MessageId messageId in the params because MessageId only available when we created a message (so threadId also).  After we have threadId, we can pass it into some create message params and save it. After that I suppose we can use ThreadIdManager to save a trio of accountId(Username), MessageId, ThreadId to the ThreadId table. 
   
   Beside that, I have some other question (Which could be nice if you can answer shortly and directly to me. Otherwise I think I can read RFC5322 about this by my self, I'm fine.)
   - What is Message-ID meaning? The difference between Message-ID and MessageId? Who decided Message-ID (client/ server...)?
   - What is References header field meaning?
   - Why should we combine  In-Reply-To and References into a object?
   
   I know this is really a long discuss with many questions and I would very appreciate for your answers. :')
    


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

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


[GitHub] [james-project] quantranhong1999 commented on a change in pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
quantranhong1999 commented on a change in pull request #481:
URL: https://github.com/apache/james-project/pull/481#discussion_r650641574



##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Subject.java
##########
@@ -0,0 +1,58 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail.model;
+
+import java.util.Objects;
+
+import com.google.common.base.MoreObjects;
+
+public class Subject {

Review comment:
       Why we should not let guessThreadId algorithm handle the stripping subject job also?

##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Subject.java
##########
@@ -0,0 +1,58 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail.model;
+
+import java.util.Objects;
+
+import com.google.common.base.MoreObjects;
+
+public class Subject {

Review comment:
       We could write a stripping method in ThreadIdGuessing impl and use it one for all (for input' subject and other searched mails' subjects)




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

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


[GitHub] [james-project] quantranhong1999 commented on pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
quantranhong1999 commented on pull request #481:
URL: https://github.com/apache/james-project/pull/481#issuecomment-858470927


   Hi, 
   I think there are some we need to discuss about.
   About the algorithm input, based on your suggestion, JMAP specs and what was proposed preliminary in GSoC proposal. I suppose the guessing algorithm method:
   ```
   ThreadId guessThreadId(Username username, MessageId messageId, Message-ID message-id, List<References> references, Subject subject);
   ```
   Where:
   - MessageId to be the naive ThreadId for now
   - Username so we can get all emails of that user => get all header fields like Message-ID, In-reply-to, References, Subject => compare to already having Message-ID, In-reply-to, References, Subject fields.
   
   Can someone explain me about the create and saving a message process in James? I doubt that in the final implementation of guessing thread id algorithm, there should not be MessageId messageId in the params because MessageId only available when we created a message (so threadId also).  After we have threadId, we can pass it into some create message params and save it. After that I suppose we can use ThreadIdManager to save a trio of accountId(Username), MessageId, ThreadId to the ThreadId table. 
   Beside that, I have some other question (Which could be nice if you can answer shortly and directly to me. Otherwise I think I can read RFC5322 about this by my self, I'm fine.)
   - What is Message-ID meaning? The difference between Message-ID and MessageId? Who decided Message-ID (client/ server...)?
   - What is References header field meaning?
   - Why should we combine  In-Reply-To and References into a object?
   
   I know this is really a long discuss with many questions and I would very appreciate for your answers. :')
    


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

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


[GitHub] [james-project] quantranhong1999 edited a comment on pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
quantranhong1999 edited a comment on pull request #481:
URL: https://github.com/apache/james-project/pull/481#issuecomment-860343157






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

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


[GitHub] [james-project] quantranhong1999 edited a comment on pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
quantranhong1999 edited a comment on pull request #481:
URL: https://github.com/apache/james-project/pull/481#issuecomment-858477136


   > When I have 5 minutes I will answer you, but likely on the server-dev mailing list :-)
   
    About the difference between Message-ID and MessageId, Tung just sent me this : https://www.mail-archive.com/server-user@james.apache.org/msg16459.html?fbclid=IwAR11h5J8N2JzWntoPX-bsEXKnkliuvvc_QCPgs6hAomYVXcskPX1sEr-SoM
   
   
   
   


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

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


[GitHub] [james-project] chibenwa commented on a change in pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
chibenwa commented on a change in pull request #481:
URL: https://github.com/apache/james-project/pull/481#discussion_r650865403



##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/NaiveThreadIdGuessingAlgorithmImpl.java
##########
@@ -0,0 +1,35 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail;
+
+import java.util.List;
+
+import org.apache.james.core.Username;
+import org.apache.james.mailbox.model.ThreadId;
+import org.apache.james.mailbox.store.mail.model.MimeMessageId;
+import org.apache.james.mailbox.store.mail.model.Subject;
+
+public class NaiveThreadIdGuessingAlgorithmImpl implements ThreadIdGuessingAlgorithm {
+    @Override
+    public ThreadId guessThreadId(Username username, MimeMessageId thisMimeMessageId, MimeMessageId inReplyTo, List<MimeMessageId> references, Subject subject) {
+        // To be implemented
+        return null;

Review comment:
       Yes I think so...




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

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


[GitHub] [james-project] quantranhong1999 commented on pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
quantranhong1999 commented on pull request #481:
URL: https://github.com/apache/james-project/pull/481#issuecomment-858295880


   Can someone review this PR please? 


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

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


[GitHub] [james-project] chibenwa commented on a change in pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
chibenwa commented on a change in pull request #481:
URL: https://github.com/apache/james-project/pull/481#discussion_r648847760



##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
##########
@@ -939,4 +944,8 @@ public Flags getApplicableFlags(MailboxSession session) throws MailboxException
     public EnumSet<MessageCapabilities> getSupportedMessageCapabilities() {
         return messageCapabilities;
     }
+
+    public ThreadId getThreadIdOfAMessage(MailboxMessage mailboxMessage) {

Review comment:
       Why do we need this getter?

##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
##########
@@ -164,12 +166,14 @@ private MediaType(String mediaType, String subType) {
     private final BatchSizes batchSizes;
     private final PreDeletionHooks preDeletionHooks;
     private final MessageStorer messageStorer;
+    private final ThreadIdGuessingAlgorithm threadIdGuessingAlgorithm;

Review comment:
       Where do we use this field?

##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/ThreadIdGuessingAlgorithm.java
##########
@@ -0,0 +1,27 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail;
+
+import org.apache.james.mailbox.model.ThreadId;
+import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+
+public interface ThreadIdGuessingAlgorithm {
+    ThreadId getThreadId(MailboxMessage mailboxMessage);

Review comment:
       ```suggestion
       ThreadId getThreadId(MessageId messageId, List<References> references, Subject subject);
   ```
   
   With
   
   ```
   public class Reference {
       private final String value;
       
       // ...
   }
   ```
   
   and 
   
   ```
   public class Subject {
       private final String value;
       
       // ...
   }
   ```
   
   Where references aggegates the In-Reply-To // References header fields.




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

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


[GitHub] [james-project] quantranhong1999 commented on pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
quantranhong1999 commented on pull request #481:
URL: https://github.com/apache/james-project/pull/481#issuecomment-858477136


   
   > When I have 5 minutes I will answer you, but likely on the server-dev mailing list :-)
   > About the difference between Message-ID and MessageId, Tung just sent me this : https://www.mail-archive.com/server-user@james.apache.org/msg16459.html?fbclid=IwAR11h5J8N2JzWntoPX-bsEXKnkliuvvc_QCPgs6hAomYVXcskPX1sEr-SoM
   
   
   
   


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

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


[GitHub] [james-project] Arsnael merged pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
Arsnael merged pull request #481:
URL: https://github.com/apache/james-project/pull/481


   


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

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


[GitHub] [james-project] chibenwa commented on a change in pull request #481: JAMES-3516 Implement naive ThreadIdGuessingAlgorithm

Posted by GitBox <gi...@apache.org>.
chibenwa commented on a change in pull request #481:
URL: https://github.com/apache/james-project/pull/481#discussion_r648853524



##########
File path: mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/ThreadIdGuessingAlgorithmImpl.java
##########
@@ -0,0 +1,30 @@
+/******************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one     *
+ * or more contributor license agreements.  See the NOTICE file   *
+ * distributed with this work for additional information          *
+ * regarding copyright ownership.  The ASF licenses this file     *
+ * to you under the Apache License, Version 2.0 (the              *
+ * "License"); you may not use this file except in compliance     *
+ * with the License.  You may obtain a copy of the License at     *
+ *                                                                *
+ * http://www.apache.org/licenses/LICENSE-2.0                     *
+ *                                                                *
+ * Unless required by applicable law or agreed to in writing,     *
+ * software distributed under the License is distributed on an    *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY         *
+ * KIND, either express or implied.  See the License for the      *
+ * specific language governing permissions and limitations        *
+ * under the License.                                             *
+ ******************************************************************/
+
+package org.apache.james.mailbox.store.mail;
+
+import org.apache.james.mailbox.model.ThreadId;
+import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+
+public class ThreadIdGuessingAlgorithmImpl implements ThreadIdGuessingAlgorithm {

Review comment:
       NaiveThreadIdGuessingAlgorithm




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

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