mu-scm: add support for thread-id
Code + doc + test
This commit is contained in:
@ -78,13 +78,16 @@
|
|||||||
(test-equal '("439C1136.90504@euler.org" "4399DD94.5070309@euler.org"
|
(test-equal '("439C1136.90504@euler.org" "4399DD94.5070309@euler.org"
|
||||||
"20051209233303.GA13812@gauss.org" "439B41ED.2080402@euler.org"
|
"20051209233303.GA13812@gauss.org" "439B41ED.2080402@euler.org"
|
||||||
"439A1E03.3090604@euler.org" "20051211184308.GB13513@gauss.org")
|
"439A1E03.3090604@euler.org" "20051211184308.GB13513@gauss.org")
|
||||||
(references msg)))
|
(references msg))
|
||||||
|
(test-equal "439C1136.90504@euler.org" (thread-id msg)))
|
||||||
|
|
||||||
(let ((msg (car (mfind "subject:\"gcc include search order\""))))
|
(let ((msg (car (mfind "subject:\"gcc include search order\""))))
|
||||||
(test-equal "gcc include search order" (subject msg))
|
(test-equal "gcc include search order" (subject msg))
|
||||||
(test-equal "klub" (header msg "precedence"))
|
(test-equal "klub" (header msg "precedence"))
|
||||||
(test-equal "gcc-help.gcc.gnu.org" (mailing-list msg))
|
(test-equal "gcc-help.gcc.gnu.org" (mailing-list msg))
|
||||||
(test-equal #f (references msg)))
|
(test-equal #f (references msg))
|
||||||
|
(test-equal "3BE9E6535E3029448670913581E7A1A20D852173@emss35m06.us.lmco.com" (message-id msg))
|
||||||
|
(test-equal "3BE9E6535E3029448670913581E7A1A20D852173@emss35m06.us.lmco.com" (thread-id msg)))
|
||||||
(test-end "test-message-more"))
|
(test-end "test-message-more"))
|
||||||
|
|
||||||
(define (test-options)
|
(define (test-options)
|
||||||
|
|||||||
@ -41,6 +41,8 @@
|
|||||||
subject
|
subject
|
||||||
|
|
||||||
references
|
references
|
||||||
|
thread-id
|
||||||
|
|
||||||
mailing-list
|
mailing-list
|
||||||
|
|
||||||
language
|
language
|
||||||
@ -223,6 +225,15 @@ fake-message-id (see impls) are filtered out. If there are no references, return
|
|||||||
#f."
|
#f."
|
||||||
(find-field message ':references))
|
(find-field message ':references))
|
||||||
|
|
||||||
|
(define-method (thread-id (message <message>))
|
||||||
|
"Get the oldest (first) reference for MESSAGE, or message-id if there are none.
|
||||||
|
If neither are available, return #f.
|
||||||
|
This is method is useful to determine the thread a message is in."
|
||||||
|
(let ((refs (references message)))
|
||||||
|
(if (and refs (not (null? refs)))
|
||||||
|
(car refs)
|
||||||
|
(message-id message))))
|
||||||
|
|
||||||
(define-method (mailing-list (message <message>))
|
(define-method (mailing-list (message <message>))
|
||||||
"Get the mailing-list id for MESSAGE or #f if not available."
|
"Get the mailing-list id for MESSAGE or #f if not available."
|
||||||
(find-field message ':list))
|
(find-field message ':list))
|
||||||
|
|||||||
@ -638,6 +638,24 @@ For example:
|
|||||||
439A1E03.3090604@@euler.org" "20051211184308.GB13513@@gauss.org")
|
439A1E03.3090604@@euler.org" "20051211184308.GB13513@@gauss.org")
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
|
@deffn {Scheme Procedure} thread-id message
|
||||||
|
@end deffn
|
||||||
|
Get the oldest reference for the message or its message-id if there is none.
|
||||||
|
This is useful to identify the thread some message lives in.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
@lisp
|
||||||
|
(thread-id msg)
|
||||||
|
=> "439C1136.90504@@euler.org"
|
||||||
|
@end lisp
|
||||||
|
|
||||||
|
For example:
|
||||||
|
@lisp
|
||||||
|
(references msg)
|
||||||
|
=> ("439C1136.90504@@euler.org" "4399DD94.5070309@@euler.org"
|
||||||
|
"20051209233303.GA13812@@gauss.org" "439B41ED.2080402@@euler.org"
|
||||||
|
439A1E03.3090604@@euler.org" "20051211184308.GB13513@@gauss.org")
|
||||||
|
@end lisp
|
||||||
|
|
||||||
@deffn {Scheme Procedure} mailing-list message
|
@deffn {Scheme Procedure} mailing-list message
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|||||||
Reference in New Issue
Block a user