diff options
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 5 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 10 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 38 |
3 files changed, 32 insertions, 21 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index a2de60c2fb..91aef64322 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,8 @@ +2000-06-17 Jeffrey Stedfast <fejj@helixcode.com> + + * providers/imap/camel-imap-folder.c (imap_init): Should now + correctly do CAPABILITY. + 2000-06-17 Dan Winship <danw@helixcode.com> * providers/mbox/camel-mbox-summary.c: Add some debugging printfs diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 1b0de9ca5f..74148d3d92 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -208,21 +208,26 @@ imap_init (CamelFolder *folder, CamelStore *parent_store, CamelFolder *parent_fo /* now lets find out if we can do searches... */ status = camel_imap_command_extended (CAMEL_IMAP_STORE (folder->parent_store), folder, &result, "CAPABILITY"); + + /* ugh, I forgot that CAPABILITY doesn't have a response code */ if (status != CAMEL_IMAP_OK) { CamelService *service = CAMEL_SERVICE (folder->parent_store); + camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, "Could not get capabilities on IMAP server %s: %s.", service->url->host, status == CAMEL_IMAP_ERR ? result : "Unknown error"); } - - if (strstr (result, "SEARCH")) + + if (strstrcase (result, "SEARCH")) folder->has_search_capability = TRUE; else folder->has_search_capability = FALSE; g_free (result); + + fprintf (stderr, "IMAP provider does%shave SEARCH support\n", folder->has_search_capability ? " " : "n't "); /* some IMAP daemons support user-flags * * I would not, however, rely on this feature as * @@ -242,6 +247,7 @@ imap_init (CamelFolder *folder, CamelStore *parent_store, CamelFolder *parent_fo &result, "SELECT %s", folder->full_name); if (status != CAMEL_IMAP_OK) { CamelService *service = CAMEL_SERVICE (folder->parent_store); + camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, "Could not SELECT %s on IMAP server %s: %s.", folder->full_name, service->url->host, diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index a02ff639d0..72a5d7d8ac 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -421,15 +421,15 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, char **ret, char gchar *cmdbuf, *respbuf; gchar *cmdid; va_list ap; - gint status; + gint status = CAMEL_IMAP_OK; - if (folder && store->current_folder != folder && strncmp(fmt, "SELECT", 6) && - strncmp(fmt, "STATUS", 6) && strncmp(fmt, "CREATE", 5)) { + if (folder && store->current_folder != folder && strncmp (fmt, "SELECT", 6) && + strncmp (fmt, "STATUS", 6) && strncmp (fmt, "CREATE", 5) && strcmp (fmt, "CAPABILITY")) { /* We need to select the correct mailbox first */ char *r; int s; - s = camel_imap_command(store, folder, &r, "SELECT %s", folder->full_name); + s = camel_imap_command (store, folder, &r, "SELECT %s", folder->full_name); if (s != CAMEL_IMAP_OK) { *ret = r; return s; @@ -439,32 +439,32 @@ camel_imap_command (CamelImapStore *store, CamelFolder *folder, char **ret, char } /* create the command */ - cmdid = g_strdup_printf("A%.5d", store->command++); + cmdid = g_strdup_printf ("A%.5d", store->command++); va_start (ap, fmt); cmdbuf = g_strdup_vprintf (fmt, ap); va_end (ap); - fprintf(stderr, "sending : %s %s\r\n", cmdid, cmdbuf); + fprintf (stderr, "sending : %s %s\r\n", cmdid, cmdbuf); if (camel_stream_printf (store->ostream, "%s %s\r\n", cmdid, cmdbuf) == -1) { - g_free(cmdbuf); - g_free(cmdid); + g_free (cmdbuf); + g_free (cmdid); if (*ret) - *ret = g_strdup(strerror(errno)); + *ret = g_strdup (strerror(errno)); return CAMEL_IMAP_FAIL; } - g_free(cmdbuf); + g_free (cmdbuf); /* Read the response */ respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (store->istream)); if (respbuf == NULL) { if (*ret) - *ret = g_strdup(strerror(errno)); + *ret = g_strdup (strerror(errno)); return CAMEL_IMAP_FAIL; } fprintf(stderr, "received: %s\n", respbuf ? respbuf : "(null)"); - + status = camel_imap_status (cmdid, respbuf); g_free (cmdid); @@ -515,13 +515,13 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char ** va_list app; gint status = CAMEL_IMAP_OK; - if (folder && store->current_folder != folder && strncmp(fmt, "SELECT", 6) && - strncmp(fmt, "STATUS", 6) && strncmp(fmt, "CREATE", 5)) { + if (folder && store->current_folder != folder && strncmp (fmt, "SELECT", 6) && + strncmp (fmt, "STATUS", 6) && strncmp (fmt, "CREATE", 5) && strcmp (fmt, "CAPABILITY")) { /* We need to select the correct mailbox first */ char *r; int s; - s = camel_imap_command(store, folder, &r, "SELECT %s", folder->full_name); + s = camel_imap_command (store, folder, &r, "SELECT %s", folder->full_name); if (s != CAMEL_IMAP_OK) { *ret = r; return s; @@ -531,22 +531,22 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char ** } /* Create the command */ - cmdid = g_strdup_printf("A%.5d", store->command++); + cmdid = g_strdup_printf ("A%.5d", store->command++); va_start (app, fmt); cmdbuf = g_strdup_vprintf (fmt, app); va_end (app); - fprintf(stderr, "sending : %s %s\r\n", cmdid, cmdbuf); + fprintf (stderr, "sending : %s %s\r\n", cmdid, cmdbuf); if (camel_stream_printf (store->ostream, "%s %s\r\n", cmdid, cmdbuf) == -1) { g_free(cmdbuf); g_free(cmdid); - *ret = g_strdup(strerror(errno)); + *ret = g_strdup (strerror(errno)); return CAMEL_IMAP_FAIL; } - g_free(cmdbuf); + g_free (cmdbuf); data = g_ptr_array_new (); |