dovecot: Added MAIL_FETCH_NUL_STATE. Don't try to fetch cached f...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jul 12 03:21:48 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/1a80f37a4a12
changeset: 5949:1a80f37a4a12
user: Timo Sirainen <tss at iki.fi>
date: Thu Jul 12 02:40:14 2007 +0300
description:
Added MAIL_FETCH_NUL_STATE. Don't try to fetch cached flags now unless it's
needed.
diffstat:
3 files changed, 14 insertions(+), 4 deletions(-)
src/imap/imap-fetch.c | 4 ++++
src/lib-storage/index/index-mail.c | 11 +++++++----
src/lib-storage/mail-storage.h | 3 +++
diffs (48 lines):
diff -r a0b3228be6d2 -r 1a80f37a4a12 src/imap/imap-fetch.c
--- a/src/imap/imap-fetch.c Thu Jul 12 02:38:37 2007 +0300
+++ b/src/imap/imap-fetch.c Thu Jul 12 02:40:14 2007 +0300
@@ -175,6 +175,10 @@ void imap_fetch_begin(struct imap_fetch_
mailbox_header_lookup_init(ctx->box, data);
}
+ if ((ctx->fetch_data &
+ (MAIL_FETCH_STREAM_HEADER | MAIL_FETCH_STREAM_BODY)) != 0)
+ ctx->fetch_data |= MAIL_FETCH_NUL_STATE;
+
ctx->trans = mailbox_transaction_begin(ctx->box,
MAILBOX_TRANSACTION_FLAG_HIDE);
ctx->select_counter = ctx->client->select_counter;
diff -r a0b3228be6d2 -r 1a80f37a4a12 src/lib-storage/index/index-mail.c
--- a/src/lib-storage/index/index-mail.c Thu Jul 12 02:38:37 2007 +0300
+++ b/src/lib-storage/index/index-mail.c Thu Jul 12 02:40:14 2007 +0300
@@ -916,10 +916,13 @@ int index_mail_set_seq(struct mail *_mai
data->rec = rec;
data->seq = seq;
- if (!index_mail_get_fixed_field(mail, MAIL_CACHE_FLAGS,
- &data->cache_flags,
- sizeof(data->cache_flags)))
- data->cache_flags = 0;
+ if ((mail->wanted_fields & (MAIL_FETCH_NUL_STATE |
+ MAIL_FETCH_IMAP_BODY |
+ MAIL_FETCH_IMAP_BODYSTRUCTURE)) != 0) {
+ (void)index_mail_get_fixed_field(mail, MAIL_CACHE_FLAGS,
+ &data->cache_flags,
+ sizeof(data->cache_flags));
+ }
/* set public fields */
mail->mail.mail.seq = seq;
diff -r a0b3228be6d2 -r 1a80f37a4a12 src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h Thu Jul 12 02:38:37 2007 +0300
+++ b/src/lib-storage/mail-storage.h Thu Jul 12 02:40:14 2007 +0300
@@ -94,6 +94,9 @@ enum mail_fetch_field {
MAIL_FETCH_PHYSICAL_SIZE = 0x00000080,
MAIL_FETCH_VIRTUAL_SIZE = 0x00000100,
+ /* Set has_nuls / has_no_nuls fields */
+ MAIL_FETCH_NUL_STATE = 0x00000200,
+
/* specials: */
MAIL_FETCH_IMAP_BODY = 0x00001000,
MAIL_FETCH_IMAP_BODYSTRUCTURE = 0x00002000,
More information about the dovecot-cvs
mailing list