From 55133abad76e8415a078fa0b0749094406f4d08a Mon Sep 17 00:00:00 2001 From: William Morgan Date: Wed, 29 Apr 2009 13:48:18 -0400 Subject: [PATCH] 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. --- lib/sup/message.rb | 3 ++- lib/sup/poll.rb | 2 +- test/dummy_source.rb | 7 ------- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/sup/message.rb b/lib/sup/message.rb index 0ee46fb..3c21a43 100644 --- 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 index d766587..220fee3 100644 --- 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 index f3afa31..e0fbf81 100644 --- 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 -- 2.45.2