diff options
author | Chimrod <contact+git@chimrod.com> | 2011-08-31 09:33:06 +0200 |
---|---|---|
committer | Chimrod <contact+git@chimrod.com> | 2011-08-31 09:33:06 +0200 |
commit | cb226e31b19d923c4f06c71db5940bd169c7da38 (patch) | |
tree | cb4483380fc80e16be6d07dbffc9f00f1d1f554b | |
parent | dd474b72f01ca9ac3b431d0592cb10c19dee6415 (diff) | |
download | feed2imap-cb226e31b19d923c4f06c71db5940bd169c7da38.tar.gz feed2imap-cb226e31b19d923c4f06c71db5940bd169c7da38.tar.bz2 feed2imap-cb226e31b19d923c4f06c71db5940bd169c7da38.zip |
Merged loop
Diffstat (limited to '')
-rw-r--r-- | lib/feed2imap/cache.rb | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/lib/feed2imap/cache.rb b/lib/feed2imap/cache.rb index 6dc0ddf..d012910 100644 --- a/lib/feed2imap/cache.rb +++ b/lib/feed2imap/cache.rb @@ -189,26 +189,21 @@ class CachedChannel i.cacheditem.index = j.index found = true # let's put j in front of itemstemp + puts "got existing: #{j.to_s}" @itemstemp.delete(j) @itemstemp.unshift(j) break end - end - next if found - if not always_new - # Try to find an updated item - @items.each do |j| - # Do we need a better heuristic ? - if j.is_ancestor_of(i) - i.cacheditem.index = j.index - i.cacheditem.updated = true - updateditems.push(i) - found = true - # let's put j in front of itemstemp - @itemstemp.delete(j) - @itemstemp.unshift(i.cacheditem) - break - end + # If we didn't find exact match, try to check if we have an update + if j.is_ancestor_of(i) + i.cacheditem.index = j.index + i.cacheditem.updated = true + updateditems.push(i) + found = true + # let's put j in front of itemstemp + @itemstemp.delete(j) + @itemstemp.unshift(i.cacheditem) + break end end next if found |