From mboxrd@z Thu Jan 1 00:00:00 1970 From: chrisw@rice.edu (Christopher Warrington) Date: Mon, 3 Mar 2008 02:00:33 -0600 Subject: [sup-talk] [PATCH] fixed off-by-one error in imap.rb and maildir.rb In-Reply-To: <1204528063-sup-7345@chris-tablet> References: <1204528063-sup-7345@chris-tablet> Message-ID: <1204531233-2092-1-git-send-email-chrisw@rice.edu> 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 | 2 +- lib/sup/maildir.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb index e785597..1d36976 100644 --- a/lib/sup/imap.rb +++ b/lib/sup/imap.rb @@ -176,7 +176,7 @@ class IMAP < Source def end_offset unsynchronized_scan_mailbox - @ids.last + @ids.last + 1 end synchronized :end_offset diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb index 5c9600d..584e657 100644 --- a/lib/sup/maildir.rb +++ b/lib/sup/maildir.rb @@ -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 -- 1.5.3.7