commit 91cdc3494f3b20b621a7fcb26c934f8ee52aea4e
parent eb794236cdcb067ad7c3404168067adc4dc7c8da
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date: Sun, 25 Mar 2007 18:45:44 +0000
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
Diffstat:
6 files changed, 41 insertions(+), 7 deletions(-)
diff --git 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
@@ -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
@@ -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(<<EOM)
+Broken source report
+--------------------
+
+The following message sources reported errors. Until these errors are
+corrected, messages from these sources cannot be viewed, and new messages
+will not be detected.
+
+#{broken_sources.map { |s| "Source: " + s.to_s + "\n Error: " + s.broken_msg.wrap(70).join("\n ") }.join('\n\n')}
+EOM
+ end
+ end
+
+ module_function :register_yaml, :save_yaml_obj, :load_yaml_obj, :start, :finish, :report_broken_sources
end
## set up default configuration file
diff --git a/lib/sup/mbox/loader.rb b/lib/sup/mbox/loader.rb
@@ -22,6 +22,10 @@ class Loader < Source
else
@f = uri_or_fp
end
+
+ if cur_offset > 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
@@ -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
@@ -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