aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Magorsch <arzano@gentoo.org>2020-06-24 19:30:08 +0200
committerMax Magorsch <arzano@gentoo.org>2020-06-24 19:30:08 +0200
commit6e09d1b276002c87b0a1b5669c5c8fbbc191ba8f (patch)
tree5814c66024bedc717c786f2c0630899104e61308 /pkg/importer/utils.go
parentFix the InReplyTo reference (diff)
downloadarchives-6e09d1b276002c87b0a1b5669c5c8fbbc191ba8f.tar.gz
archives-6e09d1b276002c87b0a1b5669c5c8fbbc191ba8f.tar.bz2
archives-6e09d1b276002c87b0a1b5669c5c8fbbc191ba8f.zip
Rename MessageId to MessageIdField
Unfortunately the name MessageId conflicts with go-pgs many2many relationship. That's why MessageId has been renamed to MessageIdField. However, a convenience method MessageId() has been added for backwards compability in templates. Signed-off-by: Max Magorsch <arzano@gentoo.org>
Diffstat (limited to 'pkg/importer/utils.go')
-rw-r--r--pkg/importer/utils.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/pkg/importer/utils.go b/pkg/importer/utils.go
index 026ba41..ab9072f 100644
--- a/pkg/importer/utils.go
+++ b/pkg/importer/utils.go
@@ -54,7 +54,7 @@ func initImport(path string, info os.FileInfo, err error) error {
From: m.Header.Get("From"),
To: strings.Split(m.Header.Get("To"), ","),
Subject: m.Header.Get("Subject"),
- MessageId: m.Header.Get("Message-Id"),
+ MessageIdField: m.Header.Get("Message-Id"),
})
}
return nil
@@ -83,7 +83,7 @@ func importIntoDatabase(path, filename string, m *mail.Message) {
bodyContent, attachments := parseBody(m)
msg := models.Message{
Id: m.Header.Get("X-Archives-Hash"),
- MessageId: m.Header.Get("Message-Id"),
+ MessageIdField: m.Header.Get("Message-Id"),
Filename: filename,
From: m.Header.Get("From"),
To: parseAddressList(m.Header.Get("To")),
@@ -127,13 +127,13 @@ func parseAddressList(addressList string) []string {
func getInReplyToMail(messageId, from string) string {
// step 1 TODO add description
for _, mail := range mails {
- if mail.MessageId == messageId && strings.Contains(strings.Join(mail.To, ", "), from) {
+ if mail.MessageId() == messageId && strings.Contains(strings.Join(mail.To, ", "), from) {
return mail.Id
}
}
// step 2 TODO add description
for _, mail := range mails {
- if mail.MessageId == messageId {
+ if mail.MessageId() == messageId {
return mail.Id
}
}
@@ -146,13 +146,13 @@ func insertReferencesToMail(references []string, messageId, from string) []*mode
for _, reference := range references {
// step 1 TODO add description
for _, mail := range mails {
- if mail.MessageId == reference && strings.Contains(strings.Join(mail.To, ", "), from) {
+ if mail.MessageId() == reference && strings.Contains(strings.Join(mail.To, ", "), from) {
referencesToMail = append(referencesToMail, mail)
}
}
// step 2 TODO add description
for _, mail := range mails {
- if mail.MessageId == reference {
+ if mail.MessageId() == reference {
referencesToMail = append(referencesToMail, mail)
}
}