Implementation of the JWZ algorithm for threading email messages as described by Jamie Zawinski at http://www.jwz.org/doc/threading.html.
import JWZThreading
// Create an array of messages
let messages = downloadedMessages.map({
JWZMessage(id: $0.header.messageID, message: $0, inReplyTo: $0.header.inReplyTo, references: $0.header.references)
})
// Call `thread(from:)` with a list of messages
let threads = JWZThread.thread(from: messages)
// Output the result
for container in threads {
print(container.message?.id, container.children.count)
}
This project is licensed under the MIT License - see the LICENSE file for details