]> granicus.if.org Git - neomutt/commitdiff
More IMAP patches from Brendan.
authorThomas Roessler <roessler@does-not-exist.org>
Tue, 20 Feb 2001 19:05:17 +0000 (19:05 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Tue, 20 Feb 2001 19:05:17 +0000 (19:05 +0000)
imap/auth_gss.c
imap/message.c

index 10536aa976aa5ec96961113baa5e985355ed789d..1cc466418bfc8c95906388e878fd8976568c5c00 100644 (file)
@@ -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"));
index 8e7964db636bab22fd886b45e5cc0af5cfddbfc7..d195571796893f11401bde829e54b363a598ef34 100644 (file)
@@ -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))