dovecot-2.0: mail_update_flags(): Allow removing recent flag fro...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Aug 6 03:30:50 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/b7af600f0c62
changeset: 9727:b7af600f0c62
user: Timo Sirainen <tss at iki.fi>
date: Wed Aug 05 20:14:05 2009 -0400
description:
mail_update_flags(): Allow removing recent flag from message.
diffstat:
1 file changed, 17 insertions(+)
src/lib-storage/index/index-mail.c | 17 +++++++++++++++++
diffs (31 lines):
diff -r dd4c5e43c55a -r b7af600f0c62 src/lib-storage/index/index-mail.c
--- a/src/lib-storage/index/index-mail.c Wed Aug 05 20:09:24 2009 -0400
+++ b/src/lib-storage/index/index-mail.c Wed Aug 05 20:14:05 2009 -0400
@@ -1402,10 +1402,27 @@ void index_mail_cache_parse_deinit(struc
(void)index_mail_parse_body_finish(mail, 0);
}
+static void index_mail_drop_recent_flag(struct index_mail *imail)
+{
+ const struct mail_index_header *hdr;
+ uint32_t first_recent_uid = imail->mail.mail.uid + 1;
+
+ hdr = mail_index_get_header(imail->trans->trans_view);
+ if (hdr->first_recent_uid < first_recent_uid) {
+ mail_index_update_header(imail->trans->trans,
+ offsetof(struct mail_index_header, first_recent_uid),
+ &first_recent_uid, sizeof(first_recent_uid), FALSE);
+ }
+}
+
void index_mail_update_flags(struct mail *mail, enum modify_type modify_type,
enum mail_flags flags)
{
struct index_mail *imail = (struct index_mail *)mail;
+
+ if ((flags & MAIL_RECENT) == 0 &&
+ index_mailbox_is_recent(imail->ibox, mail->uid))
+ index_mail_drop_recent_flag(imail);
flags &= MAIL_FLAGS_NONRECENT | MAIL_INDEX_MAIL_FLAG_BACKEND;
mail_index_update_flags(imail->trans->trans, mail->seq, modify_type,
More information about the dovecot-cvs
mailing list