]> git.cworth.org Git - sup/commitdiff
notify user of source errors on startup and on poll
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sun, 25 Mar 2007 18:45:44 +0000 (18:45 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sun, 25 Mar 2007 18:45:44 +0000 (18:45 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@352 5c8cc53c-5e98-4d25-b20a-d8db53a31250

bin/sup
doc/TODO
lib/sup.rb
lib/sup/mbox/loader.rb
lib/sup/poll.rb
lib/sup/source.rb

diff --git a/bin/sup b/bin/sup
index fac2f3bb65b860e95a00f6d5784129c15888ac6d..b2c16dc163a93c22557d1d882662d46938ab72ed 100644 (file)
--- 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
index f924b9043dd288c3e32441cf36ae6a7b1bfc81ce..7a78fb0dd52d599547e5d6a47a59dc19bad19e42 100644 (file)
--- 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
index 76b435dfe9623e78d86b7ea4c593530ee734066a..f9021baf9b9e63459a640e851765ffbc8e737311 100644 (file)
@@ -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
index 1d53a8b0405575619a6068ffcb94f3bc08cc1fdb..538d09d4ed1358a2fdf6c92cf7a775eddf9b61cb 100644 (file)
@@ -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
index 4d1f1efa4a55805f49e9850cc422e65baa217e0d..e85b019238407609fc2a145aa48ce6a144921d97 100644 (file)
@@ -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
index d3f96e179126a2a1e6f988bee5492e0b1e0dfe63..be01780ee8bb61ffec6894ce6ff18cbc18072235 100644 (file)
@@ -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