From: Thomas Roessler Date: Tue, 20 Feb 2001 19:05:17 +0000 (+0000) Subject: More IMAP patches from Brendan. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=11b4c87331d75a963800ac3bd91755506976d919;p=neomutt More IMAP patches from Brendan. --- diff --git a/imap/auth_gss.c b/imap/auth_gss.c index 10536aa97..1cc466418 100644 --- a/imap/auth_gss.c +++ b/imap/auth_gss.c @@ -152,7 +152,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA* idata) goto bail; } - request_buf.length = mutt_from_base64 (buf2, idata->buf + 2); + request_buf.length = mutt_from_base64 (buf2, idata->cmd.buf + 2); request_buf.value = buf2; sec_token = &request_buf; } @@ -171,7 +171,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA* idata) dprint (1, (debugfile, "Error receiving server response.\n")); goto bail; } - request_buf.length = mutt_from_base64 (buf2, idata->buf + 2); + request_buf.length = mutt_from_base64 (buf2, idata->cmd.buf + 2); request_buf.value = buf2; maj_stat = gss_unwrap (&min_stat, context, &request_buf, &send_token, @@ -239,7 +239,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA* idata) mutt_socket_write(idata->conn, "*\r\n"); goto bail; } - if (imap_code (idata->buf)) + if (imap_code (idata->cmd.buf)) { /* flush the security context */ dprint (2, (debugfile, "Releasing GSS credentials\n")); diff --git a/imap/message.c b/imap/message.c index 8e7964db6..d19557179 100644 --- a/imap/message.c +++ b/imap/message.c @@ -204,10 +204,11 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno) int uid; int cacheno; IMAP_CACHE *cache; + int read; + int rc; /* Sam's weird courier server returns an OK response even when FETCH * fails. Thanks Sam. */ short fetched = 0; - int rc; idata = (IMAP_DATA*) ctx->data; @@ -360,6 +361,12 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno) */ h = ctx->hdrs[msgno]; rewind (msg->fp); + /* It may be that the Status header indicates a message is read, but the + * IMAP server doesn't know the message has been \Seen. So we capture + * the server's notion of 'read' and if it differs from the message info + * picked up in mutt_read_rfc822_header, we mark the message (and context + * changed). Another possiblity: ignore Status on IMAP?*/ + read = h->read; /* I hate do this here, since it's so low-level, but I'm not sure where * I can abstract it. Problem: the id and subj hashes lose their keys when * mutt_free_envelope gets called, but keep their spots in the hash. This @@ -376,6 +383,14 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno) if (h->env->real_subj) hash_insert (ctx->subj_hash, h->env->real_subj, h, 1); + /* see above. We want the new status in h->read, so we unset it manually + * and let mutt_set_flag set it correctly, updating context. */ + if (read != h->read) + { + h->read = read; + mutt_set_flag (ctx, h, M_NEW, read); + } + h->lines = 0; fgets (buf, sizeof (buf), msg->fp); while (!feof (msg->fp))