From fd02b8500203c3787e1651c49b69b7f9f39ac099 Mon Sep 17 00:00:00 2001 From: William Morgan Date: Wed, 25 Mar 2009 08:49:56 -0700 Subject: [PATCH] overwrite from and to fields in index when saving a message See comments in the code. This allows you to forcibly update the from/to address stored in the index for messages, which means you can correct the bad stuff stored in there due to previous versions of Sup that canonicalized email addresses. --- lib/sup/index.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/sup/index.rb b/lib/sup/index.rb index 9addc65..838d601 100644 --- a/lib/sup/index.rb +++ b/lib/sup/index.rb @@ -246,8 +246,17 @@ EOS :snippet => snippet, # always override :label => labels.uniq.join(" "), :attachments => (entry[:attachments] || m.attachments.uniq.join(" ")), - :from => (entry[:from] || (m.from ? m.from.indexable_content : "")), - :to => (entry[:to] || (m.to + m.cc + m.bcc).map { |x| x.indexable_content }.join(" ")), + + ## always override :from and :to. + ## older versions of Sup would often store the wrong thing in the index + ## (because they were canonicalizing email addresses, resulting in the + ## wrong name associated with each.) the correct address is read from + ## the original header when these messages are opened in thread-view-mode, + ## so this allows people to forcibly update the address in the index by + ## marking those threads for saving. + :from => (m.from ? m.from.indexable_content : ""), + :to => (m.to + m.cc + m.bcc).map { |x| x.indexable_content }.join(" "), + :subject => (entry[:subject] || wrap_subj(Message.normalize_subj(m.subj))), :refs => (entry[:refs] || (m.refs + m.replytos).uniq.join(" ")), } -- 2.45.2