sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit fd02b8500203c3787e1651c49b69b7f9f39ac099
parent a17f15d4f69004f566beda66527476e4e097e874
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Wed, 25 Mar 2009 08:49:56 -0700

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.

Diffstat:
M lib/sup/index.rb | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git 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(" ")),
     }