summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2020-05-07 14:50:53 +0200
committerRicardo Wurmus <rekado@elephly.net>2020-05-07 14:50:53 +0200
commit3242c0bdeda45c11a2d8b6505c40ce987e7d9ff2 (patch)
tree270b872ecd58c6932b3926dfa958e8c91a8a22ba
parentcec9c873fa7265de8478a9d34cf38123ac760b3d (diff)
Revert "debbugs: Simplify mbox processing."
This reverts commit e0dc3c668ff23c2a5abd580ef9cee5d6414123cc.
-rw-r--r--mumi/debbugs.scm19
1 files changed, 13 insertions, 6 deletions
diff --git a/mumi/debbugs.scm b/mumi/debbugs.scm
index c08a7bd..7873c86 100644
--- a/mumi/debbugs.scm
+++ b/mumi/debbugs.scm
@@ -76,16 +76,23 @@ ends with ^C.
(#\etx
(let ((mails*
(if (member type keep)
- (let* ((contents (string-join (drop (reverse lines) 1) "\n"))
+ ;; TODO: This is very ugly. The first few
+ ;; lines of the raw messages stored in Debbugs
+ ;; logs seem to confuse the email parser, so we
+ ;; try to strip them off.
+ (let* ((content (string-join
+ (drop-while (lambda (line)
+ (or (string-prefix? "From " line)
+ (string-prefix? "Received" line)
+ (string-prefix? "\t" line)
+ (string-prefix? " " line)))
+ (reverse lines)) "\n"))
(mail (catch #t
(lambda ()
- (parse-email
- (and=> (call-with-input-string contents mbox->emails)
- first)))
+ (parse-email content))
(lambda args
(format (current-error-port)
- "failed to process email~% ~a~%"
- args)
+ "failed to process email~%")
#f))))
(let ((id (and mail (assoc-ref (email-headers mail) 'message-id))))
(if (and id (not (hash-ref msgids id)))