]> git.cworth.org Git - sup/blobdiff - lib/sup/mbox.rb
Merge branch 'master' into next
[sup] / lib / sup / mbox.rb
index 53b4e8ce65cdd67f836154feeb59bde8202679a2..e1e3a4d1aed75c0a3d190cdc9ce8257ff46a56e4 100644 (file)
@@ -1,11 +1,24 @@
 require "sup/mbox/loader"
 require "sup/mbox/ssh-file"
 require "sup/mbox/ssh-loader"
-require "sup/rfc2047"
 
 module Redwood
 
 module MBox
-  BREAK_RE = /^From \S+@\S+ /
+  BREAK_RE = /^From \S+ (.+)$/
+
+  def is_break_line? l
+    l =~ BREAK_RE or return false
+    time = $1
+    begin
+      ## hack -- make Time.parse fail when trying to substitute values from Time.now
+      Time.parse time, 0
+      true
+    rescue NoMethodError
+      Redwood::log "found invalid date in potential mbox split line, not splitting: #{l.inspect}"
+      false
+    end
+  end
+  module_function :is_break_line?
 end
 end