From 565eb918704f6cc2c58195f63ac67f749b5e5d30 Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan@rename-it.nl> Date: Sat, 25 Jul 2009 00:39:35 +0200 Subject: [PATCH] Minor changes to the sieve-filter tool. --- src/sieve-tools/sieve-filter.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/sieve-tools/sieve-filter.c b/src/sieve-tools/sieve-filter.c index 1f8bfe244..9ff267634 100644 --- a/src/sieve-tools/sieve-filter.c +++ b/src/sieve-tools/sieve-filter.c @@ -89,17 +89,22 @@ static int filter_mailbox while ( ret > 0 && mailbox_search_next(search_ctx, mail) > 0 ) { const char *subject, *date; uoff_t size = 0; - - if ( mail->expunged ) - continue; + + + if ( mail_get_virtual_size(mail, &size) < 0 ) { + if ( mail->expunged ) + continue; - if ( mail_get_virtual_size(mail, &size) < 0 ) - i_fatal("failed to get size"); - + i_fatal("failed to obtain message size"); + } + (void)mail_get_first_header(mail, "date", &date); (void)mail_get_first_header(mail, "subject", &subject); + + if ( subject == NULL ) subject = ""; + if ( date == NULL ) date = ""; - printf("MAIL: [%s; %"PRIuUOFF_T" bytes] %s\n", date, size, subject); + i_info("filering: [%s; %"PRIuUOFF_T" bytes] %s\n", date, size, subject); ret = filter_message(mail, main_sbin, senv, ehandler, user); } -- GitLab