aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog12
-rw-r--r--camel/providers/imap/camel-imap-store.c28
-rw-r--r--camel/providers/imap/camel-imap-utils.c22
3 files changed, 27 insertions, 35 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 7c272b3393..787f16f41e 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,15 @@
+2002-08-05 Jeffrey Stedfast <fejj@ximian.com>
+
+ * providers/imap/camel-imap-store.c (get_folder_info_online): If
+ we are asking for the toplevel folders, use the IMAP store's
+ namespace as the toplevel folder rather than an empty
+ string. Fixes bug #28574.
+ (imap_forget_folder): Rearrange the code so that name can never be
+ used uninitialised.
+
+ * providers/imap/camel-imap-utils.c (imap_namespace_concat):
+ Removed.
+
2002-08-05 Dan Winship <danw@ximian.com>
* camel-folder-summary.h (CamelMessageFlags): Add
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 2972c52f8b..aa423dc711 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -802,7 +802,7 @@ imap_folder_effectively_unsubscribed(CamelImapStore *imap_store,
}
static void
-imap_forget_folder(CamelImapStore *imap_store, const char *folder_name, CamelException *ex)
+imap_forget_folder (CamelImapStore *imap_store, const char *folder_name, CamelException *ex)
{
CamelFolderSummary *summary;
CamelImapMessageCache *cache;
@@ -812,9 +812,15 @@ imap_forget_folder(CamelImapStore *imap_store, const char *folder_name, CamelExc
CamelFolderInfo *fi;
const char *name;
- storage_path = g_strdup_printf("%s/folders", imap_store->storage_path);
+ name = strrchr (folder_name, imap_store->dir_sep);
+ if (name)
+ name++;
+ else
+ name = folder_name;
+
+ storage_path = g_strdup_printf ("%s/folders", imap_store->storage_path);
folder_dir = e_path_to_physical (storage_path, folder_name);
- g_free(storage_path);
+ g_free (storage_path);
if (access (folder_dir, F_OK) != 0) {
g_free (folder_dir);
goto event;
@@ -845,12 +851,6 @@ imap_forget_folder(CamelImapStore *imap_store, const char *folder_name, CamelExc
rmdir (folder_dir);
g_free (folder_dir);
- name = strrchr (folder_name, imap_store->dir_sep);
- if (name)
- name++;
- else
- name = folder_name;
-
event:
fi = g_new0 (CamelFolderInfo, 1);
@@ -1136,7 +1136,7 @@ imap_connect_online (CamelService *service, CamelException *ex)
FILE *storeinfo;
int i, flags;
size_t len;
-
+
CAMEL_IMAP_STORE_LOCK (store, command_lock);
if (!connect_to_server_wrapper (service, ex) ||
!imap_auth_loop (service, ex)) {
@@ -1188,6 +1188,7 @@ imap_connect_online (CamelService *service, CamelException *ex)
}
g_free (result);
}
+
if (!store->namespace)
store->namespace = g_strdup ("");
@@ -2017,7 +2018,7 @@ get_folder_info_online (CamelStore *store, const char *top,
name = top;
if (!name || name[0] == '\0') {
need_inbox = TRUE;
- name = "";
+ name = imap_store->namespace ? imap_store->namespace : "";
}
folders = g_ptr_array_new ();
@@ -2057,6 +2058,7 @@ get_folder_info_online (CamelStore *store, const char *top,
get_folders_online (imap_store, pattern, folders, (flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED), ex);
g_free (pattern);
}
+
if (camel_exception_is_set (ex)) {
lose:
for (i = 0; i < folders->len; i++)
@@ -2064,7 +2066,7 @@ get_folder_info_online (CamelStore *store, const char *top,
g_ptr_array_free (folders, TRUE);
return NULL;
}
-
+
/* Add INBOX, if necessary */
if (need_inbox) {
for (i = 0; i < folders->len; i++) {
@@ -2094,7 +2096,7 @@ get_folder_info_online (CamelStore *store, const char *top,
g_ptr_array_add (folders, fi);
}
}
-
+
/* Assemble. */
tree = camel_folder_info_build (folders, name, imap_store->dir_sep, TRUE);
if (flags & CAMEL_STORE_FOLDER_INFO_FAST) {
diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c
index 48cadf02d2..0d5d45c30e 100644
--- a/camel/providers/imap/camel-imap-utils.c
+++ b/camel/providers/imap/camel-imap-utils.c
@@ -1095,28 +1095,6 @@ imap_concat (CamelImapStore *imap_store, const char *prefix, const char *suffix)
return g_strdup_printf ("%s%c%s", prefix, imap_store->dir_sep, suffix);
}
-char *
-imap_namespace_concat (CamelImapStore *store, const char *name)
-{
- if (!name || *name == '\0') {
- if (store->namespace)
- return g_strdup (store->namespace);
- else
- return g_strdup ("");
- }
-
- if (!g_strcasecmp (name, "INBOX"))
- return g_strdup ("INBOX");
-
- if (store->namespace == NULL) {
- g_warning ("Trying to concat NULL namespace to \"%s\"!", name);
- return g_strdup (name);
- }
-
- return imap_concat (store, store->namespace, name);
-}
-
-
#define UTF8_TO_UTF7_LEN(len) ((len * 3) + 8)
#define UTF7_TO_UTF8_LEN(len) (len)