diff --git a/src/sieve-tools/sieve-filter.c b/src/sieve-tools/sieve-filter.c index 1f8bfe244e0e7fa1dae3ea046132f0aee4f6ebbe..9ff26763478aa670c80156165e28fff74f14ddc1 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); }