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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]