aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@src.gnome.org>2000-06-24 03:51:48 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-06-24 03:51:48 +0800
commitf415fa4b2897ca5021dce68cf6bd6750e271d4bd (patch)
tree35a9392a638f259a5a6d7875efed04c1110415cc /camel
parentaa68bd85f17d3fecdcbcaa77f3957ba7bb6d559a (diff)
downloadgsoc2013-evolution-f415fa4b2897ca5021dce68cf6bd6750e271d4bd.tar.gz
gsoc2013-evolution-f415fa4b2897ca5021dce68cf6bd6750e271d4bd.tar.zst
gsoc2013-evolution-f415fa4b2897ca5021dce68cf6bd6750e271d4bd.zip
providers/imap/camel-imap-[store,folder].c: Improved folder parsing
svn path=/trunk/; revision=3712
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog7
-rw-r--r--camel/providers/imap/camel-imap-folder.c13
-rw-r--r--camel/providers/imap/camel-imap-store.c4
3 files changed, 17 insertions, 7 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 6e800f9fc2..46e9046856 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,10 @@
+2000-06-23 Jeffrey Stedfast <fejj@helixcode.com>
+
+ * providers/imap/camel-imap-store.c:
+ * providers/imap/camel-imap-folder.c: Improved folder parsing.
+ Not specifying a namespace should no longer list the entire
+ filesystem.
+
2000-06-22 Chris Toshok <toshok@helixcode.com>
* providers/nntp/.cvsignore: ignore test-newsrc
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 6c38eb3cf5..51bab59eb4 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -278,7 +278,7 @@ imap_init (CamelFolder *folder, CamelStore *parent_store, CamelFolder *parent_fo
imap_folder->summary = NULL;
/* SELECT the IMAP mail spool */
- if (url && url->path && strcmp (folder->full_name, "INBOX"))
+ if (url && url->path && *(url->path + 1) && strcmp (folder->full_name, "INBOX"))
folder_path = g_strdup_printf ("%s/%s", url->path + 1, folder->full_name);
else
folder_path = g_strdup (folder->full_name);
@@ -439,7 +439,7 @@ imap_get_message_count (CamelFolder *folder, CamelException *ex)
if (imap_folder->count != -1)
return imap_folder->count;
- if (url && url->path && strcmp (folder->full_name, "INBOX"))
+ if (url && url->path && *(url->path + 1) && strcmp (folder->full_name, "INBOX"))
folder_path = g_strdup_printf ("%s/%s", url->path + 1, folder->full_name);
else
folder_path = g_strdup (folder->full_name);
@@ -503,10 +503,12 @@ imap_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelExcept
}
mem->buffer = g_byte_array_append (mem->buffer, g_strdup("\r\n"), 3);
- if (url && url->path && strcmp(folder->full_name, "INBOX"))
+
+ if (url && url->path && *(url->path + 1) && strcmp(folder->full_name, "INBOX"))
folder_path = g_strdup_printf ("%s/%s", url->path, folder->full_name);
else
folder_path = g_strdup (folder->full_name);
+
status = camel_imap_command (CAMEL_IMAP_STORE (folder->parent_store),
folder, &result,
"APPEND %s (\\Seen) {%d}\r\n%s",
@@ -618,7 +620,8 @@ imap_get_subfolder_names (CamelFolder *folder, CamelException *ex)
}
status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), folder,
- &result, "LIST \"\" \"%s/*\"", folder_path);
+ &result, "LIST \"\" \"%s%s\"", folder_path,
+ *folder_path ? "/*" : "*");
if (status != CAMEL_IMAP_OK) {
CamelService *service = CAMEL_SERVICE (folder->parent_store);
@@ -661,7 +664,7 @@ imap_get_subfolder_names (CamelFolder *folder, CamelException *ex)
g_free (flags);
/* chop out the folder prefix */
- if (!strncmp (folder, folder_path, strlen (folder_path))) {
+ if (*folder_path && !strncmp (folder, folder_path, strlen (folder_path))) {
f = folder + strlen (folder_path) + 1;
memmove (folder, f, strlen (f) + 1);
}
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 863501487b..f178ad8390 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -325,7 +325,7 @@ imap_folder_exists (CamelFolder *folder)
gchar *result, *folder_path;
gint status;
- if (url && url->path && strcmp (folder->full_name, "INBOX"))
+ if (url && url->path && *(url->path + 1) && strcmp (folder->full_name, "INBOX"))
folder_path = g_strdup_printf ("%s/%s", url->path + 1, folder->full_name);
else
folder_path = g_strdup (folder->full_name);
@@ -367,7 +367,7 @@ imap_create (CamelFolder *folder, CamelException *ex)
return TRUE;
/* create the directory for the subfolder */
- if (url && url->path && strcmp (folder->full_name, "INBOX"))
+ if (url && url->path && *(url->path + 1) && strcmp (folder->full_name, "INBOX"))
folder_path = g_strdup_printf ("%s/%s", url->path + 1, folder->full_name);
else
folder_path = g_strdup (folder->full_name);