diff options
author | Jeffrey Stedfast <fejj@novell.com> | 2004-06-11 03:47:46 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-06-11 03:47:46 +0800 |
commit | d46d24e504b30b8b9f7b1045c5a2d252b9daf1d4 (patch) | |
tree | b8ec8d986d2edf5af609cdbe3a74c98be1d8e248 /camel/providers/imap4/camel-imap4-engine.c | |
parent | b1c7fda1bcdb890774764aa8dbf7be1581eadc76 (diff) | |
download | gsoc2013-evolution-d46d24e504b30b8b9f7b1045c5a2d252b9daf1d4.tar.gz gsoc2013-evolution-d46d24e504b30b8b9f7b1045c5a2d252b9daf1d4.tar.zst gsoc2013-evolution-d46d24e504b30b8b9f7b1045c5a2d252b9daf1d4.zip |
If flags does not include FOLDER_INFO_FAST, get the total/unread counts
2004-06-10 Jeffrey Stedfast <fejj@novell.com>
* providers/imap4/camel-imap4-store.c (imap4_build_folder_info):
If flags does not include FOLDER_INFO_FAST, get the total/unread
counts for the folder-info.
* providers/imap4/camel-imap4-engine.c (engine_parse_status):
Removed.
(camel_imap4_engine_handle_untagged_1): Don't handle untagged
STATUS responses anymore. Let the STATUS requestor handle them
instead.
* providers/imap4/camel-imap4-utils.c
(camel_imap4_untagged_status): New function to parse untagged
status events.
svn path=/trunk/; revision=26291
Diffstat (limited to 'camel/providers/imap4/camel-imap4-engine.c')
-rw-r--r-- | camel/providers/imap4/camel-imap4-engine.c | 164 |
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) |