aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-07-14 06:17:19 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-07-14 06:17:19 +0800
commita7cdc29a08b9b55c71ced639147e7caf4bd3c608 (patch)
tree86c037c7c806b1c8a412a77179fd613bf8b3e2ac /camel/providers
parent085e18d4372f2f04e346000c3d33b82c9d7292a0 (diff)
downloadgsoc2013-evolution-a7cdc29a08b9b55c71ced639147e7caf4bd3c608.tar.gz
gsoc2013-evolution-a7cdc29a08b9b55c71ced639147e7caf4bd3c608.tar.zst
gsoc2013-evolution-a7cdc29a08b9b55c71ced639147e7caf4bd3c608.zip
If a SELECT fails, set imap_store->current_folder to NULL so a SELECT is
2000-07-13 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-folder.c: * providers/imap/camel-imap-store.c: If a SELECT fails, set imap_store->current_folder to NULL so a SELECT is forced before any message/folder operations are requested. Also, because some users don't use a namespace, make sure that if the url->path is "/" we don't use it when creating the folder_path. (camel_imap_command[_extended]): Since we allow the passing of a NULL folder which we can use to bypass a forced SELECT, no need to check for the individual commands that don't require a folder to be selected. svn path=/trunk/; revision=4161
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-folder.c2
-rw-r--r--camel/providers/imap/camel-imap-store.c60
2 files changed, 14 insertions, 48 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 8ba8c27f60..f1e2365dcb 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -267,6 +267,8 @@ imap_init (CamelFolder *folder, CamelStore *parent_store, CamelFolder *parent_fo
"Could not SELECT %s on IMAP server %s: %s.",
folder->full_name, service->url->host,
result ? result : "Unknown error");
+
+ CAMEL_IMAP_STORE (store)->current_folder = NULL;
} else {
/* parse the mode we opened it in and set as current mailbox */
CAMEL_IMAP_STORE (store)->current_folder = folder;
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 717c407b58..cd22095287 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -534,13 +534,12 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, char **ret, char
va_list ap;
gint status = CAMEL_IMAP_OK;
- if (folder && store->current_folder != folder && strncmp (fmt, "STATUS", 6) &&
- strncmp (fmt, "CREATE", 5) && strcmp (fmt, "CAPABILITY")) {
+ if (folder && store->current_folder != folder && strncmp (fmt, "CREATE", 5)) {
/* We need to select the correct mailbox first */
- char *r, *folder_path, *recent;
+ char *r, *folder_path;
int s;
- 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);
@@ -549,37 +548,11 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, char **ret, char
g_free (folder_path);
if (!r || s != CAMEL_IMAP_OK) {
*ret = r;
- return s;
- } else {
- /* parse the read-write mode */
-#if 0
- char *p;
-
- p = strstr (r, "\n");
- while (p) {
- if (*(p + 1) == '*')
- p = strstr (p, "\n");
- else
- break;
- }
-
- if (p) {
- if (e_strstrcase (p, "READ-WRITE"))
- mode =
- }
-#endif
- }
-#if 0
- if ((recent = e_strstrcase (r, "RECENT"))) {
- char *p;
+ store->current_folder = NULL;
- for (p = recent; p > r && *p != '*'; p--);
- for ( ; *p && (*p < '0' || *p > '9') && p < recent; p++);
-
- if (atoi (p) > 0)
- gtk_signal_emit_by_name (GTK_OBJECT (folder), "folder_changed");
+ return s;
}
-#endif
+
g_free (r);
store->current_folder = folder;
@@ -665,13 +638,12 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char **
gint len = 0, status = CAMEL_IMAP_OK;
if (folder && store->current_folder != folder && strncmp (fmt, "SELECT", 6) &&
- strncmp (fmt, "EXAMINE", 7) && strncmp (fmt, "STATUS", 6) &&
- strncmp (fmt, "CREATE", 6) && strcmp (fmt, "CAPABILITY")) {
+ strncmp (fmt, "CREATE", 6)) {
/* We need to select the correct mailbox first */
- char *r, *folder_path, *recent;
+ char *r, *folder_path;
int s;
- 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);
@@ -680,19 +652,11 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char **
g_free (folder_path);
if (!r || s != CAMEL_IMAP_OK) {
*ret = r;
+ store->current_folder = NULL;
+
return s;
}
-#if 0
- if ((recent = e_strstrcase (r, "RECENT"))) {
- char *p;
-
- for (p = recent; p > r && *p != '*'; p--);
- for ( ; *p && (*p < '0' || *p > '9') && p < recent; p++);
- if (atoi (p) > 0)
- gtk_signal_emit_by_name (GTK_OBJECT (folder), "folder_changed");
- }
-#endif
g_free (r);
store->current_folder = folder;
@@ -720,7 +684,7 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char **
while (1) {
respbuf = camel_stream_buffer_read_line (stream);
- if (!respbuf || !strncmp(respbuf, cmdid, strlen(cmdid)) ) {
+ if (!respbuf || !strncmp(respbuf, cmdid, strlen(cmdid))) {
/* IMAP's last response starts with our command id */
d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
break;