diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-22 23:40:53 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-22 23:40:53 +0200 |
commit | 9280ecb7e0b0039d6c1f4800373eb76452145078 (patch) | |
tree | e3dd11e9953f949709505731a16e8246afe536aa /internal/feed/mail.go | |
parent | 15b6c155a8476cf86e8bd745e239e55e77317909 (diff) | |
download | feed2imap-go-9280ecb7e0b0039d6c1f4800373eb76452145078.tar.gz feed2imap-go-9280ecb7e0b0039d6c1f4800373eb76452145078.tar.bz2 feed2imap-go-9280ecb7e0b0039d6c1f4800373eb76452145078.zip |
Concurrent feed processing; central imap handler
Diffstat (limited to 'internal/feed/mail.go')
-rw-r--r-- | internal/feed/mail.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/feed/mail.go b/internal/feed/mail.go index 256c4fe..e8b6915 100644 --- a/internal/feed/mail.go +++ b/internal/feed/mail.go @@ -16,7 +16,7 @@ func address(name, address string) []*mail.Address { return []*mail.Address{{Name: name, Address: address}} } -func fromAdress(feed *Feed, item feeditem, cfg config.Config) []*mail.Address { +func fromAdress(feed *Feed, item feeditem, cfg *config.Config) []*mail.Address { switch { case item.Item.Author != nil && item.Item.Author.Email != "": return address(item.Item.Author.Name, item.Item.Author.Email) @@ -35,7 +35,7 @@ func writeHtml(writer io.Writer, item feeditem) error { return template.Feed.Execute(writer, item) } -func writeToBuffer(b *bytes.Buffer, feed *Feed, item feeditem, cfg config.Config) error { +func writeToBuffer(b *bytes.Buffer, feed *Feed, item feeditem, cfg *config.Config) error { var h mail.Header h.SetAddressList("From", fromAdress(feed, item, cfg)) h.SetAddressList("To", address(feed.Name, cfg.DefaultEmail)) @@ -98,7 +98,7 @@ func writeToBuffer(b *bytes.Buffer, feed *Feed, item feeditem, cfg config.Config return nil } -func asMail(feed *Feed, item feeditem, cfg config.Config) (string, error) { +func asMail(feed *Feed, item feeditem, cfg *config.Config) (string, error) { var b bytes.Buffer if err := writeToBuffer(&b, feed, item, cfg); err != nil { @@ -108,7 +108,7 @@ func asMail(feed *Feed, item feeditem, cfg config.Config) (string, error) { return b.String(), nil } -func (feed *Feed) ToMails(cfg config.Config) ([]string, error) { +func (feed *Feed) ToMails(cfg *config.Config) ([]string, error) { var ( err error mails = make([]string, len(feed.items)) |