sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 17b8b9e9641017fad55ba687eb4e58404d2cb00c
parent 1f4e55791d0bac4b2bceb8d586c72e2ba161d624
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date:   Sun, 11 Feb 2007 21:04:48 +0000

made pct_done optional

git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@320 5c8cc53c-5e98-4d25-b20a-d8db53a31250

Diffstat:
M bin/sup-import | 10 +++++-----
M doc/TODO | 6 +++---
M lib/sup/mbox/loader.rb | 1 -
M lib/sup/source.rb | 1 -
4 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/bin/sup-import b/bin/sup-import
@@ -76,7 +76,7 @@ if opts[:rebuild] || opts[:full_rebuild]
   end
 end
 
-start = Time.now
+last_update = start = Time.now
 found = {}
 begin
   sources.each do |source|
@@ -93,10 +93,10 @@ begin
         m.labels -= [:unread] if opts[:read]
       end
 
-      num = num_added + num_updated
-      if num % 1000 == 0 && num > 0
-        elapsed = Time.now - start
-        pctdone = source.pct_done
+      if Time.now - last_update > 60
+        last_update = Time.now
+        elapsed = last_update - start
+        pctdone = source.respond_to?(:pct_done) ? source.pct_done : 100.0 * (source.cur_offset.to_f - source.start_offset).to_f / (source.end_offset - source.start_offset).to_f
         remaining = (100.0 - pctdone) * (elapsed.to_f / pctdone)
         puts "## #{num} (#{pctdone}% done) read; #{elapsed.to_time_s} elapsed; est. #{remaining.to_time_s} remaining"
       end
diff --git a/doc/TODO b/doc/TODO
@@ -1,16 +1,14 @@
 for next release
 ----------------
-don't quit while writing thread index state to disk or with unsaved drafts/messages
 make 'a' archive in thread-view-mode
 message attachments
 warnings: top-posting, attachments
-de-archived messages should be auto-added to inbox
 maildir
 undo
-remove stupid percent_done source methods
 
 future
 ------
+maybe: de-archived messages should be auto-added to inbox
 swappable keymappings
 bugfix: when returning from a shelling out, ncurses is crazy 
 bugfix: miscellaneous weirdnesses in buffer line editing
@@ -34,6 +32,8 @@ toggle wrapping
 
 done
 ----
+x remove stupid percent_done source methods (still useful; made it optional)
+x don't quit while writing thread index state to disk or with unsaved drafts/messages
 x bugfix: deleted threads are showing up (i don't see this any more)
 x bugfix: changing IMAP ids
 x bugfix: STILL new messages, drafts sometimes not showing up in inbox
diff --git a/lib/sup/mbox/loader.rb b/lib/sup/mbox/loader.rb
@@ -29,7 +29,6 @@ class Loader < Source
 
   def start_offset; 0; end
   def end_offset; File.size @f; end
-  def pct_done; 100.0 * cur_offset.to_f / end_offset.to_f; end
 
   def load_header offset
     header = nil
diff --git a/lib/sup/source.rb b/lib/sup/source.rb
@@ -26,7 +26,6 @@ class Source
   ##
   ## - start_offset
   ## - end_offset (exclusive!)
-  ## - pct_done (percent of the way cur_offset is to end_offset)
   ## - load_header offset
   ## - load_message offset
   ## - raw_header offset