]> git.notmuchmail.org Git - sup/commitdiff
added pre checks for maildir and imap
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sun, 1 Apr 2007 22:59:22 +0000 (22:59 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sun, 1 Apr 2007 22:59:22 +0000 (22:59 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@362 5c8cc53c-5e98-4d25-b20a-d8db53a31250

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

index 6a6085c0eaa9442a68884eaec638fe057517282d..d68ab7b3ace877d618930424faf083de53e5a9bf 100644 (file)
@@ -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
 
index 58be5962c385c6d08f6e5acec4440cd6596fdd21..2db7ad85454ceedeb6911054d198b59a89e42429 100644 (file)
@@ -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 }