diff options
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 15 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 2 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 60 |
3 files changed, 28 insertions, 49 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 1e299a6d47..ad8c26c456 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,9 +1,22 @@ 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. + +2000-07-13 Jeffrey Stedfast <fejj@helixcode.com> + + * providers/imap/camel-imap-folder.c: * providers/imap/camel-imap-store.c: Updated to use CAMEL_IMAP_OK, CAMEL_IMAP_NO, CAMEL_IMAP_BAD, and CAMEL_IMAP_FAIL rather than the - ones copied from the POP3 provider. + ones copied from the POP3 provider. 2000-07-13 Jeffrey Stedfast <fejj@helixcode.com> 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; |