]> git.notmuchmail.org Git - sup/commitdiff
Read in X-Foo headers
authorDecklin Foster <decklin@red-bean.com>
Sun, 26 Oct 2008 18:30:03 +0000 (14:30 -0400)
committerDecklin Foster <decklin@red-bean.com>
Sun, 26 Oct 2008 18:30:03 +0000 (14:30 -0400)
lib/sup/mbox.rb

index 49489541a0b3ea9be3a46883c472951ce589191e..89b00edef8acf2d8028e4accf66a5031544efb8c 100644 (file)
@@ -21,6 +21,11 @@ module MBox
     ## when scanning over large mbox files.
     while(line = f.gets)
       case line
+      ## these three can occur multiple times, and we want the first one
+      when /^(Delivered-To):#{HEADER_RE}$/i,
+        /^(X-Original-To):#{HEADER_RE}$/i,
+        /^(Envelope-To):#{HEADER_RE}$/i: header[last = $1] ||= $2
+
       when /^(From):#{HEADER_RE}$/i,
         /^(To):#{HEADER_RE}$/i,
         /^(Cc):#{HEADER_RE}$/i,
@@ -33,15 +38,10 @@ module MBox
         /^(List-Post):#{HEADER_RE}$/i,
         /^(List-Subscribe):#{HEADER_RE}$/i,
         /^(List-Unsubscribe):#{HEADER_RE}$/i,
-        /^(Status):#{HEADER_RE}$/i: header[last = $1] = $2
+        /^(Status):#{HEADER_RE}$/i,
+       /^(X-\S+):#{HEADER_RE}$/: header[last = $1] = $2
       when /^(Message-Id):#{HEADER_RE}$/i: header[mid_field = last = $1] = $2
 
-      ## these next three can occur multiple times, and we want the
-      ## first one
-      when /^(Delivered-To):#{HEADER_RE}$/i,
-        /^(X-Original-To):#{HEADER_RE}$/i,
-        /^(Envelope-To):#{HEADER_RE}$/i: header[last = $1] ||= $2
-
       when /^\r*$/: break
       when /^\S+:/: last = nil # some other header we don't care about
       else