- else if (h->deleted)
- {
- h->deleted = 0;
- if (upd_ctx)
- {
- ctx->deleted--;
- if (h->appended)
- ctx->appended--;
- }
- h->appended = 0; /* when undeleting, also reset the appended flag */
-#ifdef USE_IMAP
- /* see my comment above */
- if (ctx->magic == M_IMAP)
- {
- h->changed = 1;
- if (upd_ctx) ctx->changed = 1;
- }
-#endif
- /*
- * If the user undeletes a message which is marked as
- * "trash" in the maildir folder on disk, the folder has
- * been changed, and is marked accordingly. However, we do
- * _not_ mark the message itself changed, because trashing
- * is checked in specific code in the maildir folder
- * driver.
- */
- if (ctx->magic == M_MAILDIR && upd_ctx && h->trash)
- ctx->changed = 1;
- }
- break;
-
- case M_APPENDED:
- if (bf)
- {
- if (!h->appended)
- {
- h->appended = 1;
- if (upd_ctx) ctx->appended++;
- }
- }
- break;
-
- case M_PURGED:
- if (bf)
- {
- if (!h->purged)
- h->purged = 1;
- }
- else if (h->purged)
- h->purged = 0;
- break;
-
- case M_NEW:
-
-#ifdef USE_IMAP
- if (ctx && ctx->magic == M_IMAP)
- if (mutt_bit_isset (((IMAP_DATA *)ctx->data)->capabilities, ACL) \
- && !mutt_bit_isset(((IMAP_DATA *)ctx->data)->rights,IMAP_ACL_SEEN))
- return;
-#endif
-
- if (bf)
- {
- if (h->read || h->old)
- {
- h->old = 0;
- if (upd_ctx) ctx->new++;
- if (h->read)
- {
- h->read = 0;
- if (upd_ctx) ctx->unread++;
- }
- h->changed = 1;
- if (upd_ctx) ctx->changed = 1;
- }
- }
- else if (!h->read)
- {
- if (!h->old)
- if (upd_ctx) ctx->new--;
- h->read = 1;
- if (upd_ctx) ctx->unread--;
- h->changed = 1;
- if (upd_ctx) ctx->changed = 1;
- }
- break;
-
- case M_OLD:
-
-#ifdef USE_IMAP
- if (ctx && ctx->magic == M_IMAP)
- if (mutt_bit_isset (((IMAP_DATA *)ctx->data)->capabilities, ACL) \
- && !mutt_bit_isset(((IMAP_DATA *)ctx->data)->rights,IMAP_ACL_SEEN))
- return;
-#endif
-
- if (bf)
- {
- if (!h->old)
- {
- h->old = 1;
- if (!h->read)
- if (upd_ctx) ctx->new--;
- h->changed = 1;
- if (upd_ctx) ctx->changed = 1;
- }
- }
- else if (h->old)
- {
- h->old = 0;
- if (!h->read)
- if (upd_ctx) ctx->new++;
- h->changed = 1;
- if (upd_ctx) ctx->changed = 1;