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



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

Reply via email to