From: wmorgan Date: Sun, 1 Apr 2007 22:59:22 +0000 (+0000) Subject: added pre checks for maildir and imap X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=f7a497c1fb31214bdb24df2c42bb4c5a502019ba;p=sup added pre checks for maildir and imap git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@362 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb index 6a6085c..d68ab7b 100644 --- a/lib/sup/imap.rb +++ b/lib/sup/imap.rb @@ -64,6 +64,8 @@ class IMAP < Source end def ssl?; @parsed_uri.scheme == 'imaps' end + def check; scan_mailbox; end + ## is this necessary? TODO: remove maybe def == o; o.is_a?(IMAP) && o.uri == self.uri && o.username == self.username; end diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb index 58be596..2db7ad8 100644 --- a/lib/sup/maildir.rb +++ b/lib/sup/maildir.rb @@ -25,6 +25,11 @@ class Maildir < Source @mutex = Mutex.new end + def check + scan_mailbox + start = @ids.index(cur_offset || start_offset) or raise OutOfSyncSourceError, "Unknown message id #{cur_offset || start_offset}." # couldn't find the most recent email + end + def load_header id scan_mailbox with_file_for(id) { |f| MBox::read_header f }