sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 293b219cfd472dfcc36a1561ecebcc95f53b7e7c
parent 3d0044b953b80472debba48d41eaed9810c1d49e
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Sat, 26 Dec 2009 09:55:24 -0800

fix list-post header munging

Improve list-post parsing, which apparently has to real format and you
have to screw around to find if there's an email address. E.g. Google
Groups puts a URL and a mailto: in there.

Diffstat:
M lib/sup/message.rb | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
@@ -114,12 +114,14 @@ class Message
     @replytos = (header["in-reply-to"] || "").scan(/<(.+?)>/).map { |x| sanitize_message_id x.first }
 
     @replyto = Person.from_address header["reply-to"]
-    @list_address =
-      if header["list-post"]
-        @list_address = Person.from_address header["list-post"].gsub(/^<mailto:|>$/, "")
-      else
-        nil
+    @list_address = if header["list-post"]
+      address = if header["list-post"] =~ /mailto:(.*?)[>\s$]/
+        $1
+      elsif list-post =~ /@/
+        header["list-post"] # just try the whole fucking thing
       end
+      address && Person.from_address(address)
+    end
 
     @recipient_email = header["envelope-to"] || header["x-original-to"] || header["delivered-to"]
     @source_marked_read = header["status"] == "RO"