commit 55133abad76e8415a078fa0b0749094406f4d08a
parent 11ba44823d731a5e5bd18401e46cc6cb5f8bfb55
Author: William Morgan <wmorgan-sup@masanjin.net>
Date: Wed, 29 Apr 2009 13:48:18 -0400
don't require has_errors? in Source objects
Properly speaking that's a function of a Recoverable object, not of a
source, so only call that method when it's availably.
Diffstat:
3 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
@@ -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 =
diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb
@@ -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
diff --git a/test/dummy_source.rb b/test/dummy_source.rb
@@ -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