diff options
Diffstat (limited to '')
-rw-r--r-- | lib/feed2imap/imap.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/feed2imap/imap.rb b/lib/feed2imap/imap.rb index 70a0aa0..301b95c 100644 --- a/lib/feed2imap/imap.rb +++ b/lib/feed2imap/imap.rb @@ -99,13 +99,15 @@ class ImapAccount def updatemail(folder, mail, idx) @connection.select(folder) searchres = @connection.search(['HEADER', 'X-CacheIndex', "-#{idx}-"]) + flags = nil if searchres.length == 1 + flags = @connection.fetch(searchres[0], 'FLAGS')[0].attr['FLAGS'] @connection.store(searchres[0], "+FLAGS", [:Deleted]) @connection.expunge elsif searchres.length != 0 raise "Search returned multiple results !!" end - putmail(folder, mail) + @connection.append(folder, mail, flags) end def to_s |