From c46c823aff3ad63fbc62c2281ac4fddb0bcb1e21 Mon Sep 17 00:00:00 2001 From: Lucas Nussbaum Date: Tue, 30 Nov 2010 22:03:03 +0100 Subject: 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... --- lib/feed2imap/imap.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/feed2imap/imap.rb') 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 -- cgit v1.2.3-54-g00ecf