commit-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Mailutils branch, master, updated. release-3.1.1-11-g4323d35


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-3.1.1-11-g4323d35
Date: Wed, 21 Dec 2016 11:20:06 +0000 (UTC)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=4323d352150c7af79b9f1699d2130c4cae1e4b88

The branch, master has been updated
       via  4323d352150c7af79b9f1699d2130c4cae1e4b88 (commit)
      from  9f1d5ced7ae7ba2489e5c3908b846f1c3f30889f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4323d352150c7af79b9f1699d2130c4cae1e4b88
Author: Sergey Poznyakoff <address@hidden>
Date:   Wed Dec 21 12:46:03 2016 +0200

    imap: fix LIST "" "mbox"
    
    * imap4d/list.c (imap4d_list): Move the longest directory prefix
    to the reference.
    * imap4d/tests/list.at: New testcase.
    * libmu_sieve/tests.c: Fix bug introduced by previous commit

-----------------------------------------------------------------------

Summary of changes:
 imap4d/list.c        |   44 +++++++++++++-------------------------------
 imap4d/tests/list.at |    6 ++++++
 libmu_sieve/tests.c  |   15 ++++++---------
 3 files changed, 25 insertions(+), 40 deletions(-)

diff --git a/imap4d/list.c b/imap4d/list.c
index c9217f9..dda9744 100644
--- a/imap4d/list.c
+++ b/imap4d/list.c
@@ -170,17 +170,14 @@ imap4d_list (struct imap4d_session *session,
       mu_folder_t folder;
       char *cwd;
       struct refinfo refinfo;
-      size_t seglen;
+      size_t i;
       
       switch (*wcard)
        {
          /* Absolute Path in wcard, dump the old ref.  */
        case '/':
-         {
-           ref = calloc (2, 1);
-           ref[0] = *wcard;
-           wcard++;
-         }
+         ref = mu_strdup ("/");
+         wcard++;
          break;
 
          /* Absolute Path, but take care of things like ~guest/Mail,
@@ -207,23 +204,22 @@ imap4d_list (struct imap4d_session *session,
          ref = mu_strdup (ref);
        }
 
-      /* Move any directory not containing a wildcard into the reference
-        So (ref = ~guest, wcard = Mail/folder1/%.vf) -->
-        (ref = ~guest/Mail/folder1, wcard = %.vf).  */
-      seglen = strcspn (wcard, "%*");
-
-      if (seglen)
+      /* Find the longest directory prefix */
+      i = strcspn (wcard, "%*");
+      while (i > 0 && wcard[i - 1] != '/')
+       i--;
+      /* Append it to the reference */
+      if (i)
        {
          size_t reflen = strlen (ref);
          int addslash = (reflen > 0 && ref[reflen-1] != '/'); 
-         size_t len = seglen + reflen + addslash + 1;
+         size_t len = i + reflen + addslash;
 
-         ref = realloc (ref, len);
+         ref = mu_realloc (ref, len);
          if (addslash)
            ref[reflen++] = '/';
-         memcpy (ref + reflen, wcard, seglen);
-         ref[reflen + seglen] = 0;
-         wcard += seglen;
+         memcpy (ref + reflen, wcard, i - 1); /* omit the trailing / */
+         ref[len-1] = 0;
        }
 
       /* Allocates.  */
@@ -235,20 +231,6 @@ imap4d_list (struct imap4d_session *session,
                                      "The requested item could not be found.");
        }
 
-      /* FIXME */
-      if (wcard[0] == 0)
-       {
-         char *p = strrchr (ref, '/');
-         if (p && p[1])
-           {
-             *p++ = 0;
-             wcard = p;
-
-             p = strrchr (cwd, '/');
-             *p = 0;
-           }
-       }
-
       status = mu_folder_create (&folder, cwd);
       if (status)
        {
diff --git a/imap4d/tests/list.at b/imap4d/tests/list.at
index 73869a4..8719177 100644
--- a/imap4d/tests/list.at
+++ b/imap4d/tests/list.at
@@ -135,6 +135,12 @@ LIST_CHECK([empty reference + INBOX],[list07],
 * LIST (\NoInferiors) NIL INBOX
 ])
 
+LIST_CHECK([empty reference + mailbox],[list08],
+["" "search.mbox"],
+[dnl
+* LIST (\NoInferiors) "/" search.mbox
+])
+
 dnl ----------------------------------------------------------------------
 
 m4_popdef([IMAP4D_HOMEDIR])
diff --git a/libmu_sieve/tests.c b/libmu_sieve/tests.c
index 29864e7..34beac6 100644
--- a/libmu_sieve/tests.c
+++ b/libmu_sieve/tests.c
@@ -71,15 +71,12 @@ retrieve_address (void *item, void *data, size_t idx, char 
**pval)
        return MU_ERR_NOENT;
       rc = mu_address_create (&ap->addr, val);
       free (val);
-      switch (rc)
-       {
-       case MU_ERR_EMPTY_ADDRESS:
-       case MU_ERR_NOENT:
-         return MU_ERR_NOENT;
-
-       default:
-         return rc;
-       }
+      if (rc)
+        {
+          if (rc == MU_ERR_EMPTY_ADDRESS)
+            rc = MU_ERR_NOENT;
+          return rc;
+        }
     }
 
   rc = ap->aget (ap->addr, idx+1, pval);


hooks/post-receive
-- 
GNU Mailutils



reply via email to

[Prev in Thread] Current Thread [Next in Thread]