summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorlnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972>2005-05-14 08:51:02 +0000
committerlnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972>2005-05-14 08:51:02 +0000
commit6a1d8476735dd8c9581380cf6af8125da69022c4 (patch)
treeae55a83224602b1a951fcb1228419e47f95b51c6 /lib
parented0c0c41c728717de3a6afcdf071100a680649aa (diff)
downloadfeed2imap-6a1d8476735dd8c9581380cf6af8125da69022c4.tar.gz
feed2imap-6a1d8476735dd8c9581380cf6af8125da69022c4.tar.bz2
feed2imap-6a1d8476735dd8c9581380cf6af8125da69022c4.zip
cleaner way to manage dup ID
git-svn-id: svn+ssh://svn.gna.org/svn/feed2imap/trunk/feed2imap@27 f70e237a-67f3-0310-a06c-d2b8a7116972
Diffstat (limited to '')
-rw-r--r--lib/feed2imap/imap.rb7
1 files changed, 3 insertions, 4 deletions
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