Rocco Rutte:
authorpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Wed, 2 Nov 2005 00:05:23 +0000 (00:05 +0000)
committerpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Wed, 2 Nov 2005 00:05:23 +0000 (00:05 +0000)
- merge in latest mutt changes

git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@569 e385b8ad-14ed-0310-8656-cc95a2468c6d

ChangeLog.mutt
VERSION.svn
flags.c
imap/message.c
menu.c
mutt_idna.c

index 3576d16..e9be924 100644 (file)
@@ -1,3 +1,20 @@
+2005-11-01 08:42:00  Thomas Roessler  <roessler@does-not-exist.org>  (roessler)
+
+       * menu.c: This should be a better patch for the menu break
+       dance. (#2019)
+
+2005-10-31 11:56:58  Thomas Glanzmann  <sithglan@stud.uni-erlangen.de>  (roessler)
+
+       * imap/message.c: Fix 2119.
+
+2005-10-31 10:51:54  Thomas Roessler  <roessler@does-not-exist.org>  (roessler)
+
+       * mutt_idna.c: Fix the underlying problem behind mutt/2107.
+
+       * menu.c: Fixing #2019.
+
+       * flags.c: Fix #2123.
+
 2005-10-21 04:35:38  Brendan Cully  <brendan@kublai.com>  (brendan)
 
        * smime.c, attach.c, buffy.c, copy.c, copy.h, crypt-gpgme.c,
 2005-10-21 04:35:38  Brendan Cully  <brendan@kublai.com>  (brendan)
 
        * smime.c, attach.c, buffy.c, copy.c, copy.h, crypt-gpgme.c,
index 5fffd3d..6962904 100644 (file)
@@ -1 +1 @@
-568
+569
diff --git a/flags.c b/flags.c
index b206ae3..fd3333f 100644 (file)
--- a/flags.c
+++ b/flags.c
@@ -29,6 +29,7 @@ void _mutt_set_flag (CONTEXT * ctx, HEADER * h, int flag, int bf, int upd_ctx)
   int changed = h->changed;
   int deleted = ctx->deleted;
   int tagged = ctx->tagged;
   int changed = h->changed;
   int deleted = ctx->deleted;
   int tagged = ctx->tagged;
+  int flagged = ctx->flagged;
 
   if (ctx->readonly && flag != M_TAG)
     return;                     /* don't modify anything if we are read-only */
 
   if (ctx->readonly && flag != M_TAG)
     return;                     /* don't modify anything if we are read-only */
@@ -270,9 +271,8 @@ void _mutt_set_flag (CONTEXT * ctx, HEADER * h, int flag, int bf, int upd_ctx)
    * search results so that any future search will match the current status
    * of this message and not what it was at the time it was last searched.
    */
    * search results so that any future search will match the current status
    * of this message and not what it was at the time it was last searched.
    */
-  if (h->searched
-      && (changed != h->changed || deleted != ctx->deleted
-          || tagged != ctx->tagged))
+  if (h->searched && (changed != h->changed || deleted != ctx->deleted ||
+                      tagged != ctx->tagged || flagged != ctx->flagged))
     h->searched = 0;
   sidebar_draw (0);
 }
     h->searched = 0;
   sidebar_draw (0);
 }
index 64bf434..8423a5c 100644 (file)
@@ -117,78 +117,79 @@ int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend)
   idata->newMailCount = 0;
 
 #if USE_HCACHE
   idata->newMailCount = 0;
 
 #if USE_HCACHE
-  hc = mutt_hcache_open (HeaderCache, ctx->path);
+  if ((hc = mutt_hcache_open (HeaderCache, ctx->path))) {
 
 
-  snprintf (buf, sizeof (buf),
-            "FETCH %d:%d (UID FLAGS)", msgbegin + 1, msgend + 1);
-  fetchlast = msgend + 1;
+    snprintf (buf, sizeof (buf),
+              "FETCH %d:%d (UID FLAGS)", msgbegin + 1, msgend + 1);
+    fetchlast = msgend + 1;
 
 
-  imap_cmd_start (idata, buf);
+    imap_cmd_start (idata, buf);
 
 
-  for (msgno = msgbegin; msgno <= msgend; msgno++) {
-    if (ReadInc && (!msgno || ((msgno + 1) % ReadInc == 0)))
-      mutt_message (_("Evaluating cache... [%d/%d]"), msgno + 1, msgend + 1);
-
-    rewind (fp);
-    memset (&h, 0, sizeof (h));
-    h.data = mem_calloc (1, sizeof (IMAP_HEADER_DATA));
-    do {
-      mfhrc = 0;
+    for (msgno = msgbegin; msgno <= msgend; msgno++) {
+      if (ReadInc && (!msgno || ((msgno + 1) % ReadInc == 0)))
+        mutt_message (_("Evaluating cache... [%d/%d]"), msgno + 1, msgend + 1);
 
 
-      rc = imap_cmd_step (idata);
-      if (rc != IMAP_CMD_CONTINUE)
-        break;
+      rewind (fp);
+      memset (&h, 0, sizeof (h));
+      h.data = mem_calloc (1, sizeof (IMAP_HEADER_DATA));
+      do {
+        mfhrc = 0;
+
+        rc = imap_cmd_step (idata);
+        if (rc != IMAP_CMD_CONTINUE)
+          break;
+
+        if ((mfhrc =
+            msg_fetch_header_fetch (idata->ctx, &h, idata->cmd.buf, fp)) == -1)
+          continue;
+        else if (mfhrc < 0)
+          break;
+
+        /* make sure we don't get remnants from older larger message headers */
+        fputs ("\n\n", fp);
+
+        sprintf (uid_buf, "/%u", h.data->uid);    /* XXX --tg 21:41 04-07-11 */
+        uid_validity =
+          (unsigned long *) mutt_hcache_fetch (hc, uid_buf, &imap_hcache_keylen);
+
+        if (uid_validity != NULL && *uid_validity == idata->uid_validity) {
+          ctx->hdrs[msgno] = mutt_hcache_restore((unsigned char *) uid_validity, 0);
+          ctx->hdrs[msgno]->index = h.sid - 1;
+          if (h.sid != ctx->msgcount + 1)
+            debug_print (1, ("imap_read_headers: msgcount and sequence ID are inconsistent!"));
+          /* messages which have not been expunged are ACTIVE (borrowed from mh 
+          * folders) */
+          ctx->hdrs[msgno]->active = 1;
+          ctx->hdrs[msgno]->read = h.read;
+          ctx->hdrs[msgno]->old = h.old;
+          ctx->hdrs[msgno]->deleted = h.deleted;
+          ctx->hdrs[msgno]->flagged = h.flagged;
+          ctx->hdrs[msgno]->replied = h.replied;
+          ctx->hdrs[msgno]->changed = h.changed;
+          /*  ctx->hdrs[msgno]->received is restored from mutt_hcache_restore */
+          ctx->hdrs[msgno]->data = (void *) (h.data);
+
+          ctx->msgcount++;
+        }
 
 
-      if ((mfhrc =
-           msg_fetch_header_fetch (idata->ctx, &h, idata->cmd.buf, fp)) == -1)
-        continue;
-      else if (mfhrc < 0)
-        break;
+        rewind (fp);
 
 
-      /* make sure we don't get remnants from older larger message headers */
-      fputs ("\n\n", fp);
+        mem_free (&uid_validity);
 
 
-      sprintf (uid_buf, "/%u", h.data->uid);    /* XXX --tg 21:41 04-07-11 */
-      uid_validity =
-        (unsigned long *) mutt_hcache_fetch (hc, uid_buf, &imap_hcache_keylen);
-
-      if (uid_validity != NULL && *uid_validity == idata->uid_validity) {
-        ctx->hdrs[msgno] = mutt_hcache_restore((unsigned char *) uid_validity, 0);
-        ctx->hdrs[msgno]->index = h.sid - 1;
-        if (h.sid != ctx->msgcount + 1)
-          debug_print (1, ("imap_read_headers: msgcount and sequence ID are inconsistent!"));
-        /* messages which have not been expunged are ACTIVE (borrowed from mh 
-         * folders) */
-        ctx->hdrs[msgno]->active = 1;
-        ctx->hdrs[msgno]->read = h.read;
-        ctx->hdrs[msgno]->old = h.old;
-        ctx->hdrs[msgno]->deleted = h.deleted;
-        ctx->hdrs[msgno]->flagged = h.flagged;
-        ctx->hdrs[msgno]->replied = h.replied;
-        ctx->hdrs[msgno]->changed = h.changed;
-        /*  ctx->hdrs[msgno]->received is restored from mutt_hcache_restore */
-        ctx->hdrs[msgno]->data = (void *) (h.data);
-
-        ctx->msgcount++;
       }
       }
+      while ((rc != IMAP_CMD_OK) && ((mfhrc == -1) ||
+                                    ((msgno + 1) >= fetchlast)));
 
 
-      rewind (fp);
-
-      mem_free (&uid_validity);
-
+      if ((mfhrc < -1) || ((rc != IMAP_CMD_CONTINUE) && (rc != IMAP_CMD_OK))) {
+        imap_free_header_data ((void **) &h.data);
+        fclose (fp);
+        mutt_hcache_close (hc);
+        return -1;
+      }
     }
     }
-    while ((rc != IMAP_CMD_OK) && ((mfhrc == -1) ||
-                                   ((msgno + 1) >= fetchlast)));
 
 
-    if ((mfhrc < -1) || ((rc != IMAP_CMD_CONTINUE) && (rc != IMAP_CMD_OK))) {
-      imap_free_header_data ((void **) &h.data);
-      fclose (fp);
-      mutt_hcache_close (hc);
-      return -1;
-    }
+    fetchlast = msgbegin;
   }
   }
-
-  fetchlast = msgbegin;
 #endif /* USE_HCACHE */
 
   for (msgno = msgbegin; msgno <= msgend; msgno++) {
 #endif /* USE_HCACHE */
 
   for (msgno = msgbegin; msgno <= msgend; msgno++) {
diff --git a/menu.c b/menu.c
index 83578a5..4f67b84 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -376,7 +376,7 @@ void menu_check_recenter (MUTTMENU * menu)
   }
   else if (menu->current >= menu->top + menu->pagelen - c) {    /* indicator below bottom threshold */
     if (option (OPTMENUSCROLL) || (menu->pagelen <= 0))
   }
   else if (menu->current >= menu->top + menu->pagelen - c) {    /* indicator below bottom threshold */
     if (option (OPTMENUSCROLL) || (menu->pagelen <= 0))
-      menu->top = menu->current - menu->pagelen + c + 1;
+      menu->top = menu->current - menu->pagelen + c;
     else
       menu->top +=
         (menu->pagelen -
     else
       menu->top +=
         (menu->pagelen -
index fd292f3..78fe7be 100644 (file)
@@ -127,7 +127,7 @@ static int mbox_to_udomain (const char *mbx, char **user, char **domain)
   *domain = NULL;
 
   p = strchr (mbx, '@');
   *domain = NULL;
 
   p = strchr (mbx, '@');
-  if (!p)
+  if (!p || !p[1])
     return -1;
   *user = mem_calloc ((p - mbx + 1), sizeof (mbx[0]));
   strfcpy (*user, mbx, (p - mbx + 1));
     return -1;
   *user = mem_calloc ((p - mbx + 1), sizeof (mbx[0]));
   strfcpy (*user, mbx, (p - mbx + 1));