sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 7ff103d50a6fb5b3d1e3f9e05ebf1d8f3e080043
parent 617bcfe12e8c98a9b924f656215383d4d5ecb743
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Wed, 26 Mar 2008 09:38:34 -0700

handle carriage returns in mbox files

Diffstat:
M lib/sup/mbox.rb | 5 +++--
M lib/sup/mbox/loader.rb | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/sup/mbox.rb b/lib/sup/mbox.rb
@@ -41,8 +41,8 @@ module MBox
         /^(X-Original-To):\s+(.*)$/i,
         /^(Envelope-To):\s+(.*)$/i: header[last = $1] ||= $2
 
-      when /^$/: break
-      when /^\S+: /: last = nil # some other header we don't care about
+      when /^\r*$/: break
+      when /^\S+:/: last = nil # some other header we don't care about
       else
         header[last] += " " + line.chomp.gsub(/^\s+/, "") if last
       end
@@ -65,6 +65,7 @@ module MBox
     header
   end
   
+  ## never actually called
   def read_body f
     body = []
     f.each_line do |l|
diff --git a/lib/sup/mbox/loader.rb b/lib/sup/mbox/loader.rb
@@ -85,7 +85,7 @@ class Loader < Source
     ret = ""
     @mutex.synchronize do
       @f.seek offset
-      until @f.eof? || (l = @f.gets) =~ /^$/
+      until @f.eof? || (l = @f.gets) =~ /^\r*$/
         ret += l
       end
     end