aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-07 21:56:48 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-07 21:56:48 +0200
commitdcd8b2cff159017ebbf1b0b02cb0d60b1248627d (patch)
tree6cc1275ca5bedb6cfff97951f39321601ff99e66
parent7197e2880981cd4205485cc8724d741948df60de (diff)
downloadfeed2imap-go-dcd8b2cff159017ebbf1b0b02cb0d60b1248627d.tar.gz
feed2imap-go-dcd8b2cff159017ebbf1b0b02cb0d60b1248627d.tar.bz2
feed2imap-go-dcd8b2cff159017ebbf1b0b02cb0d60b1248627d.zip
Add header X-Feed2Imap-GUID
-rw-r--r--CHANGELOG.md2
-rw-r--r--internal/feed/mail.go5
-rw-r--r--internal/msg/msg.go1
3 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7ededfd..4338b73 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
+### Added
+- New header X-Feed2Imap-Guid
### Changed
- Default for `min-frequency` is now 0 instead of 1.
diff --git a/internal/feed/mail.go b/internal/feed/mail.go
index a763ef8..0a8bd10 100644
--- a/internal/feed/mail.go
+++ b/internal/feed/mail.go
@@ -57,10 +57,13 @@ func (item *item) buildHeader() message.Header {
h.SetContentType("multipart/alternative", nil)
h.SetAddressList("From", item.fromAddress())
h.SetAddressList("To", item.toAddress())
+ h.Set("Message-Id", item.messageId())
h.Set(msg.VersionHeader, version.Version())
h.Set(msg.ReasonHeader, strings.Join(item.reasons, ","))
h.Set(msg.IdHeader, item.id())
- h.Set("Message-Id", item.messageId())
+ if item.GUID != "" {
+ h.Set(msg.GuidHeader, item.GUID)
+ }
{ // date
date := item.DateParsed()
diff --git a/internal/msg/msg.go b/internal/msg/msg.go
index c71ddaf..a742a9d 100644
--- a/internal/msg/msg.go
+++ b/internal/msg/msg.go
@@ -12,6 +12,7 @@ const (
VersionHeader = "X-Feed2Imap-Version"
ReasonHeader = "X-Feed2Imap-Reason"
IdHeader = "X-Feed2Imap-Item"
+ GuidHeader = "X-Feed2Imap-Guid"
)
type Messages []Message