--- camel-imapx-server.c~ 2010-06-11 01:46:46.200626348 +0100 +++ camel-imapx-server.c 2010-06-11 09:38:10.520319460 +0100 @@ -52,8 +52,8 @@ #include "camel-imapx-store.h" #include "camel-imapx-summary.h" -#define c(x) -#define e(x) +#define c(x) x +#define e(x) x #define CFS_CLASS(x) ((CamelFolderSummaryClass *)((CamelObject *)x)->klass) @@ -620,7 +620,7 @@ imapx_command_addv(CamelIMAPXCommand *ic break; case 'f': /* imap folder name */ folder = va_arg(ap, CamelFolder *); - c(printf("got folder '%s'\n", s)); + c(printf("got folder '%s'\n", folder->full_name)); fname = camel_imapx_store_summary_full_from_path(((CamelIMAPXStore *) folder->parent_store)->summary, folder->full_name); if (fname) { encoded = camel_utf8_utf7(fname); @@ -1490,10 +1490,14 @@ imapx_continuation(CamelIMAPXServer *ima case CAMEL_IMAPX_COMMAND_AUTH: { gchar *resp; guchar *token; - gint tok; guint len; - tok = camel_imapx_stream_token(imap->stream, &token, &len, ex); + camel_imapx_stream_gets (imap->stream, &token, &len); + token[len] = 0; + while (*token == ' ') + token++; + + printf("token is '%s'\n", token); resp = camel_sasl_challenge_base64((CamelSasl *)cp->ob, (const gchar *) token, ex); if (camel_exception_is_set(ex)) return -1; @@ -1505,7 +1509,7 @@ imapx_continuation(CamelIMAPXServer *ima /* we want to keep getting called until we get a status reponse from the server ignore what sasl tells us */ newliteral = ic; - + goto noskip; break; } case CAMEL_IMAPX_COMMAND_FILE: { CamelStream *file; @@ -1531,7 +1535,7 @@ imapx_continuation(CamelIMAPXServer *ima } camel_imapx_stream_skip(imap->stream, ex); - + noskip: cp = cp->next; if (cp->next) { ic->current = cp; @@ -2438,6 +2442,31 @@ imapx_reconnect (CamelIMAPXServer *is, C if (is->state == IMAPX_AUTHENTICATED) break; +#if 0 + if (service->url->authmech) { + if (!g_hash_table_lookup (store->authtypes, service->url->authmech)) { + camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, + _("IMAP server %s does not support requested " + "authentication type %s"), + service->url->host, + service->url->authmech); + return FALSE; + } + authtype = camel_sasl_authtype (service->url->authmech); + if (!authtype) { + camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, + _("No support for authentication type %s"), + service->url->authmech); + return FALSE; + } + + if (!authtype->need_password) { + authenticated = try_auth (store, authtype->authproto, ex); + if (!authenticated) + return FALSE; + } + } +#endif if (service->url->passwd == NULL) { gchar *base_prompt; gchar *full_prompt; @@ -2468,7 +2497,7 @@ imapx_reconnect (CamelIMAPXServer *is, C } if (service->url->authmech - && (sasl = camel_sasl_new("imap", service->url->authmech, NULL))) { + && (sasl = camel_sasl_new("imap", service->url->authmech, (CamelService *)is->store))) { ic = camel_imapx_command_new("AUTHENTICATE", NULL, "AUTHENTICATE %A", sasl); camel_object_unref(sasl); } else {