Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5614:a4e5053fb31a HEAD
Added MAIL_ERROR_EXPUNGED. Set the error whenever expunged message is tried
to be accessed.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 13 May 2007 20:22:38 +0300 |
parents | f717fb4b31c0 |
children | 9dd899f563fe |
files | src/lib-storage/index/cydir/cydir-mail.c src/lib-storage/index/dbox/dbox-mail.c src/lib-storage/index/index-mail.c src/lib-storage/index/maildir/maildir-mail.c src/lib-storage/index/mbox/mbox-mail.c src/lib-storage/mail-error.h src/lib-storage/mail-storage-private.h src/lib-storage/mail.c |
diffstat | 8 files changed, 22 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/cydir/cydir-mail.c Sun May 13 20:10:48 2007 +0300 +++ b/src/lib-storage/index/cydir/cydir-mail.c Sun May 13 20:22:38 2007 +0300 @@ -25,7 +25,7 @@ path = cydir_mail_get_path(mail); if (stat(path, st_r) < 0) { if (errno == ENOENT) - mail->expunged = TRUE; + mail_set_expunged(mail); else { mail_storage_set_critical(mail->box->storage, "stat(%s) failed: %m", path); @@ -104,7 +104,7 @@ fd = open(path, O_RDONLY); if (fd == -1) { if (errno == ENOENT) - _mail->expunged = TRUE; + mail_set_expunged(_mail); else { mail_storage_set_critical(_mail->box->storage, "open(%s) failed: %m", path);
--- a/src/lib-storage/index/dbox/dbox-mail.c Sun May 13 20:10:48 2007 +0300 +++ b/src/lib-storage/index/dbox/dbox-mail.c Sun May 13 20:22:38 2007 +0300 @@ -92,7 +92,7 @@ file_seq_r, offset_r); if (*ret_r <= 0) { if (*ret_r == 0) - mail->mail.mail.expunged = TRUE; + mail_set_expunged(&mail->mail.mail); return TRUE; }
--- a/src/lib-storage/index/index-mail.c Sun May 13 20:10:48 2007 +0300 +++ b/src/lib-storage/index/index-mail.c Sun May 13 20:22:38 2007 +0300 @@ -1022,7 +1022,7 @@ if (seq == 0) { index_mail_reset(mail); mail->mail.mail.uid = uid; - mail->mail.mail.expunged = TRUE; + mail_set_expunged(&mail->mail.mail); return 0; }
--- a/src/lib-storage/index/maildir/maildir-mail.c Sun May 13 20:10:48 2007 +0300 +++ b/src/lib-storage/index/maildir/maildir-mail.c Sun May 13 20:22:38 2007 +0300 @@ -156,7 +156,7 @@ fname = maildir_uidlist_lookup(mbox->uidlist, _mail->uid, &flags); if (fname == NULL) { - _mail->expunged = TRUE; + mail_set_expunged(_mail); return (uoff_t)-1; } } else { @@ -190,7 +190,7 @@ fname = maildir_uidlist_lookup(mbox->uidlist, _mail->uid, &flags); if (fname == NULL) { - _mail->expunged = TRUE; + mail_set_expunged(_mail); return NULL; } } else { @@ -224,7 +224,7 @@ fname = maildir_uidlist_lookup(mbox->uidlist, _mail->uid, &flags); if (fname == NULL) { - _mail->expunged = TRUE; + mail_set_expunged(_mail); return (uoff_t)-1; } path = NULL; @@ -267,7 +267,8 @@ if (data->stream == NULL) { data->stream = maildir_open_mail(mbox, _mail, &deleted); if (data->stream == NULL) { - _mail->expunged = deleted; + if (deleted) + mail_set_expunged(_mail); return NULL; } }
--- a/src/lib-storage/index/mbox/mbox-mail.c Sun May 13 20:10:48 2007 +0300 +++ b/src/lib-storage/index/mbox/mbox-mail.c Sun May 13 20:22:38 2007 +0300 @@ -75,7 +75,7 @@ } if (ret < 0) { if (deleted) - mail->mail.mail.expunged = TRUE; + mail_set_expunged(&mail->mail.mail); return -1; }
--- a/src/lib-storage/mail-error.h Sun May 13 20:10:48 2007 +0300 +++ b/src/lib-storage/mail-error.h Sun May 13 20:22:38 2007 +0300 @@ -27,7 +27,9 @@ /* Out of disk space or quota */ MAIL_ERROR_NOSPACE, /* Item (eg. mailbox) doesn't exist or it's not visible to us */ - MAIL_ERROR_NOTFOUND + MAIL_ERROR_NOTFOUND, + /* Tried to access an expunged message */ + MAIL_ERROR_EXPUNGED }; /* Convert errno to mail_error and an error string. Returns TRUE if successful,
--- a/src/lib-storage/mail-storage-private.h Sun May 13 20:10:48 2007 +0300 +++ b/src/lib-storage/mail-storage-private.h Sun May 13 20:22:38 2007 +0300 @@ -293,6 +293,8 @@ void mail_storage_set_internal_error(struct mail_storage *storage); bool mail_storage_set_error_from_errno(struct mail_storage *storage); +void mail_set_expunged(struct mail *mail); + enum mailbox_list_flags mail_storage_get_list_flags(enum mail_storage_flags storage_flags);
--- a/src/lib-storage/mail.c Sun May 13 20:10:48 2007 +0300 +++ b/src/lib-storage/mail.c Sun May 13 20:22:38 2007 +0300 @@ -150,3 +150,10 @@ return p->v.expunge(mail); } + +void mail_set_expunged(struct mail *mail) +{ + mail_storage_set_error(mail->box->storage, MAIL_ERROR_EXPUNGED, + "Message was expunged"); + mail->expunged = TRUE; +}