From 91cdc3494f3b20b621a7fcb26c934f8ee52aea4e Mon Sep 17 00:00:00 2001 From: wmorgan Date: Sun, 25 Mar 2007 18:45:44 +0000 Subject: [PATCH] notify user of source errors on startup and on poll git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@352 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- bin/sup | 7 +++++-- doc/TODO | 14 +++++++++++--- lib/sup.rb | 19 ++++++++++++++++++- lib/sup/mbox/loader.rb | 4 ++++ lib/sup/poll.rb | 2 ++ lib/sup/source.rb | 2 +- 6 files changed, 41 insertions(+), 7 deletions(-) diff --git a/bin/sup b/bin/sup index fac2f3b..b2c16dc 100644 --- a/bin/sup +++ b/bin/sup @@ -98,16 +98,19 @@ begin imode = InboxMode.new ibuf = bm.spawn "inbox", imode - log "ready for (inter)action!" + log "ready for interaction!" Logger.make_buf bm.draw_screen + + Redwood::report_broken_sources + Index.usual_sources.each do |s| reporting_thread do begin s.connect rescue SourceError => e - Redwood::log "Fatal error loading from #{s}: #{e.message}" + Redwood::log "fatal error loading from #{s}: #{e.message}" end end if s.respond_to? :connect end diff --git a/doc/TODO b/doc/TODO index f924b90..7a78fb0 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,13 +1,14 @@ for 0.0.8 --------- +_ split out threading & message chunk parsing to a separate library +_ ferret upgrade script (dump & restore) +_ nice little startup config program x maildir x bugfix: single-line messages come empty upon reply _ bugfix: when one new message comes into an imap folder, we don't catch it until a reload _ bugfix: triggering a pageup when cursor scrolling up jumps to the bottom of the page rather than the next line -_ warnings: top-posting, missing attachment -_ split out threading & message chunk parsing to a separate library x compose in thread-view-mode auto-fills in person _ bugfix: stars on messages with blue backgrounds still have green bgs x bugfix: mark messages as read immediately when t-v-m is opened @@ -15,6 +16,11 @@ _ bugfix: m in thread-view-mode when a person is not selected should open up a blank compose-mode rather than do nothing _ Net::SMTP support (cuz I'm going to need it soon) x bugfix: 'N' in thread-view-mode (expand only new messages) crashes +_ bugfix: detect source corruption at startup +_ bugfix: add new message counts until keypress +_ bugfix: attachment filenames sometimes not detected (filename=) +_ bugfix: final logging messages to stdout? +_ bugfix: mbox directory shouldn't generate an exception, just an error for 0.0.9 --------- @@ -23,10 +29,12 @@ _ forward attachments _ select all, starred, to me, etc _ undo _ gmail +_ warnings: top-posting, missing attachment, ruby-talk:XXXX detection future ------ -pluggable modules such as ruby-talk:XXXXX detection, "attachment" but no attachment, top-posting +search results: highlight relevant snippets and open to relevant portion of thread +email address to name mapping needs some work. automatic email addresses (noreply@...) are often assigned to something screwy. decode RFC 2047 ("encoded word") headers - see: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/101949, http://dev.rubyonrails.org/ticket/6807 swappable keymappings diff --git a/lib/sup.rb b/lib/sup.rb index 76b435d..f9021ba 100644 --- a/lib/sup.rb +++ b/lib/sup.rb @@ -95,7 +95,24 @@ module Redwood Redwood::PersonManager.save end - module_function :register_yaml, :save_yaml_obj, :load_yaml_obj, :start, :finish + ## not really a good place for this, so I'll just dump it here. + def report_broken_sources + broken_sources = Index.usual_sources.select { |s| s.broken? } + unless broken_sources.empty? + BufferManager.spawn "Broken source report", TextMode.new(< end_offset + self.broken_msg = "mbox file is smaller than last recorded message offset. Messages have probably been deleted via another client. Run 'sup-import --rebuild #{to_s}' to correct this." + end end def start_offset; 0; end diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb index 4d1f1ef..e85b019 100644 --- a/lib/sup/poll.rb +++ b/lib/sup/poll.rb @@ -111,10 +111,12 @@ class PollManager end rescue MessageFormatError, SourceError => e Redwood::log "ignoring erroneous message at #{source}##{offset}: #{e.message}" + Redwood::report_broken_sources if BufferManager.instantiated? end end rescue SourceError => e Redwood::log "problem getting messages from #{source}: #{e.message}" + Redwood::report_broken_sources if BufferManager.instantiated? end end end diff --git a/lib/sup/source.rb b/lib/sup/source.rb index d3f96e1..be01780 100644 --- a/lib/sup/source.rb +++ b/lib/sup/source.rb @@ -71,7 +71,7 @@ class Source def to_s; @uri.to_s; end def seek_to! o; self.cur_offset = o; end def reset! - return if broken? + @broken_msg = nil begin seek_to! start_offset rescue SourceError -- 2.45.2