]> git.cworth.org Git - sup/blobdiff - lib/sup/imap.rb
yet more error handling updates
[sup] / lib / sup / imap.rb
index 6a6085c0eaa9442a68884eaec638fe057517282d..0f539eea4f7fa26e5f1bd61ca714d84e2601825c 100644 (file)
@@ -64,6 +64,16 @@ class IMAP < Source
   end
   def ssl?; @parsed_uri.scheme == 'imaps' end
 
+  def check
+    ids = 
+      @mutex.synchronize do
+        unsynchronized_scan_mailbox
+        @ids
+      end
+
+    start = ids.index(cur_offset || start_offset) or raise OutOfSyncSourceError, "Unknown message id #{cur_offset || start_offset}."
+  end
+
   ## is this necessary? TODO: remove maybe
   def == o; o.is_a?(IMAP) && o.uri == self.uri && o.username == self.username; end
 
@@ -230,7 +240,7 @@ private
         end
         raise
       end
-    rescue Net, SocketError, Net::IMAP::Error, SystemCallError => e
+    rescue SocketError, Net::IMAP::Error, SystemCallError, IOError => e
       raise FatalSourceError, "While communicating with IMAP server: #{e.message}"
     end
   end