diff options
Diffstat (limited to 'camel/providers/imap4')
-rw-r--r-- | camel/providers/imap4/camel-imap4-command.c | 16 | ||||
-rw-r--r-- | camel/providers/imap4/camel-imap4-engine.c | 6 | ||||
-rw-r--r-- | camel/providers/imap4/camel-imap4-store.c | 8 |
3 files changed, 22 insertions, 8 deletions
diff --git a/camel/providers/imap4/camel-imap4-command.c b/camel/providers/imap4/camel-imap4-command.c index c1ff3a289b..dc3d43c5d4 100644 --- a/camel/providers/imap4/camel-imap4-command.c +++ b/camel/providers/imap4/camel-imap4-command.c @@ -494,7 +494,7 @@ camel_imap4_command_step (CamelIMAP4Command *ic) if (ic->part == ic->parts) { ic->tag = g_strdup_printf ("%c%.5u", engine->tagprefix, engine->tag++); camel_stream_printf (engine->ostream, "%s ", ic->tag); - d(fprintf (stderr, "sending : %s ", ic->tag)); + d(fprintf (stderr, "sending: %s ", ic->tag)); } #if d(!)0 @@ -514,7 +514,7 @@ camel_imap4_command_step (CamelIMAP4Command *ic) eoln++; if (sending) - fwrite ("sending : ", 1, 10, stderr); + fwrite ("sending: ", 1, 10, stderr); fwrite (linebuf, 1, eoln - linebuf, stderr); linebuf = eoln + 1; @@ -526,11 +526,19 @@ camel_imap4_command_step (CamelIMAP4Command *ic) linebuf = ic->part->buffer; len = ic->part->buflen; - if ((nwritten = camel_stream_write (engine->ostream, linebuf, len)) == -1) + if ((nwritten = camel_stream_write (engine->ostream, linebuf, len)) == -1) { + camel_exception_setv (&ic->ex, CAMEL_EXCEPTION_SYSTEM, + _("Failed sending command to IMAP server %s: %s"), + engine->url->host, g_strerror (errno)); goto exception; + } - if (camel_stream_flush (engine->ostream) == -1) + if (camel_stream_flush (engine->ostream) == -1) { + camel_exception_setv (&ic->ex, CAMEL_EXCEPTION_SYSTEM, + _("Failed sending command to IMAP server %s: %s"), + engine->url->host, g_strerror (errno)); goto exception; + } /* now we need to read the response(s) from the IMAP4 server */ diff --git a/camel/providers/imap4/camel-imap4-engine.c b/camel/providers/imap4/camel-imap4-engine.c index a84ac1dfba..be4a7e8c02 100644 --- a/camel/providers/imap4/camel-imap4-engine.c +++ b/camel/providers/imap4/camel-imap4-engine.c @@ -229,7 +229,8 @@ camel_imap4_engine_take_stream (CamelIMAP4Engine *engine, CamelStream *stream, C if ((code = camel_imap4_engine_handle_untagged_1 (engine, &token, ex)) == -1) { goto exception; } else if (code != CAMEL_IMAP4_UNTAGGED_OK && code != CAMEL_IMAP4_UNTAGGED_PREAUTH) { - /* FIXME: set an error? */ + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Unexpected greeting from IMAP server %s."), + engine->url->host); goto exception; } @@ -268,7 +269,10 @@ camel_imap4_engine_capability (CamelIMAP4Engine *engine, CamelException *ex) while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1) ; + fprintf (stderr, "id = %d; status = %d\n", id, ic->status); + if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE) { + fprintf (stderr, "exception: %s\n", ic->ex.desc); camel_exception_xfer (ex, &ic->ex); retval = -1; } diff --git a/camel/providers/imap4/camel-imap4-store.c b/camel/providers/imap4/camel-imap4-store.c index 85ae32407a..8e228be71a 100644 --- a/camel/providers/imap4/camel-imap4-store.c +++ b/camel/providers/imap4/camel-imap4-store.c @@ -773,11 +773,14 @@ imap4_create_folder (CamelStore *store, const char *parent_name, const char *fol char *utf7_name; const char *c; char *name; + char sep; int id; + sep = imap4_get_path_delim (engine, parent_name); + c = folder_name; while (*c != '\0') { - if (*c == store->dir_sep || strchr ("#%*", *c)) { + if (*c == sep || strchr ("/#%*", *c)) { camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_PATH, _("The folder name \"%s\" is invalid because " "it contains the character \"%c\""), @@ -959,12 +962,11 @@ imap4_build_folder_info (CamelIMAP4Engine *engine, guint32 flags, GPtrArray *arr p++; } + p = strrchr (name, '/'); camel_url_set_fragment (url, name); fi->full_name = name; - p = strrchr (name, '/'); fi->name = g_strdup (p ? p + 1: name); - fi->path = g_strdup_printf ("/%s", name); fi->uri = camel_url_to_string (url, 0); fi->flags = list->flags; |