]> git.cworth.org Git - sup/commitdiff
fixed off-by-one error in imap.rb and maildir.rb
authorChristopher Warrington <chrisw@rice.edu>
Mon, 3 Mar 2008 08:00:33 +0000 (02:00 -0600)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Wed, 26 Mar 2008 16:03:25 +0000 (09:03 -0700)
The end_offset reported by imap and maildir sources was incorrect if there was
only one message in the source. Since end_offset is exclusive, we must add one to
the last known id to get include all valid message ids in the range.

lib/sup/imap.rb
lib/sup/maildir.rb

index e785597ab086402712ae5e834eb1be37a7236e85..1d369767c43106fdb19737244f172adbba8f644c 100644 (file)
@@ -176,7 +176,7 @@ class IMAP < Source
 
   def end_offset
     unsynchronized_scan_mailbox
-    @ids.last
+    @ids.last + 1
   end
   synchronized :end_offset
 
index 5c9600d335efb8f9c0ae267d6907b174cf700c4b..584e657793ed2b66779c6ccf62ac7f2188de0943 100644 (file)
@@ -123,7 +123,7 @@ class Maildir < Source
 
   def end_offset
     scan_mailbox :rescan => true
-    @ids.last
+    @ids.last + 1
   end
 
   def pct_done; 100.0 * (@ids.index(cur_offset) || 0).to_f / (@ids.length - 1).to_f; end