diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | lib/feed2imap/imap.rb | 7 |
2 files changed, 4 insertions, 4 deletions
@@ -1,5 +1,6 @@ Feed2Imap 0.3 (date unknown) ============================ +* Cleaner way to manage duplicate IDs (#1773) * Fixed a problem with pseudo-duplicate entries from Mediawiki * Fixed a problem with updated items being seen as updated at each update. * Fixed a problem when the disconnection from the IMAP server failed. diff --git a/lib/feed2imap/imap.rb b/lib/feed2imap/imap.rb index 301b95c..db5df7a 100644 --- a/lib/feed2imap/imap.rb +++ b/lib/feed2imap/imap.rb @@ -100,12 +100,11 @@ class ImapAccount @connection.select(folder) searchres = @connection.search(['HEADER', 'X-CacheIndex', "-#{idx}-"]) flags = nil - if searchres.length == 1 + if searchres.length > 0 + # we get the flags from the first result and delete everything flags = @connection.fetch(searchres[0], 'FLAGS')[0].attr['FLAGS'] - @connection.store(searchres[0], "+FLAGS", [:Deleted]) + searchres.each { |m| @connection.store(m, "+FLAGS" [:Deleted]) } @connection.expunge - elsif searchres.length != 0 - raise "Search returned multiple results !!" end @connection.append(folder, mail, flags) end |