sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 06cae7934249af941b7c0825b2f4773cbea3cd26
parent 68bf6a277c5fdefb3b9d6a4b5d4dfbce3f9f9ccf
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Sat, 26 Sep 2009 06:32:21 -0700

bugfix: parse list-(un)subscribe headers correctly

Also, if no subject is specified, just use "subscribe" or "unsubscribe"
instead of forcing the user to come up with something.

Diffstat:
M lib/sup/modes/thread-view-mode.rb | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
@@ -175,8 +175,8 @@ EOS
 
   def subscribe_to_list
     m = @message_lines[curpos] or return
-    if m.list_subscribe && m.list_subscribe =~ /<mailto:(.*?)\?(subject=(.*?))>/
-      ComposeMode.spawn_nicely :from => AccountManager.account_for(m.recipient_email), :to => [Person.from_address($1)], :subj => $3
+    if m.list_subscribe && m.list_subscribe =~ /<mailto:(.*?)(\?subject=(.*?))?>/
+      ComposeMode.spawn_nicely :from => AccountManager.account_for(m.recipient_email), :to => [Person.from_address($1)], :subj => ($3 || "subscribe")
     else
       BufferManager.flash "Can't find List-Subscribe header for this message."
     end
@@ -184,8 +184,8 @@ EOS
 
   def unsubscribe_from_list
     m = @message_lines[curpos] or return
-    if m.list_unsubscribe && m.list_unsubscribe =~ /<mailto:(.*?)\?(subject=(.*?))>/
-      ComposeMode.spawn_nicely :from => AccountManager.account_for(m.recipient_email), :to => [Person.from_address($1)], :subj => $3
+    if m.list_unsubscribe && m.list_unsubscribe =~ /<mailto:(.*?)(\?subject=(.*?))?>/
+      ComposeMode.spawn_nicely :from => AccountManager.account_for(m.recipient_email), :to => [Person.from_address($1)], :subj => ($3 || "unsubscribe")
     else
       BufferManager.flash "Can't find List-Unsubscribe header for this message."
     end