aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers/imap')
-rw-r--r--camel/providers/imap/camel-imap-command.c10
-rw-r--r--camel/providers/imap/camel-imap-store.c4
-rw-r--r--camel/providers/imap/camel-imap-utils.c15
3 files changed, 24 insertions, 5 deletions
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c
index 9dcc56cbf8..64095b320d 100644
--- a/camel/providers/imap/camel-imap-command.c
+++ b/camel/providers/imap/camel-imap-command.c
@@ -663,8 +663,14 @@ imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt,
case 'F':
string = va_arg (ap, char *);
arglen = strlen (string);
- if (*p == 'F')
- arglen += strlen (store->namespace) + 1;
+ if (*p == 'F') {
+ if (store->namespace == NULL) {
+ if (*string != '\0') /*ok if foldername is "" */
+ g_warning ("trying to list folder \"%s\" but no namespace. Hope for the best", string);
+ arglen += 2;
+ } else
+ arglen += strlen (store->namespace) + 1;
+ }
g_ptr_array_add (args, string);
if (store->capabilities & IMAP_CAPABILITY_LITERALPLUS)
len += arglen + 15;
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index b4c01110ea..eb0c61e0f8 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -961,6 +961,10 @@ delete_folder (CamelStore *store, const char *folder_name, CamelException *ex)
response = camel_imap_command (imap_store, NULL, ex, "SELECT INBOX");
if (response) {
camel_imap_response_free (imap_store, response);
+
+ if (imap_store->current_folder)
+ camel_object_unref (CAMEL_OBJECT (imap_store->current_folder));
+ /* no need to actually create a CamelFolder for INBOX */
imap_store->current_folder = NULL;
} else
return;
diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c
index a449ea228d..df8ddc4f0e 100644
--- a/camel/providers/imap/camel-imap-utils.c
+++ b/camel/providers/imap/camel-imap-utils.c
@@ -773,11 +773,20 @@ imap_concat (CamelImapStore *imap_store, const char *prefix, const char *suffix)
char *
imap_namespace_concat (CamelImapStore *store, const char *name)
{
- if (!name || *name == '\0')
- return g_strdup (store->namespace);
-
+ 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);
}