From 2ede6c90f9df47eb1824a8dee6c7bf691d026121 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Wed, 29 Mar 2000 20:03:32 +0000 Subject: [PATCH] Fix access to read-only folders via IMAP. --- imap/message.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/imap/message.c b/imap/message.c index dc2cf70a5..fe15b45e5 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; -- 2.40.0