sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 35e74b8516a33594e59f973d0e0858670010aa97
parent 6bed8393e5928ec938b9f22be9f12b3d294368f4
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date:   Sun, 31 Dec 2006 14:20:33 +0000

fixed bug in label assignment for new messages and cleaned up logging messages



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

Diffstat:
M bin/sup | 2 --
M bin/sup-import | 2 --
M lib/sup/imap.rb | 2 +-
M lib/sup/index.rb | 5 +++--
M lib/sup/mbox/loader.rb | 2 +-
M lib/sup/util.rb | 4 ++++
6 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/bin/sup b/bin/sup
@@ -54,9 +54,7 @@ end
 module_function :start_cursing, :stop_cursing
 
 Redwood::start
-
 Index.new.load
-log "loaded #{Index.size} messages from index"
 
 if(s = Index.source_for DraftManager.source_name)
   DraftManager.source = s
diff --git a/bin/sup-import b/bin/sup-import
@@ -83,10 +83,8 @@ end
 
 Redwood::start
 
-puts "loading index..."
 index = Redwood::Index.new
 index.load
-puts "loaded index of #{index.size} messages"
 
 h = HighLine.new
 
diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb
@@ -5,7 +5,7 @@ require 'stringio'
 module Redwood
 
 class IMAP < Source
-  attr_reader :labels
+  attr_reader_cloned :labels
   
   def initialize uri, username, password, uid_validity=nil, last_uid=nil, usual=true, archived=false, id=nil
     raise ArgumentError, "username and password must be specified" unless username && password
diff --git a/lib/sup/index.rb b/lib/sup/index.rb
@@ -60,10 +60,11 @@ class Index
 
   def load_index dir=File.join(@dir, "ferret")
     if File.exists? dir
-      Redwood::log "loading index"
+      Redwood::log "loading index..."
       @index = Ferret::Index::Index.new(:path => dir, :analyzer => @analyzer)
+      Redwood::log "loaded index of #{@index.size} messages"
     else
-      Redwood::log "creating index"
+      Redwood::log "creating index..."
       field_infos = Ferret::Index::FieldInfos.new :store => :yes
       field_infos.add_field :message_id
       field_infos.add_field :source_id
diff --git a/lib/sup/mbox/loader.rb b/lib/sup/mbox/loader.rb
@@ -4,7 +4,7 @@ module Redwood
 module MBox
 
 class Loader < Source
-  attr_reader :labels
+  attr_reader_cloned :labels
 
   def initialize uri_or_fp, start_offset=nil, usual=true, archived=false, id=nil
     super
diff --git a/lib/sup/util.rb b/lib/sup/util.rb
@@ -7,6 +7,10 @@ class Module
     bool_reader(*args)
     bool_writer(*args)
   end
+
+  def attr_reader_cloned *args
+    args.each { |sym| class_eval %{ def #{sym}; @#{sym}.clone; end } }
+  end
 end
 
 class Object