summaryrefslogtreecommitdiff
path: root/guimb
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-04-01 23:12:33 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2010-04-01 23:15:21 +0300
commit52fffebc9d359125c21130d93a67b225b4778457 (patch)
treeb2645da46b613577b2ce58f1611dc8e6b2341b85 /guimb
parentc73e770c70d3e358e65759130d7fdff047750a69 (diff)
downloadmailutils-52fffebc9d359125c21130d93a67b225b4778457.tar.gz
mailutils-52fffebc9d359125c21130d93a67b225b4778457.tar.bz2
Implement mailbox iterators in Scheme.
* libmu_scm/mu_mailbox.c (struct mu_mailbox)<itr>: New member. (mu_scm_mailbox_free): Destroy the iterator. (mu_scm_mailbox_create0): Initialize itr to NULL. (mu-mailbox-first-message, mu-mailbox-next-message) (mu-mailbox-more-messages?): New function. * guimb/scm/sieve-core.scm (sieve-run): Rewrite main loop in the True Schemish Way.
Diffstat (limited to 'guimb')
-rw-r--r--guimb/scm/sieve-core.scm17
1 files changed, 9 insertions, 8 deletions
diff --git a/guimb/scm/sieve-core.scm b/guimb/scm/sieve-core.scm
index 5a11c65ac..f5f335c7b 100644
--- a/guimb/scm/sieve-core.scm
+++ b/guimb/scm/sieve-core.scm
@@ -472,14 +472,15 @@
(if (not sieve-my-email)
(set! sieve-my-email (mu-username->email)))
; (DEBUG 1 "Mailbox: " sieve-mailbox)
-
- (let ((count (mu-mailbox-messages-count sieve-mailbox)))
- (do ((n 1 (1+ n)))
- ((> n count) #f)
- (set! sieve-current-message
- (mu-mailbox-get-message sieve-mailbox n))
- (sieve-run-current-message thunk))
- (sieve-close-mailboxes)))
+
+ (let msg-loop ((msg (mu-mailbox-first-message sieve-mailbox)))
+ (if (not (eof-object? msg))
+ (begin
+ (set! sieve-current-message msg)
+ (sieve-run-current-message thunk)
+ (msg-loop (mu-mailbox-next-message sieve-mailbox)))))
+
+ (sieve-close-mailboxes))
(define (sieve-command-line)
(catch #t

Return to:

Send suggestions and report system problems to the System administrator.