]> git.cworth.org Git - sup/blobdiff - lib/sup/mbox.rb
Merge branch 'hook-local-vars' into next
[sup] / lib / sup / mbox.rb
index 53b4e8ce65cdd67f836154feeb59bde8202679a2..3f3abadefeb6f3833970abf027e6e8f77ce7dd45 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
+      warn "found invalid date in potential mbox split line, not splitting: #{l.inspect}"
+      false
+    end
+  end
+  module_function :is_break_line?
 end
 end