sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 1e9b6a42f7a8229fef52aab145c3f4edee418884
parent 927b6bae94fcb2b460d7b8e10d248fb49d92a5aa
Author: Rich Lane <rlane@club.cc.cmu.edu>
Date:   Wed,  3 Nov 2010 14:09:56 -0700

Merge branch 'master' into next

Diffstat:
M bin/sup | 4 +++-
M lib/sup/buffer.rb | 2 +-
M lib/sup/crypto.rb | 2 +-
M lib/sup/modes/edit-message-mode.rb | 2 +-
4 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/bin/sup b/bin/sup
@@ -49,7 +49,7 @@ No variables.
 No return value.
 EOS
 
-Redwood::HookManager.register "shutdown", <<EOS 
+Redwood::HookManager.register "shutdown", <<EOS
 Executes when sup is shutting down. May be run when sup is crashing,
 so don\'t do anything too important. Run before the label, contacts,
 and people are saved.
@@ -299,6 +299,8 @@ begin
       SearchResultsMode.spawn_from_query "is:unread"
     when :list_labels
       labels = LabelManager.all_labels.map { |l| LabelManager.string_for l }
+      labels = labels.each { |l| l.force_encoding 'UTF-8' if l.methods.include?(:encoding) }
+
       user_label = bm.ask_with_completions :label, "Show threads with label (enter for listing): ", labels
       unless user_label.nil?
         if user_label.empty?
diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
@@ -454,7 +454,7 @@ EOS
   def ask_with_completions domain, question, completions, default=nil
     ask domain, question, default do |s|
       s.force_encoding 'UTF-8' if s.methods.include?(:encoding)
-      completions.select { |x| x =~ /^#{Regexp::escape s}/i }.map { |x| [x, x] }
+      completions.select { |x| x =~ /^#{Regexp::escape s}/iu }.map { |x| [x, x] }
     end
   end
 
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
@@ -88,7 +88,7 @@ EOS
     control.body = "Version: 1\n"
 
     envelope = RMail::Message.new
-    envelope.header["Content-Type"] = 'multipart/encrypted; protocol="application/pgp-encrypted"'
+    envelope.header["Content-Type"] = 'multipart/encrypted; protocol=application/pgp-encrypted'
 
     envelope.add_part control
     envelope.add_part encrypted_payload
diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb
@@ -218,7 +218,7 @@ protected
   def mime_encode string
     string = [string].pack('M') # basic quoted-printable
     string.gsub!(/=\n/,'')      # .. remove trailing newline
-    string.gsub!(/_/,'=96')     # .. encode underscores
+    string.gsub!(/_/,'=5F')     # .. encode underscores
     string.gsub!(/\?/,'=3F')    # .. encode question marks
     string.gsub!(/ /,'_')       # .. translate space to underscores
     "=?utf-8?q?#{string}?="