aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap4/camel-imap4-engine.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers/imap4/camel-imap4-engine.c')
-rw-r--r--camel/providers/imap4/camel-imap4-engine.c164
1 files changed, 0 insertions, 164 deletions
diff --git a/camel/providers/imap4/camel-imap4-engine.c b/camel/providers/imap4/camel-imap4-engine.c
index 73d3136152..059c7dbe22 100644
--- a/camel/providers/imap4/camel-imap4-engine.c
+++ b/camel/providers/imap4/camel-imap4-engine.c
@@ -558,162 +558,6 @@ engine_parse_flags (CamelIMAP4Engine *engine, CamelException *ex)
return 0;
}
-
-enum {
- IMAP4_STATUS_MESSAGES,
- IMAP4_STATUS_RECENT,
- IMAP4_STATUS_UIDNEXT,
- IMAP4_STATUS_UIDVALIDITY,
- IMAP4_STATUS_UNSEEN,
- IMAP4_STATUS_UNKNOWN
-};
-
-static struct {
- const char *name;
- int type;
-} imap4_status[] = {
- { "MESSAGES", IMAP4_STATUS_MESSAGES },
- { "RECENT", IMAP4_STATUS_RECENT },
- { "UIDNEXT", IMAP4_STATUS_UIDNEXT },
- { "UIDVALIDITY", IMAP4_STATUS_UIDVALIDITY },
- { "UNSEEN", IMAP4_STATUS_UNSEEN },
- { NULL, IMAP4_STATUS_UNKNOWN },
-};
-
-static int
-engine_parse_status (CamelIMAP4Engine *engine, CamelException *ex)
-{
- camel_imap4_token_t token;
- char *mailbox;
- size_t len;
- int type;
-
- if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
- return -1;
-
- switch (token.token) {
- case CAMEL_IMAP4_TOKEN_ATOM:
- mailbox = g_strdup (token.v.atom);
- break;
- case CAMEL_IMAP4_TOKEN_QSTRING:
- mailbox = g_strdup (token.v.qstring);
- break;
- case CAMEL_IMAP4_TOKEN_LITERAL:
- if (camel_imap4_engine_literal (engine, (unsigned char **) &mailbox, &len, ex) == -1)
- return -1;
- break;
- default:
- fprintf (stderr, "Unexpected token in IMAP4 untagged STATUS response: %s%c\n",
- token.token == CAMEL_IMAP4_TOKEN_NIL ? "NIL" : "",
- (unsigned char) (token.token & 0xff));
- camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
- return -1;
- }
-
- if (camel_imap4_engine_next_token (engine, &token, ex) == -1) {
- g_free (mailbox);
- return -1;
- }
-
- if (token.token != '(') {
- d(fprintf (stderr, "Expected to find a '(' token after the mailbox token in the STATUS response\n"));
- camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
- g_free (mailbox);
- return -1;
- }
-
- if (camel_imap4_engine_next_token (engine, &token, ex) == -1) {
- g_free (mailbox);
- return -1;
- }
-
- while (token.token == CAMEL_IMAP4_TOKEN_ATOM) {
- const unsigned char *inptr;
- unsigned int v = 0;
-
- /* parse the status messages list */
- for (type = 0; imap4_status[type].name; type++) {
- if (!strcasecmp (imap4_status[type].name, token.v.atom))
- break;
- }
-
- if (type == IMAP4_STATUS_UNKNOWN)
- fprintf (stderr, "unrecognized token in STATUS list: %s\n", token.v.atom);
-
- if (camel_imap4_engine_next_token (engine, &token, ex) == -1) {
- g_free (mailbox);
- return -1;
- }
-
- if (token.token != CAMEL_IMAP4_TOKEN_ATOM)
- break;
-
- if (type == IMAP4_STATUS_UIDNEXT || type == IMAP4_STATUS_UIDVALIDITY) {
- /* these tokens should be numeric, but we
- * treat them as strings internally so we are
- * special-casing them here */
-
- /* FIXME: save the UIDNEXT/UIDVALIDITY value */
- } else {
- inptr = (const unsigned char *) token.v.atom;
- while (*inptr && isdigit ((int) *inptr) && v < (UINT_MAX / 10))
- v = (v * 10) + (*inptr++ - '0');
-
- if (*inptr != '\0') {
- if (type == IMAP4_STATUS_UNKNOWN) {
- /* we'll let it slide... unget this token and continue */
- camel_imap4_stream_unget_token (engine->istream, &token);
- goto loop;
- }
-
- d(fprintf (stderr, "Encountered non-numeric token after %s in untagged STATUS response: %s\n",
- imap4_status[type].name, token.v.atom));
- goto loop;
- }
-
- switch (type) {
- case IMAP4_STATUS_MESSAGES:
- /* FIXME: save value */
- break;
- case IMAP4_STATUS_RECENT:
- /* FIXME: save value */
- break;
- case IMAP4_STATUS_UNSEEN:
- /* FIXME: save value */
- break;
- default:
- g_assert_not_reached ();
- }
- }
-
- loop:
- if (camel_imap4_engine_next_token (engine, &token, ex) == -1) {
- g_free (mailbox);
- return -1;
- }
- }
-
- /* don't need this anymore... */
- g_free (mailbox);
-
- if (token.token != ')') {
- d(fprintf (stderr, "Expected to find a ')' token terminating the untagged STATUS response\n"));
- camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
- return -1;
- }
-
- if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
- return -1;
-
- if (token.token != '\n') {
- d(fprintf (stderr, "Expected to find a '\\n' token after the STATUS response\n"));
- camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
- return -1;
- }
-
- return 0;
-}
-
static int
engine_parse_namespace (CamelIMAP4Engine *engine, CamelException *ex)
{
@@ -1212,14 +1056,6 @@ camel_imap4_engine_handle_untagged_1 (CamelIMAP4Engine *engine, camel_imap4_toke
if (camel_imap4_engine_parse_resp_code (engine, ex) == -1)
return -1;
- } else if (!strcmp ("STATUS", token->v.atom)) {
- /* FIXME: This should probably be removed... leave it
- * up to the caller that sent the STATUS command to
- * register an untagged response handler for this */
-
- /* next token must be the mailbox name followed by a paren list */
- if (engine_parse_status (engine, ex) == -1)
- return -1;
} else if (ic && (untagged = g_hash_table_lookup (ic->untagged, token->v.atom))) {
/* registered untagged handler for imap4 command */
if (untagged (engine, ic, 0, token, ex) == -1)