Changed sieve-register-.* functions to allow for actions to accept tags.
(sieve-get-opt-arg): New function. Returns the argument to a given tag.
Showing
1 changed file
with
19 additions
and
16 deletions
... | @@ -120,19 +120,22 @@ | ... | @@ -120,19 +120,22 @@ |
120 | ;;; Register standard actions | 120 | ;;; Register standard actions |
121 | (cond | 121 | (cond |
122 | (sieve-parser | 122 | (sieve-parser |
123 | (sieve-register-action "keep" action-keep) | 123 | (sieve-register-action "keep" action-keep '() '()) |
124 | (sieve-register-action "discard" action-discard) | 124 | (sieve-register-action "discard" action-discard '() '()) |
125 | (sieve-register-action "fileinto" action-fileinto 'string))) | 125 | (sieve-register-action "fileinto" action-fileinto (list 'string) '()))) |
126 | 126 | ||
127 | ;;; Some utilities. | 127 | ;;; Some utilities. |
128 | 128 | ||
129 | (define (find-comp opt-args) | 129 | (define (sieve-get-opt-arg opt-args tag default) |
130 | (cond | 130 | (cond |
131 | ((member #:comparator opt-args) => | 131 | ((member tag opt-args) => |
132 | (lambda (x) | 132 | (lambda (x) |
133 | (car (cdr x)))) | 133 | (car (cdr x)))) |
134 | (else | 134 | (else |
135 | string-ci=?))) | 135 | default))) |
136 | |||
137 | (define (find-comp opt-args) | ||
138 | (sieve-get-opt-arg opt-args #:comparator string-ci=?)) | ||
136 | 139 | ||
137 | (define (find-match opt-args) | 140 | (define (find-match opt-args) |
138 | (cond | 141 | (cond |
... | @@ -358,24 +361,24 @@ | ... | @@ -358,24 +361,24 @@ |
358 | (sieve-parser | 361 | (sieve-parser |
359 | (sieve-register-test "address" | 362 | (sieve-register-test "address" |
360 | test-address | 363 | test-address |
361 | (append address-part comparator match-type) | 364 | (list 'string-list 'string-list) |
362 | (list 'string-list 'string-list)) | 365 | (append address-part comparator match-type)) |
363 | (sieve-register-test "size" | 366 | (sieve-register-test "size" |
364 | test-size | 367 | test-size |
365 | size-comp | 368 | (list 'number) |
366 | (list 'number)) | 369 | size-comp) |
367 | (sieve-register-test "envelope" | 370 | (sieve-register-test "envelope" |
368 | test-envelope | 371 | test-envelope |
369 | (append comparator address-part match-type) | 372 | (list 'string-list 'string-list) |
370 | (list 'string-list 'string-list)) | 373 | (append comparator address-part match-type)) |
371 | (sieve-register-test "exists" | 374 | (sieve-register-test "exists" |
372 | test-exists | 375 | test-exists |
373 | '() | 376 | (list 'string-list) |
374 | (list 'string-list)) | 377 | '()) |
375 | (sieve-register-test "header" | 378 | (sieve-register-test "header" |
376 | test-header | 379 | test-header |
377 | (append comparator match-type) | 380 | (list 'string-list 'string-list) |
378 | (list 'string-list 'string-list)) | 381 | (append comparator match-type)) |
379 | (sieve-register-test "false" #f '() '()) | 382 | (sieve-register-test "false" #f '() '()) |
380 | (sieve-register-test "true" #t '() '()))) | 383 | (sieve-register-test "true" #t '() '()))) |
381 | 384 | ... | ... |
-
Please register or sign in to post a comment