aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-23 20:10:05 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-23 20:10:05 +0200
commit6bd87a567ef481b922f6baec2b475ec376c45443 (patch)
treed13c1995234acd3a07d16dafb009aa53ba05a7cb /main.go
parent7bfe97f3e72279a17c16803d64a16beb55944332 (diff)
downloadfeed2imap-go-6bd87a567ef481b922f6baec2b475ec376c45443.tar.gz
feed2imap-go-6bd87a567ef481b922f6baec2b475ec376c45443.tar.bz2
feed2imap-go-6bd87a567ef481b922f6baec2b475ec376c45443.zip
Concurrent imap
Diffstat (limited to '')
-rw-r--r--main.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/main.go b/main.go
index 0fd5ba4..5764ae4 100644
--- a/main.go
+++ b/main.go
@@ -31,13 +31,15 @@ func processFeed(feed *feed.Feed, cfg *config.Config, client *imap.Client, wg *s
}
folder := client.NewFolder(feed.Target)
- client.EnsureFolder(folder, func(err error) string {
- return fmt.Sprintf("Creating folder of feed %s: %s", feed.Name, err)
- })
+ if err = client.EnsureFolder(folder); err != nil {
+ log.Errorf("Creating folder of feed %s: %s", feed.Name, err)
+ return
+ }
- client.PutMessages(folder, mails, func(err error) string {
- return fmt.Sprintf("Uploading messages of feed %s: %s", feed.Name, err)
- })
+ if err = client.PutMessages(folder, mails); err != nil {
+ log.Errorf("Uploading messages of feed %s: %s", feed.Name, err)
+ return
+ }
log.Printf("Uploaded %d messages to '%s' @ %s", len(mails), feed.Name, folder)
}