aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Magorsch <arzano@gentoo.org>2020-06-24 21:54:58 +0000
committerMax Magorsch <arzano@gentoo.org>2020-06-24 21:54:58 +0000
commitfea5c85fc458a521b3eff9e48cce55f435a4c9f4 (patch)
treeb9b17e847f451d33c0e5e6d24769c6a1253e49ad /pkg/importer/importer.go
parentFix the computation of replies to a message (diff)
downloadarchives-fea5c85fc458a521b3eff9e48cce55f435a4c9f4.tar.gz
archives-fea5c85fc458a521b3eff9e48cce55f435a4c9f4.tar.bz2
archives-fea5c85fc458a521b3eff9e48cce55f435a4c9f4.zip
Add an option to recompute the thread references
Signed-off-by: Max Magorsch <arzano@gentoo.org>
Diffstat (limited to 'pkg/importer/importer.go')
-rw-r--r--pkg/importer/importer.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/pkg/importer/importer.go b/pkg/importer/importer.go
index 76ba8e7..e83bd9f 100644
--- a/pkg/importer/importer.go
+++ b/pkg/importer/importer.go
@@ -79,6 +79,20 @@ func IncrementalImport() {
fmt.Println("Finished incremental import. Imported " + strconv.Itoa(importedCounter) + " new messages.")
}
+func RecomputeThreads() {
+
+ fmt.Println("Init thread computation...")
+ filepath.Walk(config.MailDirPath(), initImport)
+
+ for _, mail := range mails {
+ insertReferencesToMail(mail.RawReferences, mail.Id, mail.From)
+ }
+
+ fmt.Println("Finished thread computation.")
+}
+
+// utility methods
+
func fileIsAlreadyPresent(path string, messages []*models.Message) bool {
for _, message := range messages {
if strings.Contains(strings.TrimRight(path, ",S"), strings.TrimRight(message.Filename, ",S")){
@@ -86,4 +100,4 @@ func fileIsAlreadyPresent(path string, messages []*models.Message) bool {
}
}
return false
-} \ No newline at end of file
+}