aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-08-05 06:41:05 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-08-05 06:41:05 +0800
commit9d08ab1e01ca461c67917d982f75f6574c6df3e3 (patch)
treeebb95da57096b3b886fa68b6f0e5a03a3b32cd04
parent5c3eeb95528778ea63cf8d4330b7ac70299d583f (diff)
downloadgsoc2013-evolution-9d08ab1e01ca461c67917d982f75f6574c6df3e3.tar
gsoc2013-evolution-9d08ab1e01ca461c67917d982f75f6574c6df3e3.tar.gz
gsoc2013-evolution-9d08ab1e01ca461c67917d982f75f6574c6df3e3.tar.bz2
gsoc2013-evolution-9d08ab1e01ca461c67917d982f75f6574c6df3e3.tar.lz
gsoc2013-evolution-9d08ab1e01ca461c67917d982f75f6574c6df3e3.tar.xz
gsoc2013-evolution-9d08ab1e01ca461c67917d982f75f6574c6df3e3.tar.zst
gsoc2013-evolution-9d08ab1e01ca461c67917d982f75f6574c6df3e3.zip
If we fail to get a dir_sep, then supply the default of "/". (get_folder):
2000-08-04 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-store.c (imap_connect): If we fail to get a dir_sep, then supply the default of "/". (get_folder): Undo changes by Peter svn path=/trunk/; revision=4537
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/providers/imap/camel-imap-store.c59
2 files changed, 37 insertions, 28 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index a70da9a00e..27a5d22262 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,9 @@
+2000-08-04 Jeffrey Stedfast <fejj@helixcode.com>
+
+ * providers/imap/camel-imap-store.c (imap_connect): If we fail to
+ get a dir_sep, then supply the default of "/".
+ (get_folder): Undo changes by Peter
+
2000-08-04 Peter Williams <peterw@helixcode.com>
* providers/imap/camel-imap-store.c (get_folder): Prevent a coredump
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index c1ecedc05d..2fc530f357 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -350,9 +350,7 @@ imap_connect (CamelService *service, CamelException *ex)
"Unknown error");
}
- /* FIXME: parse for capabilities here. */
- d(fprintf (stderr, "%s\n", result));
-
+ /* parse for capabilities here. */
if (e_strstrcase (result, "IMAP4REV1"))
store->server_level = IMAP_LEVEL_IMAP4REV1;
else if (e_strstrcase (result, "IMAP4"))
@@ -366,7 +364,7 @@ imap_connect (CamelService *service, CamelException *ex)
store->has_status_capability = FALSE;
g_free (result);
-
+
/* We now need to find out which directory separator this daemon uses */
status = camel_imap_command_extended (store, NULL, &result, "LIST \"\" \"\"");
@@ -393,7 +391,11 @@ imap_connect (CamelService *service, CamelException *ex)
g_free (sep);
g_free (folder);
}
-
+
+ /* default directory separator */
+ if (!store->dir_sep)
+ store->dir_sep = g_strdup ("/");
+
g_free (result);
/* Lets add a timeout so that we can hopefully prevent getting disconnected */
@@ -408,10 +410,10 @@ imap_disconnect (CamelService *service, CamelException *ex)
CamelImapStore *store = CAMEL_IMAP_STORE (service);
char *result;
int status;
-
+
if (!service->connected)
return TRUE;
-
+
/* send the logout command */
status = camel_imap_command_extended (CAMEL_IMAP_STORE (service), NULL, &result, "LOGOUT");
if (status != CAMEL_IMAP_OK) {
@@ -421,22 +423,22 @@ imap_disconnect (CamelService *service, CamelException *ex)
if (!service_class->disconnect (service, ex))
return FALSE;
-
+
if (store->istream) {
gtk_object_unref (GTK_OBJECT (store->istream));
store->istream = NULL;
}
-
+
if (store->ostream) {
gtk_object_unref (GTK_OBJECT (store->ostream));
store->ostream = NULL;
}
-
+
g_free (store->dir_sep);
store->dir_sep = NULL;
-
+
store->current_folder = NULL;
-
+
if (store->timeout_id) {
gtk_timeout_remove (store->timeout_id);
store->timeout_id = 0;
@@ -449,7 +451,7 @@ const gchar *
camel_imap_store_get_toplevel_dir (CamelImapStore *store)
{
CamelURL *url = CAMEL_SERVICE (store)->url;
-
+
g_assert (url != NULL);
return url->path;
}
@@ -461,18 +463,17 @@ imap_folder_exists (CamelFolder *folder)
CamelURL *url = CAMEL_SERVICE (store)->url;
gchar *result, *folder_path, *dir_sep;
gint status;
-
+
dir_sep = CAMEL_IMAP_STORE (folder->parent_store)->dir_sep;
if (url && url->path && *(url->path + 1) && strcmp (folder->full_name, "INBOX"))
folder_path = g_strdup_printf ("%s%s%s", url->path + 1, dir_sep, folder->full_name);
else
folder_path = g_strdup (folder->full_name);
-
- d(fprintf (stderr, "doing an EXAMINE...\n"));
+
status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), NULL,
&result, "EXAMINE %s", folder_path);
-
+
if (status != CAMEL_IMAP_OK) {
g_free (result);
g_free (folder_path);
@@ -480,7 +481,7 @@ imap_folder_exists (CamelFolder *folder)
}
g_free (folder_path);
g_free (result);
-
+
return TRUE;
}
@@ -491,7 +492,7 @@ imap_create (CamelFolder *folder, CamelException *ex)
CamelURL *url = CAMEL_SERVICE (store)->url;
gchar *result, *folder_path, *dir_sep;
gint status;
-
+
g_return_val_if_fail (folder != NULL, FALSE);
if (!(folder->full_name || folder->name)) {
@@ -499,10 +500,10 @@ imap_create (CamelFolder *folder, CamelException *ex)
"invalid folder path. Use set_name ?");
return FALSE;
}
-
+
if (!strcmp (folder->full_name, "INBOX"))
return TRUE;
-
+
if (imap_folder_exists (folder))
return TRUE;
@@ -516,7 +517,7 @@ imap_create (CamelFolder *folder, CamelException *ex)
status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), NULL,
&result, "CREATE %s", folder_path);
-
+
if (status != CAMEL_IMAP_OK) {
CamelService *service = CAMEL_SERVICE (folder->parent_store);
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
@@ -530,7 +531,7 @@ imap_create (CamelFolder *folder, CamelException *ex)
}
g_free (folder_path);
g_free (result);
-
+
return TRUE;
}
@@ -578,17 +579,19 @@ get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelEx
g_return_val_if_fail (folder_name != NULL, NULL);
dir_sep = CAMEL_IMAP_STORE (store)->dir_sep;
-
- if (dir_sep && !strcmp (folder_name, dir_sep))
+
+ /* if we're trying to get the top-level dir, we really want the namespace */
+ if (!strcmp (folder_name, dir_sep))
folder_path = g_strdup (url->path + 1);
else
folder_path = g_strdup (folder_name);
-
+
new_folder = camel_imap_folder_new (store, folder_path, ex);
-
+
+ /* this is the top-level dir, we already know it exists - it has to! */
if (!strcmp (folder_name, dir_sep))
return new_folder;
-
+
if (create && !imap_create (new_folder, ex)) {
if (!folder_is_selectable (store, folder_path)) {
camel_exception_clear (ex);