commit 5977aecf6bf51a1f7a2bb59d01742dd4ced979ce
parent 9e476599cb48ba830e55d5f5fcd1a13eb137ce14
Author: William Morgan <wmorgan-sup@masanjin.net>
Date: Sat, 2 Feb 2008 15:14:45 -0800
Merge branches 'run-mailcap', 'stop-saving', 'from-additions', 'rfc2047-name-fix' and 'update-fix'
Diffstat:
6 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/bin/sup-sync b/bin/sup-sync
@@ -238,7 +238,7 @@ rescue Exception => e
File.open("sup-exception-log.txt", "w") { |f| f.puts e.backtrace }
raise
ensure
- index.save
+ #index.save # actually, don't want to save!
Redwood::finish
index.unlock
end
diff --git a/lib/sup/index.rb b/lib/sup/index.rb
@@ -183,11 +183,11 @@ EOS
:source_id => source_id,
:source_info => m.source_info,
:date => m.date.to_indexable_s,
- :body => m.content,
+ :body => m.indexable_content,
:snippet => snippet,
:label => m.labels.uniq.join(" "),
- :from => m.from ? m.from.email : "",
- :to => (m.to + m.cc + m.bcc).map { |x| x.email }.join(" "),
+ :from => m.from ? m.from.indexable_content : "",
+ :to => (m.to + m.cc + m.bcc).map { |x| x.indexable_content }.join(" "),
:subject => wrap_subj(m.subj),
:refs => (m.refs + m.replytos).uniq.join(" "),
}
diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
@@ -116,7 +116,9 @@ EOS
def initial_state; :open end
def viewable?; @lines.nil? end
def view_default! path
- system "/usr/bin/run-mailcap --action=view #{@content_type}:#{path} > /dev/null 2> /dev/null"
+ cmd = "/usr/bin/run-mailcap --action=view '#{@content_type}:#{path}' > /dev/null 2> /dev/null"
+ Redwood::log "running: #{cmd.inspect}"
+ system cmd
$? == 0
end
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
@@ -248,13 +248,14 @@ EOS
with_source_errors_handled { @source.each_raw_message_line(@source_info, &b) }
end
- def content
+ ## returns all the content from a message that will be indexed
+ def indexable_content
load_from_source!
[
- from && "#{from.name} #{from.email}",
- to.map { |p| "#{p.name} #{p.email}" },
- cc.map { |p| "#{p.name} #{p.email}" },
- bcc.map { |p| "#{p.name} #{p.email}" },
+ from && from.indexable_content,
+ to.map { |p| p.indexable_content },
+ cc.map { |p| p.indexable_content },
+ bcc.map { |p| p.indexable_content },
chunks.select { |c| c.is_a? Chunk::Text }.map { |c| c.lines },
Message.normalize_subj(subj),
].flatten.compact.join " "
diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
@@ -513,14 +513,12 @@ EOS
protected
def add_or_unhide m
- if @hidden_threads[m]
- @hidden_threads.delete m
- ## now it will re-appear when #update is called
- else
- @ts_mutex.synchronize do
- return unless is_relevant?(m) || @ts.is_relevant?(m)
+ @ts_mutex.synchronize do
+ if (is_relevant?(m) || @ts.is_relevant?(m)) && !@ts.contains?(m)
@ts.load_thread_for_message m
end
+
+ @hidden_threads.delete @ts.thread_for(m)
end
update
diff --git a/lib/sup/person.rb b/lib/sup/person.rb
@@ -21,7 +21,7 @@ class PersonManager
File.open(@fn, "w") do |f|
@@people.each do |email, p|
next if p.email == p.name
- next if p.email =~ /=/ # drop rfc2047-encoded, and lots of other useless emails. definitely a heuristic.
+ next if p.name =~ /=/ # drop rfc2047-encoded, and lots of other useless emails. definitely a heuristic.
f.puts "#{p.email}: #{p.timestamp} #{p.name}"
end
end
@@ -162,6 +162,10 @@ class Person
Person.new name, email
end
+ def indexable_content
+ [name, email, email.split(/@/).first].join(" ")
+ end
+
def eql? o; email.eql? o.email end
def hash; email.hash end
end