[evolution-data-server] IMAPX: Recognize RFC 5530 response codes.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] IMAPX: Recognize RFC 5530 response codes.
- Date: Thu, 2 May 2013 23:39:58 +0000 (UTC)
commit c6a76b8d21ffb88260e8d42bde19a8af1ea3882f
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu May 2 19:34:37 2013 -0400
IMAPX: Recognize RFC 5530 response codes.
camel/camel-imapx-command.c | 12 +++++
camel/camel-imapx-tokens.txt | 99 ++++++++++++++++++++++++-----------------
camel/camel-imapx-utils.c | 21 +++++++++
camel/camel-imapx-utils.h | 20 ++++++++
4 files changed, 111 insertions(+), 41 deletions(-)
---
diff --git a/camel/camel-imapx-command.c b/camel/camel-imapx-command.c
index e1ebf00..0226db6 100644
--- a/camel/camel-imapx-command.c
+++ b/camel/camel-imapx-command.c
@@ -586,6 +586,18 @@ camel_imapx_command_set_error_if_failed (CamelIMAPXCommand *ic,
g_return_val_if_fail (CAMEL_IS_IMAPX_COMMAND (ic), FALSE);
if (ic->status != NULL && ic->status->result != IMAPX_OK) {
+
+ /* FIXME Map IMAP response codes to more
+ * meaningful GError domains/codes.
+ *
+ * switch (ic->status->condition) {
+ * case IMAPX_AUTHENTICATIONFAILED:
+ * g_set_error (...);
+ * break;
+ * ...
+ * }
+ */
+
if (ic->status->text != NULL)
g_set_error (
error, CAMEL_IMAPX_ERROR, 1,
diff --git a/camel/camel-imapx-tokens.txt b/camel/camel-imapx-tokens.txt
index d485018..ed278bd 100644
--- a/camel/camel-imapx-tokens.txt
+++ b/camel/camel-imapx-tokens.txt
@@ -3,44 +3,61 @@
struct _imapx_keyword {const gchar *name; camel_imapx_id_t id; };
struct _imapx_keyword *imapx_tokenise_struct (register const char *str, register unsigned int len);
%%
-ALERT, IMAPX_ALERT
-APPENDUID, IMAPX_APPENDUID
-BAD, IMAPX_BAD
-BODY, IMAPX_BODY
-BODYSTRUCTURE, IMAPX_BODYSTRUCTURE
-BYE, IMAPX_BYE
-CAPABILITY, IMAPX_CAPABILITY
-COPYUID, IMAPX_COPYUID
-CLOSED, IMAPX_CLOSED
-ENVELOPE, IMAPX_ENVELOPE
-EXISTS, IMAPX_EXISTS
-EXPUNGE, IMAPX_EXPUNGE
-FETCH, IMAPX_FETCH
-FLAGS, IMAPX_FLAGS
-HIGHESTMODSEQ, IMAPX_HIGHESTMODSEQ
-INTERNALDATE, IMAPX_INTERNALDATE
-LIST, IMAPX_LIST
-LSUB, IMAPX_LSUB
-MESSAGES, IMAPX_MESSAGES
-MODSEQ, IMAPX_MODSEQ
-NAMESPACE, IMAPX_NAMESPACE
-NEWNAME, IMAPX_NEWNAME
-NO, IMAPX_NO
-NOMODSEQ, IMAPX_NOMODSEQ
-OK, IMAPX_OK
-PARSE, IMAPX_PARSE
-PERMANENTFLAGS, IMAPX_PERMANENTFLAGS
-PREAUTH, IMAPX_PREAUTH
-READ-ONLY, IMAPX_READ_ONLY
-READ-WRITE, IMAPX_READ_WRITE
-RECENT, IMAPX_RECENT
-RFC822.HEADER, IMAPX_RFC822_HEADER
-RFC822.SIZE, IMAPX_RFC822_SIZE
-RFC822.TEXT, IMAPX_RFC822_TEXT
-STATUS, IMAPX_STATUS
-TRYCREATE, IMAPX_TRYCREATE
-UID, IMAPX_UID
-UIDVALIDITY, IMAPX_UIDVALIDITY
-UNSEEN, IMAPX_UNSEEN
-UIDNEXT, IMAPX_UIDNEXT
-VANISHED, IMAPX_VANISHED
+ALERT, IMAPX_ALERT
+ALREADYEXISTS, IMAPX_ALREADYEXISTS
+AUTHENTICATIONFAILED, IMAPX_AUTHENTICATIONFAILED
+AUTHORIZATIONFAILED, IMAPX_AUTHORIZATIONFAILED
+APPENDUID, IMAPX_APPENDUID
+BAD, IMAPX_BAD
+BODY, IMAPX_BODY
+BODYSTRUCTURE, IMAPX_BODYSTRUCTURE
+BYE, IMAPX_BYE
+CANNOT, IMAPX_CANNOT
+CAPABILITY, IMAPX_CAPABILITY
+CLIENTBUG, IMAPX_CLIENTBUG
+CONTACTADMIN, IMAPX_CONTACTADMIN
+COPYUID, IMAPX_COPYUID
+CORRUPTION, IMAPX_CORRUPTION
+CLOSED, IMAPX_CLOSED
+ENVELOPE, IMAPX_ENVELOPE
+EXISTS, IMAPX_EXISTS
+EXPIRED, IMAPX_EXPIRED
+EXPUNGE, IMAPX_EXPUNGE
+EXPUNGEISSUED, IMAPX_EXPUNGEISSUED
+FETCH, IMAPX_FETCH
+FLAGS, IMAPX_FLAGS
+HIGHESTMODSEQ, IMAPX_HIGHESTMODSEQ
+INTERNALDATE, IMAPX_INTERNALDATE
+INUSE, IMAPX_INUSE
+LIMIT, IMAPX_LIMIT
+LIST, IMAPX_LIST
+LSUB, IMAPX_LSUB
+MESSAGES, IMAPX_MESSAGES
+MODSEQ, IMAPX_MODSEQ
+NAMESPACE, IMAPX_NAMESPACE
+NEWNAME, IMAPX_NEWNAME
+NO, IMAPX_NO
+NOMODSEQ, IMAPX_NOMODSEQ
+NONEXISTENT, IMAPX_NONEXISTENT
+NOPERM, IMAPX_NOPERM
+OK, IMAPX_OK
+OVERQUOTA, IMAPX_OVERQUOTA
+PARSE, IMAPX_PARSE
+PERMANENTFLAGS, IMAPX_PERMANENTFLAGS
+PREAUTH, IMAPX_PREAUTH
+PRIVACYREQUIRED, IMAPX_PRIVACYREQUIRED
+READ-ONLY, IMAPX_READ_ONLY
+READ-WRITE, IMAPX_READ_WRITE
+RECENT, IMAPX_RECENT
+RFC822.HEADER, IMAPX_RFC822_HEADER
+RFC822.SIZE, IMAPX_RFC822_SIZE
+RFC822.TEXT, IMAPX_RFC822_TEXT
+SERVERBUG, IMAPX_SERVERBUG
+STATUS, IMAPX_STATUS
+TRYCREATE, IMAPX_TRYCREATE
+UID, IMAPX_UID
+UIDVALIDITY, IMAPX_UIDVALIDITY
+UNAVAILABLE, IMAPX_UNAVAILABLE
+UNSEEN, IMAPX_UNSEEN
+UIDNEXT, IMAPX_UIDNEXT
+VANISHED, IMAPX_VANISHED
diff --git a/camel/camel-imapx-utils.c b/camel/camel-imapx-utils.c
index 4007fbc..fcf2f5a 100644
--- a/camel/camel-imapx-utils.c
+++ b/camel/camel-imapx-utils.c
@@ -1834,6 +1834,27 @@ imapx_parse_status (CamelIMAPXStream *is,
case IMAPX_CAPABILITY:
sinfo->u.cinfo = imapx_parse_capability (is, cancellable, NULL);
break;
+
+ /* RFC 5530 Response Codes */
+ case IMAPX_ALREADYEXISTS:
+ case IMAPX_AUTHENTICATIONFAILED:
+ case IMAPX_AUTHORIZATIONFAILED:
+ case IMAPX_CANNOT:
+ case IMAPX_CLIENTBUG:
+ case IMAPX_CONTACTADMIN:
+ case IMAPX_CORRUPTION:
+ case IMAPX_EXPIRED:
+ case IMAPX_EXPUNGEISSUED:
+ case IMAPX_INUSE:
+ case IMAPX_LIMIT:
+ case IMAPX_NONEXISTENT:
+ case IMAPX_NOPERM:
+ case IMAPX_OVERQUOTA:
+ case IMAPX_PRIVACYREQUIRED:
+ case IMAPX_SERVERBUG:
+ case IMAPX_UNAVAILABLE:
+ break;
+
default:
sinfo->condition = IMAPX_UNKNOWN;
d (is->tagprefix, "Got unknown response code: %s: ignored\n", token);
diff --git a/camel/camel-imapx-utils.h b/camel/camel-imapx-utils.h
index 75f4fdb..9099843 100644
--- a/camel/camel-imapx-utils.h
+++ b/camel/camel-imapx-utils.h
@@ -36,6 +36,7 @@ struct _CamelIMAPXStore;
/* list of strings we know about that can be *quickly* tokenised */
typedef enum _camel_imapx_id_t {
IMAPX_UNKNOWN = 0,
+
IMAPX_ALERT,
IMAPX_APPENDUID,
IMAPX_BAD,
@@ -77,6 +78,25 @@ typedef enum _camel_imapx_id_t {
IMAPX_UNSEEN,
IMAPX_UIDNEXT,
IMAPX_VANISHED,
+
+ /* RFC 5530: IMAP Response Codes */
+ IMAPX_ALREADYEXISTS,
+ IMAPX_AUTHENTICATIONFAILED,
+ IMAPX_AUTHORIZATIONFAILED,
+ IMAPX_CANNOT,
+ IMAPX_CLIENTBUG,
+ IMAPX_CONTACTADMIN,
+ IMAPX_CORRUPTION,
+ IMAPX_EXPIRED,
+ IMAPX_EXPUNGEISSUED,
+ IMAPX_INUSE,
+ IMAPX_LIMIT,
+ IMAPX_NONEXISTENT,
+ IMAPX_NOPERM,
+ IMAPX_OVERQUOTA,
+ IMAPX_PRIVACYREQUIRED,
+ IMAPX_SERVERBUG,
+ IMAPX_UNAVAILABLE
} camel_imapx_id_t;
#define CAMEL_IMAPX_UNTAGGED_BAD "BAD"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]