commit 35802a64887e4c5dbd4d92ff908f3f082e5ecfa7
parent 9c7f37cb45428ebb176d2253ff06353fbdccf6a4
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date: Wed, 9 May 2007 15:21:54 +0000
header parsing tweaks thanks to paul lambert
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@393 5c8cc53c-5e98-4d25-b20a-d8db53a31250
Diffstat:
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/lib/sup/mbox.rb b/lib/sup/mbox.rb
@@ -16,18 +16,18 @@ module MBox
## when scanning over large mbox files.
while(line = f.gets)
case line
- when /^(From):\s+(.*)\s*$/i,
- /^(To):\s+(.*)\s*$/i,
- /^(Cc):\s+(.*)\s*$/i,
- /^(Bcc):\s+(.*)\s*$/i,
- /^(Subject):\s+(.*)\s*$/i,
- /^(Date):\s+(.*)\s*$/i,
- /^(Message-Id):\s+<(.*)>\s*$/i,
- /^(References):\s+(.*)\s*$/i,
- /^(In-Reply-To):\s+(.*)\s*$/i,
- /^(Reply-To):\s+(.*)\s*$/i,
- /^(List-Post):\s+(.*)\s*$/i,
- /^(Status):\s+(.*)\s*$/i: header[last = $1] = $2
+ when /^(From):\s+(.*?)\s*$/i,
+ /^(To):\s+(.*?)\s*$/i,
+ /^(Cc):\s+(.*?)\s*$/i,
+ /^(Bcc):\s+(.*?)\s*$/i,
+ /^(Subject):\s+(.*?)\s*$/i,
+ /^(Date):\s+(.*?)\s*$/i,
+ /^(Message-Id):\s+<(.*?)>\s*$/i,
+ /^(References):\s+(.*?)\s*$/i,
+ /^(In-Reply-To):\s+(.*?)\s*$/i,
+ /^(Reply-To):\s+(.*?)\s*$/i,
+ /^(List-Post):\s+(.*?)\s*$/i,
+ /^(Status):\s+(.*?)\s*$/i: header[last = $1] = $2
## these next three can occur multiple times, and we want the
## first one
@@ -36,7 +36,7 @@ module MBox
/^(Envelope-To):\s+(.*)$/i: header[last = $1] ||= $2
when /^$/: break
- when /:/: last = nil
+ when /:/: last = nil # some other header we don't care about
else
header[last] += " " + line.chomp.gsub(/^\s+/, "") if last
end