]> git.cworth.org Git - sup/commitdiff
don't require has_errors? in Source objects
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Wed, 29 Apr 2009 17:48:18 +0000 (13:48 -0400)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Wed, 29 Apr 2009 17:52:48 +0000 (13:52 -0400)
Properly speaking that's a function of a Recoverable object, not of a
source, so only call that method when it's availably.

lib/sup/message.rb
lib/sup/poll.rb
test/dummy_source.rb

index 0ee46fb25d7ecbb97807910c9fa0785337bccc2c..3c21a437dc664a6f6090630cdb24177389c28535 100644 (file)
@@ -198,7 +198,7 @@ class Message
   ## this is called when the message body needs to actually be loaded.
   def load_from_source!
     @chunks ||=
-      if @source.has_errors?
+      if @source.respond_to?(:has_errors?) && @source.has_errors?
         [Chunk::Text.new(error_message(@source.error.message).split("\n"))]
       else
         begin
@@ -372,6 +372,7 @@ private
     [notice, sig, children].flatten.compact
   end
 
+  ## takes a RMail::Message, breaks it into Chunk:: classes.
   def message_to_chunks m, encrypted=false, sibling_types=[]
     if m.multipart?
       chunks =
index d766587f58815f27ec07b485c07ca6ec5204542a..220fee38c6acf8f1b9a8435046a4b40af50873b0 100644 (file)
@@ -86,7 +86,7 @@ EOS
       Index.usual_sources.each do |source|
 #        yield "source #{source} is done? #{source.done?} (cur_offset #{source.cur_offset} >= #{source.end_offset})"
         begin
-          yield "Loading from #{source}... " unless source.done? || source.has_errors?
+          yield "Loading from #{source}... " unless source.done? || (source.respond_to?(:has_errors?) && source.has_errors?)
         rescue SourceError => e
           Redwood::log "problem getting messages from #{source}: #{e.message}"
           Redwood::report_broken_sources :force_to_top => true
index f3afa31e51a648da767c56e18cfb6fcaca635fe8..e0fbf812527acb8536d3a3bb465f6c53ea8a0519 100644 (file)
@@ -53,13 +53,6 @@ class DummySource < Source
       yield f.gets
     end
   end
-
-  # FIXME: this one was not mentioned in the source documentation, but
-  # it's still required
-  def has_errors?
-
-  end
-
 end
 
 end