]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Use mail->saving, not mail->uid==0 to check if mail is being saved.
authorTimo Sirainen <tss@iki.fi>
Mon, 28 Jun 2010 20:34:45 +0000 (21:34 +0100)
committerTimo Sirainen <tss@iki.fi>
Mon, 28 Jun 2010 20:34:45 +0000 (21:34 +0100)
The uid may be non-zero when saving with dsync.

--HG--
branch : HEAD

src/lib-storage/index/index-mail.c
src/lib-storage/index/maildir/maildir-mail.c
src/plugins/zlib/zlib-plugin.c

index e33b1bc08120ae844e13be0bbe5e40841236e81f..24de5bb1eb5d1455df2b90bb1d22874fc06e24f0 100644 (file)
@@ -1320,7 +1320,7 @@ void index_mail_set_seq(struct mail *_mail, uint32_t seq)
                /* open the stream only if we didn't get here from
                   mailbox_save_init() */
                hdr = mail_index_get_header(_mail->box->view);
-               if (_mail->uid != 0 && _mail->uid < hdr->next_uid)
+               if (!_mail->saving && _mail->uid < hdr->next_uid)
                        (void)mail_get_stream(_mail, NULL, NULL, &input);
        }
 }
index 97098e9d2eae73e058699dc84af3cdbc6ec66d26..faf6b09f0e1e7447602f89c0e0bfa0460c351fd9 100644 (file)
@@ -118,7 +118,7 @@ static int maildir_mail_stat(struct mail *mail, struct stat *st)
                if (stp == NULL)
                        return -1;
                *st = *stp;
-       } else if (mail->uid != 0) {
+       } else if (!mail->saving) {
                imail->mail.stats_stat_lookup_count++;
                ret = maildir_file_do(mbox, mail->uid, do_stat, st);
                if (ret <= 0) {
@@ -274,7 +274,7 @@ static int maildir_quick_size_lookup(struct index_mail *mail, bool vsize,
        enum maildir_uidlist_rec_ext_key key;
        const char *path, *fname, *value;
 
-       if (_mail->uid != 0) {
+       if (!_mail->saving) {
                if (maildir_mail_get_fname(mbox, _mail, &fname) <= 0)
                        return -1;
        } else {
@@ -292,7 +292,7 @@ static int maildir_quick_size_lookup(struct index_mail *mail, bool vsize,
                return 1;
 
        /* size can be included in uidlist entry */
-       if (_mail->uid != 0) {
+       if (!_mail->saving) {
                key = vsize ? MAILDIR_UIDLIST_REC_EXT_VSIZE :
                        MAILDIR_UIDLIST_REC_EXT_PSIZE;
                value = maildir_uidlist_lookup_ext(mbox->uidlist, _mail->uid,
@@ -411,7 +411,7 @@ static int maildir_mail_get_physical_size(struct mail *_mail, uoff_t *size_r)
                return 0;
        }
 
-       if (_mail->uid != 0) {
+       if (!_mail->saving) {
                ret = maildir_file_do(mbox, _mail->uid, do_stat, &st);
                if (ret <= 0) {
                        if (ret == 0)
@@ -450,7 +450,7 @@ maildir_mail_get_special(struct mail *_mail, enum mail_fetch_field field,
                        *value_r = mail->data.guid;
                        return 0;
                }
-               if (_mail->uid != 0) {
+               if (!_mail->saving) {
                        if (maildir_mail_get_fname(mbox, _mail, &fname) <= 0)
                                return -1;
                } else {
index af80dc44acd59ddb10823023edcaea6d25686263..5cd2a48fe5f33009e2b7ea925b8e26f044705855 100644 (file)
@@ -143,7 +143,7 @@ static int zlib_permail_get_stream(struct mail *_mail,
           in such situation we're probably checking if the user-given input
           looks compressed */
        if (imail->data.stream != NULL ||
-           (_mail->uid == 0 && zuser->save_handler == NULL)) {
+           (_mail->saving && zuser->save_handler == NULL)) {
                return zmail->super.get_stream(_mail, hdr_size, body_size,
                                               stream_r);
        }