diff options
author | Lucas Nussbaum <lucas@lucas-nussbaum.net> | 2010-11-30 22:03:03 +0100 |
---|---|---|
committer | Lucas Nussbaum <lucas@lucas-nussbaum.net> | 2010-11-30 22:03:03 +0100 |
commit | c46c823aff3ad63fbc62c2281ac4fddb0bcb1e21 (patch) | |
tree | 13952d711e7a96ab1580c84a595c04dce89b4134 /lib/feed2imap/imap.rb | |
parent | 94dc1db641f98242496a32409e823920f4e700e9 (diff) | |
download | feed2imap-c46c823aff3ad63fbc62c2281ac4fddb0bcb1e21.tar.gz feed2imap-c46c823aff3ad63fbc62c2281ac4fddb0bcb1e21.tar.bz2 feed2imap-c46c823aff3ad63fbc62c2281ac4fddb0bcb1e21.zip |
Add a reupload_if_updated option (default: true)
Following a discussion on feed2imap-devel, add a reupload_if_updated
option. When set to false, if an item is updated, but was previously
removed from the IMAP server, it is no longer re-uploaded.
Also fix some config file parsing bugs for the disable-ssl-verification
and include-images options. I should really switch to another way to
describe F2I config...
Diffstat (limited to 'lib/feed2imap/imap.rb')
-rw-r--r-- | lib/feed2imap/imap.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/feed2imap/imap.rb b/lib/feed2imap/imap.rb index c4e7106..60775e2 100644 --- a/lib/feed2imap/imap.rb +++ b/lib/feed2imap/imap.rb @@ -108,7 +108,7 @@ class ImapAccount end # update a mail - def updatemail(folder, mail, id, date = Time::now) + def updatemail(folder, mail, id, date = Time::now, reupload_if_updated = true) create_folder_if_not_exists(folder) @connection.select(folder) searchres = @connection.search(['HEADER', 'Message-Id', id]) @@ -119,6 +119,9 @@ class ImapAccount searchres.each { |m| @connection.store(m, "+FLAGS", [:Deleted]) } @connection.expunge flags -= [ :Recent ] # avoids errors with dovecot + elsif not reupload_if_updated + # mail not present, and we don't want to re-upload it + return end @connection.append(folder, mail.gsub(/\n/, "\r\n"), flags, date) end |