diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 1999-10-20 09:15:03 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 1999-10-20 09:15:03 +0000 |
commit | 40c6f46c60589e197789b5fab68e9e16607870be (patch) | |
tree | 462fb293a640cef44817ddf2c23b47db3d876ddf /imap | |
parent | 7dc8bb8e1e4f24f19fe449b8af53e9e5b2f31cc3 (diff) |
Flags should only be modified using mutt_set_flag(). Everything
else leads to neglected side effects. In this case, index colors,
searches and possibly other side effects were ignored when a message
which resides on an IMAP folder was read.
Diffstat (limited to 'imap')
-rw-r--r-- | imap/message.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/imap/message.c b/imap/message.c index f76fdefa..6498bd74 100644 --- a/imap/message.c +++ b/imap/message.c @@ -332,19 +332,19 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno) if ((pc = msg_parse_flags (newh, pc)) == NULL) return -1; - /* update context sums */ - ctx->new += ((newh->read | newh->old) ? 0 : 1) - - ((h->read | h->old) ? 0 : 1); - ctx->unread += h->read - newh->read; - ctx->deleted += h->deleted = newh->deleted; - ctx->flagged += h->flagged - newh->flagged; - - /* now commit the new flags */ - ctx->hdrs[msgno]->read = newh->read; - ctx->hdrs[msgno]->old = newh->old; - ctx->hdrs[msgno]->deleted = newh->deleted; - ctx->hdrs[msgno]->flagged = newh->flagged; - ctx->hdrs[msgno]->replied = newh->replied; + /* this is less efficient than the code which used to be here, + * but (1) this is only invoked when fetching messages, and (2) + * this way, we can make sure that side effects of flag changes + * are taken account of the proper way. + */ + + mutt_set_flag (ctx, h, M_NEW, + !(newh->read || newh->old || h->read || h->old)); + mutt_set_flag (ctx, h, M_OLD, newh->old); + mutt_set_flag (ctx, h, M_READ, h->read || newh->read); + mutt_set_flag (ctx, h, M_DELETE, h->deleted || newh->deleted); + mutt_set_flag (ctx, h, M_FLAG, h->flagged || newh->flagged); + mutt_set_flag (ctx, h, M_REPLIED, h->replied || newh->replied); mutt_free_list (&(HEADER_DATA(h)->keywords)); HEADER_DATA(h)->keywords = newh->data->keywords; |