summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mumi/messages.scm22
1 files changed, 18 insertions, 4 deletions
diff --git a/mumi/messages.scm b/mumi/messages.scm
index 34ab02f..d35b1aa 100644
--- a/mumi/messages.scm
+++ b/mumi/messages.scm
@@ -173,10 +173,24 @@ target file."
(get-bytevector-all port))))))
file-name)))))))
-(define-public (patch-messages id)
- "Return list of messages relating to the bug ID."
- ;; TODO: sort by date necessary?
- (soap-invoke* (%config 'debbugs) get-bug-log id))
+;; We would like to use get-bug-log here, but it often returns
+;; truncated messages. This is a known bug upstream.
+(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
+ (match
+ (soap-invoke* (%config 'debbugs) get-bug-message-numbers bug-id)
+ ((msg-nums . _)
+ (map (lambda (msg-num)
+ (with-input-from-file (download-message bug-id msg-num)
+ (lambda ()
+ (match (mbox->emails (current-input-port))
+ ((email) (parse-email email))
+ (_ #f)))))
+ msg-nums)))))))
(define* (search-bugs query #:key (attributes '()) (max 100))
"Return a list of all bugs matching the given QUERY string."