[evolution-data-server] CamelIMAPXStoreNamespace: Rename 'path' member to 'prefix'.



commit a03f655d36b751a13935aefd30e064701f40b880
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Aug 20 09:52:55 2013 -0400

    CamelIMAPXStoreNamespace: Rename 'path' member to 'prefix'.
    
    Just so I can grok this stuff easier.  The 'path' member stored the
    namespace prefix, minus any trailing mailbox separator character from
    the NAMESPACE response (which btw is wrong; can't assume a namespace
    prefix always has a trailing separator character.  e.g. a '~' prefix
    for the "other users" namespace).

 camel/camel-imapx-server.c        |    2 +-
 camel/camel-imapx-store-summary.c |   28 ++++++++++++++--------------
 camel/camel-imapx-store-summary.h |    4 ++--
 camel/camel-imapx-store.c         |    6 +++---
 camel/camel-imapx-utils.c         |   22 +++++++++++-----------
 5 files changed, 31 insertions(+), 31 deletions(-)
---
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index f02b9d8..e7429c4 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -4275,7 +4275,7 @@ preauthed:
                nsl = g_malloc0 (sizeof (CamelIMAPXNamespaceList));
                ns = g_new0 (CamelIMAPXStoreNamespace, 1);
                ns->next = NULL;
-               ns->path = g_strdup ("");
+               ns->prefix = g_strdup ("");
                ns->full_name = g_strdup ("");
                ns->sep = '/';
                nsl->personal = ns;
diff --git a/camel/camel-imapx-store-summary.c b/camel/camel-imapx-store-summary.c
index a65af60..219fd78 100644
--- a/camel/camel-imapx-store-summary.c
+++ b/camel/camel-imapx-store-summary.c
@@ -212,7 +212,7 @@ camel_imapx_store_summary_path_to_full (CamelIMAPXStoreSummary *s,
        if (si)
                p = path + strlen (subpath);
        else if (ns)
-               p = path + strlen (ns->path);
+               p = path + strlen (ns->prefix);
        else
                p = path;
 
@@ -271,17 +271,17 @@ camel_imapx_store_summary_add_from_full (CamelIMAPXStoreSummary *s,
 
        ns = camel_imapx_store_summary_namespace_find_full (s, full_name);
        if (ns) {
-               d ("(found namespace for '%s' ns '%s') ", full_name, ns->path);
+               d ("(found namespace for '%s' ns '%s') ", full_name, ns->prefix);
                len = strlen (ns->full_name);
                if (len >= strlen (full_name)) {
-                       pathu8 = g_strdup (ns->path);
+                       pathu8 = g_strdup (ns->prefix);
                } else {
                        if (full_name[len] == ns->sep)
                                len++;
 
                        prefix = camel_imapx_store_summary_full_to_path (s, full_name + len, ns->sep);
-                       if (*ns->path) {
-                               pathu8 = g_strdup_printf ("%s/%s", ns->path, prefix);
+                       if (*ns->prefix) {
+                               pathu8 = g_strdup_printf ("%s/%s", ns->prefix, prefix);
                                g_free (prefix);
                        } else {
                                pathu8 = prefix;
@@ -344,7 +344,7 @@ camel_imapx_store_summary_namespace_new (CamelIMAPXStoreSummary *s,
                ns->full_name[len] = 0;
        ns->sep = dir_sep;
 
-       o = p = ns->path = camel_imapx_store_summary_full_to_path (s, ns->full_name, dir_sep);
+       o = p = ns->prefix = camel_imapx_store_summary_full_to_path (s, ns->full_name, dir_sep);
        while ((c = *p++)) {
                if (c != '#') {
                        if (c == '/')
@@ -368,9 +368,9 @@ camel_imapx_store_summary_namespace_find_path (CamelIMAPXStoreSummary *s,
        /* CHEN TODO */
        ns = s->namespaces->personal;
        while (ns) {
-               len = strlen (ns->path);
+               len = strlen (ns->prefix);
                if (len == 0
-                   || (strncmp (ns->path, path, len) == 0
+                   || (strncmp (ns->prefix, path, len) == 0
                        && (path[len] == '/' || path[len] == 0)))
                        break;
                ns = NULL;
@@ -437,26 +437,26 @@ namespace_load (CamelStoreSummary *s,
 
                for (i = 0; i < n; i++) {
                        guint32 sep;
-                       gchar *path;
+                       gchar *prefix;
                        gchar *full_name;
 
-                       if (camel_file_util_decode_string (in, &path) == -1)
+                       if (camel_file_util_decode_string (in, &prefix) == -1)
                                goto exception;
 
                        if (camel_file_util_decode_string (in, &full_name) == -1) {
-                               g_free (path);
+                               g_free (prefix);
                                goto exception;
                        }
 
                        if (camel_file_util_decode_uint32 (in, &sep) == -1) {
-                               g_free (path);
+                               g_free (prefix);
                                g_free (full_name);
                                goto exception;
                        }
 
                        tail->next = ns = g_malloc (sizeof (CamelIMAPXStoreNamespace));
                        ns->sep = sep;
-                       ns->path = path;
+                       ns->prefix = prefix;
                        ns->full_name = full_name;
                        ns->next = NULL;
                        tail = ns;
@@ -499,7 +499,7 @@ namespace_save (CamelStoreSummary *s,
 
                ns = cur;
                while (ns != NULL) {
-                       if (camel_file_util_encode_string (out, ns->path) == -1)
+                       if (camel_file_util_encode_string (out, ns->prefix) == -1)
                                return -1;
 
                        if (camel_file_util_encode_string (out, ns->full_name) == -1)
diff --git a/camel/camel-imapx-store-summary.h b/camel/camel-imapx-store-summary.h
index 52e054f..39cffd0 100644
--- a/camel/camel-imapx-store-summary.h
+++ b/camel/camel-imapx-store-summary.h
@@ -68,9 +68,9 @@ typedef struct _CamelIMAPXStoreNamespace CamelIMAPXStoreNamespace;
 
 struct _CamelIMAPXStoreNamespace {
        CamelIMAPXStoreNamespace *next;
-       gchar *path;            /* display path */
+       gchar *prefix;          /* mailbox prefix, no trailing separator */
        gchar *full_name;       /* real name */
-       gchar sep;              /* directory separator */
+       gchar sep;              /* mailbox separator */
 };
 
 typedef struct _CamelIMAPXNamespaceList {
diff --git a/camel/camel-imapx-store.c b/camel/camel-imapx-store.c
index 98425cf..e2a3b38 100644
--- a/camel/camel-imapx-store.c
+++ b/camel/camel-imapx-store.c
@@ -994,7 +994,7 @@ get_folder_info_offline (CamelStore *store,
 
                if (namespace != NULL) {
                        name = g_strdup (imapx_store->summary->namespaces->personal->full_name);
-                       top = imapx_store->summary->namespaces->personal->path;
+                       top = imapx_store->summary->namespaces->personal->prefix;
                } else
                        name = g_strdup ("");
 
@@ -1246,9 +1246,9 @@ fetch_folders_for_namespaces (CamelIMAPXStore *imapx_store,
 
                        if (pattern != NULL)
                                pat = g_strdup (pattern);
-                       else if (*ns->path != '\0')
+                       else if (*ns->prefix != '\0')
                                pat = g_strdup_printf (
-                                       "%s%c", ns->path, ns->sep);
+                                       "%s%c", ns->prefix, ns->sep);
                        else
                                pat = g_strdup ("");
 
diff --git a/camel/camel-imapx-utils.c b/camel/camel-imapx-utils.c
index f096c31..2fce8c3 100644
--- a/camel/camel-imapx-utils.c
+++ b/camel/camel-imapx-utils.c
@@ -632,13 +632,13 @@ imapx_parse_namespace_list (CamelIMAPXStream *stream,
                        while (tok == '(') {
                                tok = camel_imapx_stream_token (stream, &token, &len, cancellable, NULL);
                                if (tok != IMAPX_TOK_STRING) {
-                                       g_set_error (error, 1, CAMEL_IMAPX_ERROR, "namespace: expected a 
string path name");
+                                       g_set_error (error, 1, CAMEL_IMAPX_ERROR, "namespace: expected a 
prefix string");
                                        goto exception;
                                }
 
                                node = g_new0 (CamelIMAPXStoreNamespace, 1);
                                node->next = NULL;
-                               node->path = g_strdup ((gchar *) token);
+                               node->prefix = g_strdup ((gchar *) token);
 
                                tok = camel_imapx_stream_token (stream, &token, &len, cancellable, NULL);
 
@@ -647,7 +647,7 @@ imapx_parse_namespace_list (CamelIMAPXStream *stream,
                                                node->sep = *token;
                                        } else {
                                                if (*token)
-                                                       node->sep = node->path[strlen (node->path) - 1];
+                                                       node->sep = node->prefix[strlen (node->prefix) - 1];
                                                else
                                                        node->sep = '\0';
                                        }
@@ -656,7 +656,7 @@ imapx_parse_namespace_list (CamelIMAPXStream *stream,
                                        node->sep = '\0';
                                } else {
                                        g_set_error (error, CAMEL_IMAPX_ERROR, 1, "namespace: expected a 
string separtor");
-                                       g_free (node->path);
+                                       g_free (node->prefix);
                                        g_free (node);
                                        goto exception;
                                }
@@ -664,15 +664,15 @@ imapx_parse_namespace_list (CamelIMAPXStream *stream,
                                tail->next = node;
                                tail = node;
 
-                               if (*node->path && node->path[strlen (node->path) -1] == node->sep)
-                                       node->path[strlen (node->path) - 1] = '\0';
+                               if (*node->prefix && node->prefix[strlen (node->prefix) -1] == node->sep)
+                                       node->prefix[strlen (node->prefix) - 1] = '\0';
 
-                               if (!g_ascii_strncasecmp (node->path, "INBOX", 5) &&
-                                               (node->path[6] == '\0' || node->path[6] == node->sep ))
-                                       memcpy (node->path, "INBOX", 5);
+                               if (!g_ascii_strncasecmp (node->prefix, "INBOX", 5) &&
+                                               (node->prefix[6] == '\0' || node->prefix[6] == node->sep ))
+                                       memcpy (node->prefix, "INBOX", 5);
 
                                /* TODO remove full_name later. not required */
-                               node->full_name = g_strdup (node->path);
+                               node->full_name = g_strdup (node->prefix);
 
                                tok = camel_imapx_stream_token (stream, &token, &len, cancellable, NULL);
                                if (tok != ')') {
@@ -2910,7 +2910,7 @@ imapx_namespace_clear (CamelIMAPXStoreNamespace **ns)
        while (node != NULL) {
                next = node->next;
                g_free (node->full_name);
-               g_free (node->path);
+               g_free (node->prefix);
                g_free (node);
                node = next;
        }


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