aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/mail.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2021-02-22 22:54:43 +0100
committerRené 'Necoro' Neumann <necoro@necoro.eu>2021-02-22 22:54:43 +0100
commit7106d5a6e7585dce5fdd552cca30063dd352dc23 (patch)
tree88a9cb7150f86fcadb8f87e3a6d0892bf68c2251 /internal/feed/mail.go
parentfb2aa9b1f04d509c8215c1fa6505a144482c343d (diff)
downloadfeed2imap-go-7106d5a6e7585dce5fdd552cca30063dd352dc23.tar.gz
feed2imap-go-7106d5a6e7585dce5fdd552cca30063dd352dc23.tar.bz2
feed2imap-go-7106d5a6e7585dce5fdd552cca30063dd352dc23.zip
Split cache and feed packages
Diffstat (limited to '')
-rw-r--r--internal/feed/mail.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/internal/feed/mail.go b/internal/feed/mail.go
index b201d61..636f6a0 100644
--- a/internal/feed/mail.go
+++ b/internal/feed/mail.go
@@ -31,7 +31,7 @@ func address(name, address string) []*mail.Address {
return []*mail.Address{{Name: name, Address: address}}
}
-func (item *item) fromAddress() []*mail.Address {
+func (item *Item) fromAddress() []*mail.Address {
switch {
case item.Author != nil && item.Author.Email != "":
return address(item.Author.Name, item.Author.Email)
@@ -46,11 +46,11 @@ func (item *item) fromAddress() []*mail.Address {
}
}
-func (item *item) toAddress() []*mail.Address {
+func (item *Item) toAddress() []*mail.Address {
return address(item.feed.Name, item.defaultEmail())
}
-func (item *item) buildHeader() message.Header {
+func (item *Item) buildHeader() message.Header {
var h mail.Header
h.SetContentType("multipart/alternative", nil)
h.SetAddressList("From", item.fromAddress())
@@ -58,7 +58,7 @@ func (item *item) buildHeader() message.Header {
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(msg.IdHeader, item.Id())
h.Set(msg.CreateHeader, time.Now().Format(time.RFC1123Z))
if item.GUID != "" {
h.Set(msg.GuidHeader, item.GUID)
@@ -86,7 +86,7 @@ func (item *item) buildHeader() message.Header {
return h.Header
}
-func (item *item) writeContentPart(w *message.Writer, typ string, tpl template.Template) error {
+func (item *Item) writeContentPart(w *message.Writer, typ string, tpl template.Template) error {
var ih message.Header
ih.SetContentType("text/"+typ, map[string]string{"charset": "utf-8"})
ih.SetContentDisposition("inline", nil)
@@ -105,11 +105,11 @@ func (item *item) writeContentPart(w *message.Writer, typ string, tpl template.T
return nil
}
-func (item *item) writeTextPart(w *message.Writer) error {
+func (item *Item) writeTextPart(w *message.Writer) error {
return item.writeContentPart(w, "plain", template.Text)
}
-func (item *item) writeHtmlPart(w *message.Writer) error {
+func (item *Item) writeHtmlPart(w *message.Writer) error {
return item.writeContentPart(w, "html", template.Html)
}
@@ -133,7 +133,7 @@ func (img *feedImage) writeImagePart(w *message.Writer, cid string) error {
return nil
}
-func (item *item) writeToBuffer(b *bytes.Buffer) error {
+func (item *Item) writeToBuffer(b *bytes.Buffer) error {
h := item.buildHeader()
item.buildBody()
@@ -178,7 +178,7 @@ func (item *item) writeToBuffer(b *bytes.Buffer) error {
return nil
}
-func (item *item) message() (msg.Message, error) {
+func (item *Item) message() (msg.Message, error) {
var b bytes.Buffer
if err := item.writeToBuffer(&b); err != nil {
@@ -187,8 +187,8 @@ func (item *item) message() (msg.Message, error) {
msg := msg.Message{
Content: b.String(),
- IsUpdate: item.updateOnly,
- ID: item.id(),
+ IsUpdate: item.UpdateOnly,
+ ID: item.Id(),
}
return msg, nil
@@ -251,7 +251,7 @@ func getBody(content, description string, bodyCfg config.Body) string {
}
}
-func (item *item) buildBody() {
+func (item *Item) buildBody() {
feed := item.feed
var feedUrl *url.URL