]> granicus.if.org Git - mutt/commitdiff
patch-bac.parsepath-2
authorThomas Roessler <roessler@does-not-exist.org>
Mon, 21 Aug 2000 19:25:24 +0000 (19:25 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Mon, 21 Aug 2000 19:25:24 +0000 (19:25 +0000)
imap/browse.c
imap/imap.c
mutt_socket.c
muttlib.c

index 95ef83d67a283b39d9be8a9bbe33c01bc9e7e4c2..cfd77c793ff2715ec2aa5e0574ca9e70f128689b 100644 (file)
@@ -311,7 +311,7 @@ static int browse_add_list_result (IMAP_DATA* idata, const char* cmd,
       if (isparent)
         noselect = 1;
       /* prune current folder from output */
-      if (isparent || strncmp (name, mx.mbox, strlen (name)))
+      if (isparent || mutt_strncmp (name, mx.mbox, strlen (name)))
         imap_add_folder (idata->delim, name, noselect, noinferiors, state,
           isparent);
     }
@@ -348,8 +348,8 @@ static void imap_add_folder (char delim, char *folder, int noselect,
   if (isparent)
     strfcpy (relpath, "../", sizeof (relpath));
   /* strip current folder from target, to render a relative path */
-  else if (!strncmp (mx.mbox, folder, strlen (mx.mbox)))
-    strfcpy (relpath, folder + strlen (mx.mbox), sizeof (relpath));
+  else if (!mutt_strncmp (mx.mbox, folder, mutt_strlen (mx.mbox)))
+    strfcpy (relpath, folder + mutt_strlen (mx.mbox), sizeof (relpath));
   else
     strfcpy (relpath, folder, sizeof (relpath));
 
index e66878ca6c00e48190f4cf5c754d79ea9767fd93..2fbdad7eca5989919a4277e36ebd9f68487806f1 100644 (file)
@@ -1062,13 +1062,14 @@ int imap_mailbox_check (char* path, int new)
     connflags = M_IMAP_CONN_NONEW;
 
   if (!(idata = imap_conn_find (&(mx.account), connflags)))
-    goto fail;
+  {
+    FREE (&mx.mbox);
+    return -1;
+  }
   conn = idata->conn;
 
   imap_fix_path (idata, mx.mbox, buf, sizeof (buf));
-  /* Update the path, if it fits */
-  if (strlen (buf) < strlen (mx.mbox))
-      strcpy (mx.mbox, buf);
+  FREE (&mx.mbox);
 
   imap_munge_mbox_name (mbox, sizeof(mbox), buf);
   strfcpy (mbox_unquoted, buf, sizeof (mbox_unquoted));
@@ -1092,7 +1093,7 @@ int imap_mailbox_check (char* path, int new)
   else
     /* Server does not support STATUS, and this is not the current mailbox.
      * There is no lightweight way to check recent arrivals */
-    goto fail;
+    return -1;
 
   imap_cmd_start (idata, buf);
 
@@ -1128,12 +1129,7 @@ int imap_mailbox_check (char* path, int new)
   }
   while (rc == IMAP_CMD_CONTINUE);
 
-  FREE (&mx.mbox);
   return msgcount;
-
- fail:
-  FREE (&mx.mbox);
-  return -1;
 }
 
 /* all this listing/browsing is a mess. I don't like that name is a pointer
index 1379d2b77117544444b9fba054eea1b23ee78d9a..fd3e2eb6ad6039dd239f8ce7b847361cd155fb85 100644 (file)
@@ -49,7 +49,7 @@ int mutt_socket_open (CONNECTION* conn)
 
 int mutt_socket_close (CONNECTION* conn)
 {
-  int rc;
+  int rc = -1;
 
   if (conn->fd < 0)
     dprint (1, (debugfile, "mutt_socket_close: Attempt to close closed connection.\n"));
index 83c52970668ba029119ce70bab639bb4d903551b..9f1bcfd266cd39947326502f7ce5807948d0ace3 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -681,16 +681,22 @@ void mutt_pretty_mailbox (char *s)
   }
   *q = 0;
 
-  if (mutt_strncmp (s, Maildir, (len = mutt_strlen (Maildir))) == 0 && s[len] == '/')
+  if (mutt_strncmp (s, Maildir, (len = mutt_strlen (Maildir))) == 0)
   {
+    /* chop off delimiters after Maildir. '.' is a hack because IMAP can
+     * use arbitrary delimiters, but we may not have a connection. Could
+     * call an IMAP delimiter getting function here later, otherwise
+     * default to this. */
+    if (s[len] != '/' && s[len] != '.')
+      len--;
     *s++ = '=';
-    strcpy (s, s + len);
+    memmove (s, s + len, mutt_strlen (s + len) + 1);
   }
   else if (mutt_strncmp (s, Homedir, (len = mutt_strlen (Homedir))) == 0 &&
           s[len] == '/')
   {
     *s++ = '~';
-    strcpy (s, s + len - 1);
+    memmove (s, s + len - 1, mutt_strlen (s + len - 1) + 1);
   }
 }