From: wmorgan Date: Sun, 31 Dec 2006 14:20:33 +0000 (+0000) Subject: fixed bug in label assignment for new messages and cleaned up logging messages X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=35e74b8516a33594e59f973d0e0858670010aa97;p=sup 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 --- diff --git a/bin/sup b/bin/sup index 5348437..f4fafb9 100644 --- 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 index 3027e19..bbf7e89 100644 --- 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 index ac3082a..e388577 100644 --- 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 index 4002c7d..3de011e 100644 --- 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 index 20ba1bd..d46ce8f 100644 --- 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 index 77209bf..35c087a 100644 --- 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