Permalink
Browse files

Merge branch 'maildir'

  • Loading branch information...
2 parents c5d6fdf + 113b6f7 commit bc6519b2cef97b592b74a90ace0288310e35aed9 Chimrod committed Aug 31, 2011
Showing with 13 additions and 17 deletions.
  1. +11 −16 lib/feed2imap/cache.rb
  2. +2 −1 lib/feed2imap/maildir.rb
View
@@ -189,26 +189,21 @@ def get_new_items(items, always_new = false, ignore_hash = false)
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
View
@@ -49,6 +49,7 @@ def updatemail(folder, mail, idx, date = Time::now, reupload_if_updated = true)
return
end
store_message(dir, date, info) { |f| f.puts(mail) }
+ puts info
end
def to_s
@@ -163,7 +164,7 @@ def maildir_file_info(file)
basename = File.basename(file)
colon = basename.rindex(':')
- return (colon and basename.slice(colon + 1, -1))
+ return (colon and basename[colon + 1 .. -1])
end
# Re-written and no longer shamelessly taken from

0 comments on commit bc6519b

Please sign in to comment.