[evolution-data-server] [IMAPx] Name CAMEL_IMAPX_ERROR codes



commit 954138c2c73646daf85db71f8d617798853313cb
Author: Milan Crha <mcrha redhat com>
Date:   Thu Aug 27 15:22:13 2015 +0200

    [IMAPx] Name CAMEL_IMAPX_ERROR codes
    
    There were used only direct numbers, instead of enum codes. It's easier
    to distinguish between malformed server response and other errors with
    the codes. For example, when the server returned malformed response for
    a GETQUOTAROOT, the IMAPx was reconnecting to the server again and again,
    instead of stopping and returning the error.

 camel/providers/imapx/camel-imapx-conn-manager.c   |    3 +-
 camel/providers/imapx/camel-imapx-input-stream.c   |   12 ++--
 camel/providers/imapx/camel-imapx-input-stream.h   |    6 ++
 camel/providers/imapx/camel-imapx-list-response.c  |   12 ++--
 .../imapx/camel-imapx-namespace-response.c         |   10 ++--
 camel/providers/imapx/camel-imapx-server.c         |   14 +++---
 .../providers/imapx/camel-imapx-status-response.c  |    6 +-
 camel/providers/imapx/camel-imapx-utils.c          |   52 ++++++++++----------
 8 files changed, 61 insertions(+), 54 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-conn-manager.c 
b/camel/providers/imapx/camel-imapx-conn-manager.c
index 9d612fb..15002e4 100644
--- a/camel/providers/imapx/camel-imapx-conn-manager.c
+++ b/camel/providers/imapx/camel-imapx-conn-manager.c
@@ -1016,7 +1016,8 @@ camel_imapx_conn_manager_run_job_sync (CamelIMAPXConnManager *conn_man,
                                camel_imapx_server_disconnect_sync (cinfo->is, cancellable, NULL);
                                imapx_conn_manager_remove_info (conn_man, cinfo);
 
-                               if (!local_error || local_error->domain == CAMEL_IMAPX_ERROR ||
+                               if (!local_error ||
+                                   g_error_matches (local_error, CAMEL_IMAPX_ERROR, 
CAMEL_IMAPX_ERROR_TRY_RECONNECT) ||
                                    g_error_matches (local_error, G_TLS_ERROR, G_TLS_ERROR_MISC) ||
                                    g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CLOSED)) {
                                        GError *tmp = local_error;
diff --git a/camel/providers/imapx/camel-imapx-input-stream.c 
b/camel/providers/imapx/camel-imapx-input-stream.c
index 8b1e8c8..8afb0a6 100644
--- a/camel/providers/imapx/camel-imapx-input-stream.c
+++ b/camel/providers/imapx/camel-imapx-input-stream.c
@@ -362,7 +362,7 @@ camel_imapx_input_stream_atom (CamelIMAPXInputStream *is,
 
                default:
                        g_set_error (
-                               error, CAMEL_IMAPX_ERROR, 1,
+                               error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                "expecting atom");
                        return FALSE;
        }
@@ -469,7 +469,7 @@ camel_imapx_input_stream_astring (CamelIMAPXInputStream *is,
 
                default:
                        g_set_error (
-                               error, CAMEL_IMAPX_ERROR, 1,
+                               error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                "expecting astring");
                        return FALSE;
        }
@@ -529,7 +529,7 @@ camel_imapx_input_stream_nstring (CamelIMAPXInputStream *is,
 
                default:
                        g_set_error (
-                               error, CAMEL_IMAPX_ERROR, 1,
+                               error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                "expecting nstring");
                        return FALSE;
        }
@@ -597,7 +597,7 @@ camel_imapx_input_stream_nstring_bytes (CamelIMAPXInputStream *is,
 
                default:
                        g_set_error (
-                               error, CAMEL_IMAPX_ERROR, 1,
+                               error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                "nstring: token not string");
                        return FALSE;
        }
@@ -629,7 +629,7 @@ camel_imapx_input_stream_number (CamelIMAPXInputStream *is,
 
                default:
                        g_set_error (
-                               error, CAMEL_IMAPX_ERROR, 1,
+                               error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                "expecting number");
                        return FALSE;
        }
@@ -880,7 +880,7 @@ protocol_error:
        else
                is->priv->ptr = p;
 
-       g_set_error (error, CAMEL_IMAPX_ERROR, 1, "protocol error");
+       g_set_error (error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED, "protocol error");
 
        return IMAPX_TOK_ERROR;
 }
diff --git a/camel/providers/imapx/camel-imapx-input-stream.h 
b/camel/providers/imapx/camel-imapx-input-stream.h
index cfd4778..af42369 100644
--- a/camel/providers/imapx/camel-imapx-input-stream.h
+++ b/camel/providers/imapx/camel-imapx-input-stream.h
@@ -49,6 +49,12 @@ typedef struct _CamelIMAPXInputStreamClass CamelIMAPXInputStreamClass;
 typedef struct _CamelIMAPXInputStreamPrivate CamelIMAPXInputStreamPrivate;
 
 typedef enum {
+       CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED = 1,
+       CAMEL_IMAPX_ERROR_IGNORE, /* may ignore such errors */
+       CAMEL_IMAPX_ERROR_TRY_RECONNECT
+} CamelIMAPXError;
+
+typedef enum {
        IMAPX_TOK_ERROR = -1,
        IMAPX_TOK_TOKEN = 256,
        IMAPX_TOK_STRING,
diff --git a/camel/providers/imapx/camel-imapx-list-response.c 
b/camel/providers/imapx/camel-imapx-list-response.c
index bfc607b..4ff31dc 100644
--- a/camel/providers/imapx/camel-imapx-list-response.c
+++ b/camel/providers/imapx/camel-imapx-list-response.c
@@ -147,7 +147,7 @@ imapx_list_response_parse_childinfo (CamelIMAPXInputStream *stream,
                goto fail;
        if (tok != '(') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "list childinfo: expecting ')'");
                goto fail;
        }
@@ -197,7 +197,7 @@ imapx_list_response_parse_oldname (CamelIMAPXInputStream *stream,
                goto fail;
        if (tok != '(') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "list oldname: expecting ')'");
                goto fail;
        }
@@ -214,7 +214,7 @@ imapx_list_response_parse_oldname (CamelIMAPXInputStream *stream,
                goto fail;
        if (tok != ')') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "list oldname: expecting ')'");
                goto fail;
        }
@@ -325,7 +325,7 @@ camel_imapx_list_response_new (CamelIMAPXInputStream *stream,
                goto fail;
        if (tok != '(') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "list: expecting '('");
                goto fail;
        }
@@ -343,7 +343,7 @@ camel_imapx_list_response_new (CamelIMAPXInputStream *stream,
                goto fail;
        if (tok != ')') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "list: expecting ')'");
                goto fail;
        }
@@ -414,7 +414,7 @@ extended_item_repeat:
 
        } else {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "list: expecting '(' or NEWLINE");
                goto fail;
        }
diff --git a/camel/providers/imapx/camel-imapx-namespace-response.c 
b/camel/providers/imapx/camel-imapx-namespace-response.c
index 18acd5d..219440f 100644
--- a/camel/providers/imapx/camel-imapx-namespace-response.c
+++ b/camel/providers/imapx/camel-imapx-namespace-response.c
@@ -117,7 +117,7 @@ imapx_namespace_response_parse_namespace (CamelIMAPXInputStream *stream,
        }
        if (tok != '(') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "namespace: expecting NIL or '('");
                return FALSE;
        }
@@ -129,7 +129,7 @@ repeat:
                return FALSE;
        if (tok != '(') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "namespace: expecting '('");
                return FALSE;
        }
@@ -140,7 +140,7 @@ repeat:
                return FALSE;
        if (tok != IMAPX_TOK_STRING) {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "namespace: expecting string");
                return FALSE;
        }
@@ -169,7 +169,7 @@ repeat:
                return FALSE;
        if (tok != ')') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "namespace: expecting ')'");
                return FALSE;
        }
@@ -184,7 +184,7 @@ repeat:
        }
        if (tok != ')') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "namespace: expecting '(' or ')'");
                return FALSE;
        }
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 71dfda6..99fb452 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -1873,7 +1873,7 @@ imapx_untagged (CamelIMAPXServer *is,
 
        if (is->priv->context->tok == '\n') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "truncated server response");
                goto exit;
        }
@@ -2133,7 +2133,7 @@ imapx_continuation (CamelIMAPXServer *is,
        default:
                /* should we just ignore? */
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "continuation response for non-continuation request");
                return FALSE;
        }
@@ -2202,7 +2202,7 @@ imapx_completion (CamelIMAPXServer *is,
 
        if (token[0] != is->priv->tagprefix) {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "Server sent unexpected response: %s", token);
                return FALSE;
        }
@@ -2220,7 +2220,7 @@ imapx_completion (CamelIMAPXServer *is,
 
        if (ic == NULL) {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "got response tag unexpectedly: %s", token);
                return FALSE;
        }
@@ -2253,7 +2253,7 @@ imapx_completion (CamelIMAPXServer *is,
 
        if (g_list_next (ic->current_part) != NULL) {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "command still has unsent parts? %s", camel_imapx_job_get_kind_name (ic->job_kind));
                goto exit;
        }
@@ -2326,7 +2326,7 @@ imapx_step (CamelIMAPXServer *is,
                        break;
                default:
                        g_set_error (
-                               error, CAMEL_IMAPX_ERROR, 1,
+                               error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                "unexpected server response:");
                        break;
        }
@@ -3671,7 +3671,7 @@ camel_imapx_server_process_command_sync (CamelIMAPXServer *is,
 
        if (output_stream == NULL) {
                local_error = g_error_new_literal (
-                       CAMEL_IMAPX_ERROR, 1,
+                       CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_TRY_RECONNECT,
                        _("Cannot issue command, no stream available"));
                goto exit;
        }
diff --git a/camel/providers/imapx/camel-imapx-status-response.c 
b/camel/providers/imapx/camel-imapx-status-response.c
index b2e4e46..3e1168b 100644
--- a/camel/providers/imapx/camel-imapx-status-response.c
+++ b/camel/providers/imapx/camel-imapx-status-response.c
@@ -134,7 +134,7 @@ camel_imapx_status_response_new (CamelIMAPXInputStream *stream,
                goto fail;
        if (tok != '(') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "status: expecting '('");
                goto fail;
        }
@@ -199,7 +199,7 @@ camel_imapx_status_response_new (CamelIMAPXInputStream *stream,
 
                        default:
                                g_set_error (
-                                       error, CAMEL_IMAPX_ERROR, 1,
+                                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                        "unknown status attribute");
                                success = FALSE;
                                break;
@@ -218,7 +218,7 @@ camel_imapx_status_response_new (CamelIMAPXInputStream *stream,
 
        if (tok != ')') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "status: expecting ')' or attribute");
                goto fail;
        }
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index e94c968..da51e65 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -124,7 +124,7 @@ imapx_parse_flags (CamelIMAPXInputStream *stream,
 
        if (tok != '(') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "expecting flag list");
                return FALSE;
        }
@@ -546,7 +546,7 @@ imapx_parse_capability (CamelIMAPXInputStream *stream,
                                break;
                        default:
                                g_set_error (
-                                       error, CAMEL_IMAPX_ERROR, 1,
+                                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                        "capability: expecting name");
                                break;
                }
@@ -864,7 +864,7 @@ imapx_parse_ext_optional (CamelIMAPXInputStream *stream,
                                if (!local_error)
                                        g_set_error (
                                                &local_error,
-                                               CAMEL_IMAPX_ERROR, 1,
+                                               CAMEL_IMAPX_ERROR, 
CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                                "expecting string");
                                goto done;
                        }
@@ -882,7 +882,7 @@ imapx_parse_ext_optional (CamelIMAPXInputStream *stream,
                        break;
                default:
                        g_set_error (
-                               error, CAMEL_IMAPX_ERROR, 1,
+                               error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                "body_fld_disp: expecting nil or list");
                        return NULL;
        }
@@ -907,7 +907,7 @@ imapx_parse_ext_optional (CamelIMAPXInputStream *stream,
                                        g_clear_error (&local_error);
                                        g_set_error (
                                                &local_error,
-                                               CAMEL_IMAPX_ERROR, 1,
+                                               CAMEL_IMAPX_ERROR, 
CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                                "expecting string");
                                        break;
                                }
@@ -1062,7 +1062,7 @@ imapx_parse_address_list (CamelIMAPXInputStream *stream,
                                g_clear_error (&local_error);
                                camel_header_address_list_clear (&list);
                                g_set_error (
-                                       error, CAMEL_IMAPX_ERROR, 1,
+                                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                        "missing '(' for address");
                                return NULL;
                        }
@@ -1177,7 +1177,7 @@ imapx_parse_envelope (CamelIMAPXInputStream *stream,
        if (tok != '(') {
                g_clear_error (&local_error);
                camel_message_info_unref (minfo);
-               g_set_error (error, CAMEL_IMAPX_ERROR, 1, "envelope: expecting '('");
+               g_set_error (error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED, 
"envelope: expecting '('");
                return NULL;
        }
 
@@ -1284,7 +1284,7 @@ imapx_parse_envelope (CamelIMAPXInputStream *stream,
        if (tok != ')') {
                g_clear_error (&local_error);
                camel_message_info_unref (minfo);
-               g_set_error (error, CAMEL_IMAPX_ERROR, 1, "expecting ')'");
+               g_set_error (error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED, 
"expecting ')'");
                return NULL;
        }
 
@@ -1319,7 +1319,7 @@ imapx_parse_body (CamelIMAPXInputStream *stream,
                stream, &token, &len, cancellable, &local_error);
        if (tok != '(') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "body: expecting '('");
                return NULL;
        }
@@ -1555,7 +1555,7 @@ imapx_parse_section (CamelIMAPXInputStream *stream,
 
        if (tok != '[') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "section: expecting '['");
                return NULL;
        }
@@ -1570,7 +1570,7 @@ imapx_parse_section (CamelIMAPXInputStream *stream,
                camel_imapx_input_stream_ungettoken (stream, tok, token, len);
        } else {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "section: expecting token");
                return NULL;
        }
@@ -1591,7 +1591,7 @@ imapx_parse_section (CamelIMAPXInputStream *stream,
                                /* ?do something? */
                        } else if (tok != ')') {
                                g_set_error (
-                                       error, CAMEL_IMAPX_ERROR, 1,
+                                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                        "section: header fields: expecting string");
                                g_free (section);
                                return NULL;
@@ -1604,7 +1604,7 @@ imapx_parse_section (CamelIMAPXInputStream *stream,
 
        if (tok != ']') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "section: expecting ']'");
                g_free (section);
                return NULL;
@@ -1632,7 +1632,7 @@ imapx_parse_modseq (CamelIMAPXInputStream *stream,
 
        if (tok != '(') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "fetch: expecting '('");
                return 0;
        }
@@ -1651,7 +1651,7 @@ imapx_parse_modseq (CamelIMAPXInputStream *stream,
 
        if (tok != ')') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "fetch: expecting '('");
                return 0;
        }
@@ -1808,7 +1808,7 @@ imapx_parse_fetch_body (CamelIMAPXInputStream *stream,
        }
 
        g_set_error (
-               error, CAMEL_IMAPX_ERROR, 1,
+               error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                "unknown body response");
 
        return FALSE;
@@ -1979,7 +1979,7 @@ imapx_parse_fetch_uid (CamelIMAPXInputStream *stream,
 
        if (tok != IMAPX_TOK_INT) {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "uid not integer");
                return FALSE;
        }
@@ -2010,7 +2010,7 @@ imapx_parse_fetch (CamelIMAPXInputStream *stream,
 
        if (tok != '(') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "fetch: expecting '('");
                goto fail;
        }
@@ -2078,7 +2078,7 @@ imapx_parse_fetch (CamelIMAPXInputStream *stream,
 
                        default:
                                g_set_error (
-                                       error, CAMEL_IMAPX_ERROR, 1,
+                                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                        "unknown body response");
                                break;
                }
@@ -2095,7 +2095,7 @@ imapx_parse_fetch (CamelIMAPXInputStream *stream,
 
        if (tok != ')') {
                g_set_error (
-                       error, CAMEL_IMAPX_ERROR, 1,
+                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                        "missing closing ')' on fetch response");
                goto fail;
        }
@@ -2129,7 +2129,7 @@ imapx_parse_uids (CamelIMAPXInputStream *stream,
                return NULL;
 
        if (!token) {
-               g_set_error (error, CAMEL_IMAPX_ERROR, 2, "server response truncated");
+               g_set_error (error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_IGNORE, "server response truncated");
                return NULL;
        }
 
@@ -2224,7 +2224,7 @@ imapx_parse_status_copyuid (CamelIMAPXInputStream *stream,
                   B00083 OK [COPYUID 4154  ] COPY completed.
                   Just ignore such server error.
                */
-               if (g_error_matches (local_error, CAMEL_IMAPX_ERROR, 2)) {
+               if (g_error_matches (local_error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_IGNORE)) {
                        g_clear_error (&local_error);
                        return TRUE;
                }
@@ -2239,7 +2239,7 @@ imapx_parse_status_copyuid (CamelIMAPXInputStream *stream,
 
        uids = imapx_parse_uids (stream, cancellable, error);
        if (uids == NULL) {
-               if (g_error_matches (local_error, CAMEL_IMAPX_ERROR, 2)) {
+               if (g_error_matches (local_error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_IGNORE)) {
                        g_clear_error (&local_error);
                        return TRUE;
                }
@@ -2426,7 +2426,7 @@ imapx_parse_status (CamelIMAPXInputStream *stream,
                        break;
                default:
                        g_set_error (
-                               error, CAMEL_IMAPX_ERROR, 1,
+                               error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                "expecting OK/NO/BAD");
                        goto fail;
        }
@@ -2536,7 +2536,7 @@ imapx_parse_status (CamelIMAPXInputStream *stream,
                                stream, &token, &len, cancellable, NULL);
                        if (tok == '\n' || tok < 0) {
                                g_set_error (
-                                       error, CAMEL_IMAPX_ERROR, 1,
+                                       error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                        "server response truncated");
                                goto fail;
                        }
@@ -2969,7 +2969,7 @@ camel_imapx_parse_quota (CamelIMAPXInputStream *stream,
                        break;
                default:
                        g_set_error (
-                               error, CAMEL_IMAPX_ERROR, 1,
+                               error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_SERVER_RESPONSE_MALFORMED,
                                "quota_response: expecting '('");
                        goto fail;
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]