From f7a497c1fb31214bdb24df2c42bb4c5a502019ba Mon Sep 17 00:00:00 2001 From: wmorgan Date: Sun, 1 Apr 2007 22:59:22 +0000 Subject: [PATCH] added pre checks for maildir and imap git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@362 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- lib/sup/imap.rb | 2 ++ lib/sup/maildir.rb | 5 +++++ 2 files changed, 7 insertions(+) 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 } -- 2.45.2