summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2020-04-07 14:23:24 +0200
committerRicardo Wurmus <rekado@elephly.net>2020-04-07 14:23:24 +0200
commit7e1fd9665cc95ecf5b19aff6c41c0d3f6ce72cbf (patch)
tree508047028e0db248fbdc7d210895b5e7efd40015
parent4058f6e7027c3c0e8471badd6acf917999363702 (diff)
messages: patch-messages: Use mbox file.
-rw-r--r--mumi/messages.scm23
1 files changed, 9 insertions, 14 deletions
diff --git a/mumi/messages.scm b/mumi/messages.scm
index 58a3335..4e8920f 100644
--- a/mumi/messages.scm
+++ b/mumi/messages.scm
@@ -249,20 +249,15 @@ the difference by providing the current file size as an offset."
(define-public (patch-messages bug-id)
"Return list of messages relating to the bug BUG-ID. Cache the
result for a while."
- (let ((key (list 'patch-messages bug-id)))
- (or (cached? key)
- (cache! key
- (map (lambda (msg)
- (with-input-from-file (mu:path msg)
- (lambda ()
- (match (mbox->emails (current-input-port))
- ((email) (parse-email email))
- (_ #f)))))
- (sort
- (mu:message-list (format #f "bugid:~a" bug-id))
- (lambda (a b)
- (< (mu:date a)
- (mu:date b)))))))))
+ (define mbox (bug-id->mbox-file bug-id))
+ (if (file-exists? mbox)
+ (let ((key (list 'patch-messages bug-id)))
+ (or (cached? key)
+ (cache! key
+ (call-with-input-file mbox
+ (lambda (port)
+ (map parse-email (mbox->emails port)))))))
+ '()))
(define* (search-bugs query #:key (sets '()) (max 400))
"Return a list of all bugs matching the given QUERY string.