From: Thomas Roessler Date: Wed, 29 Mar 2000 20:03:32 +0000 (+0000) Subject: Fix access to read-only folders via IMAP. X-Git-Tag: mutt-1-1-10-rel~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5ace42ae8963625a26f4a0c13a92a90530ee9e12;p=mutt Fix access to read-only folders via IMAP. --- diff --git a/imap/message.c b/imap/message.c index dc2cf70a..fe15b45e 100644 --- a/imap/message.c +++ b/imap/message.c @@ -358,6 +358,7 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno) { IMAP_HEADER* newh; HEADER* h = ctx->hdrs[msgno]; + unsigned char readonly; newh = msg_new_header (); @@ -371,6 +372,13 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno) * are taken account of the proper way. */ + /* YAUH (yet another ugly hack): temporarily set context to + * read-write even if it's read-only, so *server* updates of + * flags can be processed by mutt_set_flag. ctx->changed must + * be restored afterwards */ + readonly = ctx->readonly; + ctx->readonly = 0; + mutt_set_flag (ctx, h, M_NEW, !(newh->read || newh->old || h->read || h->old)); mutt_set_flag (ctx, h, M_OLD, newh->old); @@ -382,6 +390,8 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno) /* this message is now definitively *not* changed (mutt_set_flag * marks things changed as a side-effect) */ h->changed = 0; + ctx->changed &= ~readonly; + ctx->readonly = readonly; mutt_free_list (&(HEADER_DATA(h)->keywords)); HEADER_DATA(h)->keywords = newh->data->keywords;