aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-03 00:41:36 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-03 00:41:36 +0200
commit168cce8a935de864eef95f423f128a7bf49aafda (patch)
tree9cc240dd479b1e85fbb55e1cda4a14d3a938d50e /main.go
parentfec3ecd257c34fba37703b2999ab5ea902314657 (diff)
downloadfeed2imap-go-168cce8a935de864eef95f423f128a7bf49aafda.tar.gz
feed2imap-go-168cce8a935de864eef95f423f128a7bf49aafda.tar.bz2
feed2imap-go-168cce8a935de864eef95f423f128a7bf49aafda.zip
Update support for IMAP
Diffstat (limited to 'main.go')
-rw-r--r--main.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/main.go b/main.go
index 7f31a48..ec2e91f 100644
--- a/main.go
+++ b/main.go
@@ -20,13 +20,13 @@ var dryRun = flag.Bool("dry-run", false, "do everything short of uploading and w
var buildCache = flag.Bool("build-cache", false, "only (re)build the cache; useful after migration or when the cache is lost or corrupted")
func processFeed(feed *feed.Feed, client *imap.Client, dryRun bool) {
- mails, err := feed.ToMails()
+ msgs, err := feed.Messages()
if err != nil {
log.Errorf("Processing items of feed %s: %s", feed.Name, err)
return
}
- if dryRun || len(mails) == 0 {
+ if dryRun || len(msgs) == 0 {
feed.MarkSuccess()
return
}
@@ -37,12 +37,12 @@ func processFeed(feed *feed.Feed, client *imap.Client, dryRun bool) {
return
}
- if err = client.PutMessages(folder, mails); err != nil {
+ if err = msgs.Upload(client, folder, feed.Reupload); 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)
+ log.Printf("Uploaded %d messages to '%s' @ %s", len(msgs), feed.Name, folder)
feed.MarkSuccess()
}