evolution-data-server r8755 - trunk/camel/providers/imap4
- From: fejj svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r8755 - trunk/camel/providers/imap4
- Date: Wed, 7 May 2008 02:20:18 +0100 (BST)
Author: fejj
Date: Wed May 7 01:20:17 2008
New Revision: 8755
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8755&view=rev
Log:
reverted mbarnes' rev 8210 commit which changed all whitespace
Modified:
trunk/camel/providers/imap4/camel-imap4-engine.c
trunk/camel/providers/imap4/camel-imap4-engine.h
trunk/camel/providers/imap4/camel-imap4-folder.h
trunk/camel/providers/imap4/camel-imap4-journal.c
trunk/camel/providers/imap4/camel-imap4-journal.h
trunk/camel/providers/imap4/camel-imap4-provider.c
trunk/camel/providers/imap4/camel-imap4-search.c
trunk/camel/providers/imap4/camel-imap4-search.h
trunk/camel/providers/imap4/camel-imap4-specials.c
trunk/camel/providers/imap4/camel-imap4-store-summary.c
trunk/camel/providers/imap4/camel-imap4-store-summary.h
trunk/camel/providers/imap4/camel-imap4-store.c
trunk/camel/providers/imap4/camel-imap4-store.h
trunk/camel/providers/imap4/camel-imap4-stream.c
trunk/camel/providers/imap4/camel-imap4-stream.h
trunk/camel/providers/imap4/camel-imap4-summary.h
Modified: trunk/camel/providers/imap4/camel-imap4-engine.c
==============================================================================
--- trunk/camel/providers/imap4/camel-imap4-engine.c (original)
+++ trunk/camel/providers/imap4/camel-imap4-engine.c Wed May 7 01:20:17 2008
@@ -58,7 +58,7 @@
camel_imap4_engine_get_type (void)
{
static CamelType type = 0;
-
+
if (!type) {
type = camel_type_register (camel_object_get_type (),
"CamelIMAP4Engine",
@@ -69,7 +69,7 @@
(CamelObjectInitFunc) camel_imap4_engine_init,
(CamelObjectFinalizeFunc) camel_imap4_engine_finalize);
}
-
+
return type;
}
@@ -77,7 +77,7 @@
camel_imap4_engine_class_init (CamelIMAP4EngineClass *klass)
{
parent_class = camel_type_get_global_classfuncs (CAMEL_OBJECT_TYPE);
-
+
klass->tagprefix = 'A';
}
@@ -86,36 +86,36 @@
{
engine->state = CAMEL_IMAP4_ENGINE_DISCONNECTED;
engine->level = CAMEL_IMAP4_LEVEL_UNKNOWN;
-
+
engine->session = NULL;
engine->service = NULL;
engine->url = NULL;
-
+
engine->istream = NULL;
engine->ostream = NULL;
-
+
engine->authtypes = g_hash_table_new (g_str_hash, g_str_equal);
-
+
engine->capa = 0;
-
+
/* this is the suggested default, impacts the max command line length we'll send */
engine->maxlentype = CAMEL_IMAP4_ENGINE_MAXLEN_LINE;
engine->maxlen = 1000;
-
+
engine->namespaces.personal = NULL;
engine->namespaces.other = NULL;
engine->namespaces.shared = NULL;
-
+
if (klass->tagprefix > 'Z')
klass->tagprefix = 'A';
-
+
engine->tagprefix = klass->tagprefix++;
engine->tag = 0;
-
+
engine->nextid = 1;
-
+
engine->folder = NULL;
-
+
e_dlist_init (&engine->queue);
}
@@ -124,27 +124,27 @@
{
CamelIMAP4Engine *engine = (CamelIMAP4Engine *) object;
EDListNode *node;
-
+
if (engine->istream)
camel_object_unref (engine->istream);
-
+
if (engine->ostream)
camel_object_unref (engine->ostream);
-
+
g_hash_table_foreach (engine->authtypes, (GHFunc) g_free, NULL);
g_hash_table_destroy (engine->authtypes);
-
+
camel_imap4_namespace_clear (&engine->namespaces.personal);
camel_imap4_namespace_clear (&engine->namespaces.other);
camel_imap4_namespace_clear (&engine->namespaces.shared);
-
+
if (engine->folder)
camel_object_unref (engine->folder);
-
+
while ((node = e_dlist_remhead (&engine->queue))) {
node->next = NULL;
node->prev = NULL;
-
+
camel_imap4_command_unref ((CamelIMAP4Command *) node);
}
}
@@ -161,15 +161,15 @@
camel_imap4_engine_new (CamelService *service, CamelIMAP4ReconnectFunc reconnect)
{
CamelIMAP4Engine *engine;
-
+
g_return_val_if_fail (CAMEL_IS_SERVICE (service), NULL);
-
+
engine = (CamelIMAP4Engine *) camel_object_new (CAMEL_TYPE_IMAP4_ENGINE);
engine->session = service->session;
engine->url = service->url;
engine->service = service;
engine->reconnect = reconnect;
-
+
return engine;
}
@@ -192,29 +192,29 @@
{
camel_imap4_token_t token;
int code;
-
+
g_return_val_if_fail (CAMEL_IS_IMAP4_ENGINE (engine), -1);
g_return_val_if_fail (CAMEL_IS_STREAM (stream), -1);
-
+
if (engine->istream)
camel_object_unref (engine->istream);
-
+
if (engine->ostream)
camel_object_unref (engine->ostream);
-
+
engine->istream = (CamelIMAP4Stream *) camel_imap4_stream_new (stream);
engine->ostream = camel_stream_buffer_new (stream, CAMEL_STREAM_BUFFER_WRITE);
engine->state = CAMEL_IMAP4_ENGINE_CONNECTED;
camel_object_unref (stream);
-
+
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
goto exception;
-
+
if (token.token != '*') {
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
goto exception;
}
-
+
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) {
@@ -222,18 +222,18 @@
engine->url->host);
goto exception;
}
-
+
return 0;
-
+
exception:
-
+
engine->state = CAMEL_IMAP4_ENGINE_DISCONNECTED;
-
+
camel_object_unref (engine->istream);
engine->istream = NULL;
camel_object_unref (engine->ostream);
engine->ostream = NULL;
-
+
return -1;
}
@@ -252,35 +252,35 @@
{
CamelIMAP4Command *ic;
int id, retval = 0;
-
+
ic = camel_imap4_engine_prequeue (engine, NULL, "CAPABILITY\r\n");
-
+
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
;
-
+
if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE) {
camel_exception_xfer (ex, &ic->ex);
retval = -1;
}
-
+
camel_imap4_command_unref (ic);
-
+
if (retval == -1 || !(engine->capa & CAMEL_IMAP4_CAPABILITY_XGWEXTENSIONS))
return retval;
-
+
ic = camel_imap4_engine_prequeue (engine, NULL, "XGWEXTENSIONS\r\n");
camel_imap4_command_register_untagged (ic, "XGWEXTENSIONS", parse_xgwextensions);
-
+
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
;
-
+
if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE) {
camel_exception_xfer (ex, &ic->ex);
retval = -1;
}
-
+
camel_imap4_command_unref (ic);
-
+
return retval;
}
@@ -301,7 +301,7 @@
GPtrArray *array = NULL;
CamelIMAP4Command *ic;
int id, i;
-
+
if (engine->capa & CAMEL_IMAP4_CAPABILITY_NAMESPACE) {
ic = camel_imap4_engine_prequeue (engine, NULL, "NAMESPACE\r\n");
} else {
@@ -309,48 +309,48 @@
camel_imap4_command_register_untagged (ic, "LIST", camel_imap4_untagged_list);
ic->user_data = array = g_ptr_array_new ();
}
-
+
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
;
-
+
if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE) {
camel_exception_xfer (ex, &ic->ex);
camel_imap4_command_unref (ic);
-
+
if (array != NULL)
g_ptr_array_free (array, TRUE);
-
+
return -1;
}
-
+
if (array != NULL) {
if (ic->result == CAMEL_IMAP4_RESULT_OK) {
CamelIMAP4Namespace *namespace;
-
+
g_assert (array->len >= 1);
list = array->pdata[0];
-
+
namespace = g_new (CamelIMAP4Namespace, 1);
namespace->next = NULL;
namespace->path = g_strdup ("");
namespace->sep = list->delim;
-
+
engine->namespaces.personal = namespace;
} else {
/* should never *ever* happen */
}
-
+
for (i = 0; i < array->len; i++) {
list = array->pdata[i];
g_free (list->name);
g_free (list);
}
-
+
g_ptr_array_free (array, TRUE);
}
-
+
camel_imap4_command_unref (ic);
-
+
return 0;
}
@@ -372,24 +372,24 @@
CamelIMAP4Command *ic;
int id, retval = 0;
int i;
-
+
g_return_val_if_fail (CAMEL_IS_IMAP4_ENGINE (engine), -1);
g_return_val_if_fail (CAMEL_IS_IMAP4_FOLDER (folder), -1);
-
+
/* POSSIBLE FIXME: if the folder to be selected will already
* be selected by the time the queue is emptied, simply
* no-op? */
-
+
ic = camel_imap4_engine_queue (engine, folder, "SELECT %F\r\n", folder);
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
;
-
+
if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE) {
camel_exception_xfer (ex, &ic->ex);
camel_imap4_command_unref (ic);
return -1;
}
-
+
switch (ic->result) {
case CAMEL_IMAP4_RESULT_OK:
/*folder->mode = 0;*/
@@ -418,12 +418,12 @@
break;
}
}
-
+
/*if (folder->mode == 0) {
folder->mode = CAMEL_FOLDER_MODE_READ_ONLY;
g_warning ("Expected to find [READ-ONLY] or [READ-WRITE] in SELECT response");
}*/
-
+
break;
case CAMEL_IMAP4_RESULT_NO:
/* FIXME: would be good to save the NO reason into the err message */
@@ -442,9 +442,9 @@
g_assert_not_reached ();
retval = -1;
}
-
+
camel_imap4_command_unref (ic);
-
+
return retval;
}
@@ -482,31 +482,31 @@
parse_xgwextensions (CamelIMAP4Engine *engine, CamelIMAP4Command *ic, guint32 index, camel_imap4_token_t *token, CamelException *ex)
{
int i;
-
+
if (camel_imap4_engine_next_token (engine, token, ex) == -1)
return -1;
-
+
while (token->token == CAMEL_IMAP4_TOKEN_ATOM) {
for (i = 0; imap4_xgwextensions[i].name; i++) {
if (!g_ascii_strcasecmp (imap4_xgwextensions[i].name, token->v.atom))
engine->capa |= imap4_xgwextensions[i].flag;
}
-
+
if (camel_imap4_engine_next_token (engine, token, ex) == -1)
return -1;
}
-
+
if (token->token != '\n') {
d(fprintf (stderr, "expected '\\n' at the end of the XGWEXTENSIONS response\n"));
goto unexpected;
}
-
+
return 0;
-
+
unexpected:
-
+
camel_imap4_utils_set_unexpected_token_error (ex, engine, token);
-
+
return -1;
}
@@ -522,20 +522,20 @@
{
camel_imap4_token_t token;
int i;
-
+
/* we assume UTF8 searches work until proven otherwise */
engine->capa = CAMEL_IMAP4_CAPABILITY_utf8_search;
engine->level = 0;
-
+
g_hash_table_foreach_remove (engine->authtypes, (GHRFunc) auth_free, NULL);
-
+
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
return -1;
-
+
while (token.token == CAMEL_IMAP4_TOKEN_ATOM) {
if (!g_ascii_strncasecmp ("AUTH=", token.v.atom, 5)) {
CamelServiceAuthType *auth;
-
+
if ((auth = camel_sasl_authtype (token.v.atom + 5)) != NULL)
g_hash_table_insert (engine->authtypes, g_strdup (token.v.atom + 5), auth);
} else {
@@ -544,19 +544,19 @@
engine->capa |= imap4_capabilities[i].flag;
}
}
-
+
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
return -1;
}
-
+
if (token.token != sentinel) {
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
return -1;
}
-
+
/* unget our sentinel token */
camel_imap4_stream_unget_token (engine->istream, &token);
-
+
/* figure out which version of IMAP4 we are dealing with */
if (engine->capa & CAMEL_IMAP4_CAPABILITY_IMAP4REV1) {
engine->level = CAMEL_IMAP4_LEVEL_IMAP4REV1;
@@ -566,7 +566,7 @@
} else {
engine->level = CAMEL_IMAP4_LEVEL_UNKNOWN;
}
-
+
return 0;
}
@@ -574,13 +574,13 @@
engine_parse_flags_list (CamelIMAP4Engine *engine, CamelIMAP4RespCode *resp, int perm, CamelException *ex)
{
guint32 flags = 0;
-
+
if (camel_imap4_parse_flags_list (engine, &flags, ex) == -1)
return-1;
-
+
if (resp != NULL)
resp->v.flags = flags;
-
+
if (engine->current && engine->current->folder) {
if (perm)
((CamelFolder *) engine->current->folder)->permanent_flags = flags;
@@ -596,7 +596,7 @@
"response for a folder, yet we do not currently have a folder selected?\n",
perm ? "PERMANENTFLAGS" : "FLAGS");
}
-
+
return 0;
}
@@ -604,19 +604,19 @@
engine_parse_flags (CamelIMAP4Engine *engine, CamelException *ex)
{
camel_imap4_token_t token;
-
+
if (engine_parse_flags_list (engine, NULL, FALSE, ex) == -1)
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 FLAGS response\n"));
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
return -1;
}
-
+
return 0;
}
@@ -626,48 +626,48 @@
CamelIMAP4Namespace *namespaces[3], *node, *tail;
camel_imap4_token_t token;
int i, n = 0;
-
+
camel_imap4_namespace_clear (&engine->namespaces.personal);
camel_imap4_namespace_clear (&engine->namespaces.other);
camel_imap4_namespace_clear (&engine->namespaces.shared);
-
+
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
return -1;
-
+
do {
namespaces[n] = NULL;
tail = (CamelIMAP4Namespace *) &namespaces[n];
-
+
if (token.token == '(') {
/* decode the list of namespace pairs */
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
goto exception;
-
+
while (token.token == '(') {
/* decode a namespace pair */
-
+
/* get the path name token */
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
goto exception;
-
+
if (token.token != CAMEL_IMAP4_TOKEN_QSTRING) {
d(fprintf (stderr, "Expected to find a qstring token as first element in NAMESPACE pair\n"));
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
goto exception;
}
-
+
node = g_new (CamelIMAP4Namespace, 1);
node->next = NULL;
node->path = g_strdup (token.v.qstring);
-
+
/* get the path delimiter token */
if (camel_imap4_engine_next_token (engine, &token, ex) == -1) {
g_free (node->path);
g_free (node);
-
+
goto exception;
}
-
+
switch (token.token) {
case CAMEL_IMAP4_TOKEN_NIL:
node->sep = '\0';
@@ -689,38 +689,38 @@
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
g_free (node->path);
g_free (node);
-
+
goto exception;
}
-
+
tail->next = node;
tail = node;
-
+
/* canonicalise the namespace path */
if (node->path[strlen (node->path) - 1] == node->sep)
node->path[strlen (node->path) - 1] = '\0';
-
+
/* canonicalise if this is an INBOX namespace */
if (!g_ascii_strncasecmp (node->path, "INBOX", 5) &&
(node->path[6] == '\0' || node->path[6] == node->sep))
memcpy (node->path, "INBOX", 5);
-
+
/* get the closing ')' for this namespace pair */
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
goto exception;
-
+
if (token.token != ')') {
d(fprintf (stderr, "Expected to find a ')' token to close the current namespace pair\n"));
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
-
+
goto exception;
}
-
+
/* get the next token (should be either '(' or ')') */
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
goto exception;
}
-
+
if (token.token != ')') {
d(fprintf (stderr, "Expected to find a ')' to close the current namespace list\n"));
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
@@ -734,25 +734,25 @@
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
goto exception;
}
-
+
/* get the next token (should be either '(', NIL, or '\n') */
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
goto exception;
-
+
n++;
} while (n < 3);
-
+
engine->namespaces.personal = namespaces[0];
engine->namespaces.other = namespaces[1];
engine->namespaces.shared = namespaces[2];
-
+
return 0;
-
+
exception:
-
+
for (i = 0; i <= n; i++)
camel_imap4_namespace_clear (&namespaces[i]);
-
+
return -1;
}
@@ -808,25 +808,25 @@
camel_imap4_token_t token;
unsigned char *linebuf;
size_t len;
-
+
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
return -1;
-
+
if (token.token != '[') {
d(fprintf (stderr, "Expected a '[' token (followed by a RESP-CODE)\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 != CAMEL_IMAP4_TOKEN_ATOM) {
d(fprintf (stderr, "Expected an atom token containing a RESP-CODE\n"));
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
return -1;
}
-
+
for (code = 0; imap4_resp_codes[code].name; code++) {
if (!strcmp (imap4_resp_codes[code].name, token.v.atom)) {
if (engine->current && imap4_resp_codes[code].save) {
@@ -836,7 +836,7 @@
break;
}
}
-
+
switch (code) {
case CAMEL_IMAP4_RESP_CODE_ALERT:
/* nothing to do here, handled after switch statement */
@@ -864,195 +864,195 @@
case CAMEL_IMAP4_RESP_CODE_UIDNEXT:
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
goto exception;
-
+
if (token.token != CAMEL_IMAP4_TOKEN_NUMBER) {
d(fprintf (stderr, "Expected an nz_number token as an argument to the UIDNEXT RESP-CODE\n"));
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
goto exception;
}
-
+
if (resp != NULL)
resp->v.uidnext = token.v.number;
-
+
break;
case CAMEL_IMAP4_RESP_CODE_UIDVALIDITY:
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
goto exception;
-
+
if (token.token != CAMEL_IMAP4_TOKEN_NUMBER) {
d(fprintf (stderr, "Expected an nz_number token as an argument to the UIDVALIDITY RESP-CODE\n"));
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
goto exception;
}
-
+
if (resp != NULL)
resp->v.uidvalidity = token.v.number;
-
+
break;
case CAMEL_IMAP4_RESP_CODE_UNSEEN:
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
return -1;
-
+
if (token.token != CAMEL_IMAP4_TOKEN_NUMBER) {
d(fprintf (stderr, "Expected an nz_number token as an argument to the UNSEEN RESP-CODE\n"));
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
goto exception;
}
-
+
if (resp != NULL)
resp->v.unseen = token.v.number;
-
+
break;
case CAMEL_IMAP4_RESP_CODE_NEWNAME:
/* this RESP-CODE may actually be removed - see here:
* http://www.washington.edu/imap4/listarch/2001/msg00058.html */
-
+
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
return -1;
-
+
if (token.token != CAMEL_IMAP4_TOKEN_ATOM && token.token != CAMEL_IMAP4_TOKEN_QSTRING) {
d(fprintf (stderr, "Expected an atom or qstring token as the first argument to the NEWNAME RESP-CODE\n"));
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
goto exception;
}
-
+
if (resp != NULL)
resp->v.newname[0] = g_strdup (token.v.atom);
-
+
if (token.token != CAMEL_IMAP4_TOKEN_ATOM && token.token != CAMEL_IMAP4_TOKEN_QSTRING) {
d(fprintf (stderr, "Expected an atom or qstring token as the second argument to the NEWNAME RESP-CODE\n"));
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
goto exception;
}
-
+
if (resp != NULL)
resp->v.newname[1] = g_strdup (token.v.atom);
-
+
break;
case CAMEL_IMAP4_RESP_CODE_APPENDUID:
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
return -1;
-
+
if (token.token != CAMEL_IMAP4_TOKEN_NUMBER) {
d(fprintf (stderr, "Expected an nz_number token as the first argument to the APPENDUID RESP-CODE\n"));
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
goto exception;
}
-
+
if (resp != NULL)
resp->v.appenduid.uidvalidity = token.v.number;
-
+
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
return -1;
-
+
if (token.token != CAMEL_IMAP4_TOKEN_NUMBER) {
d(fprintf (stderr, "Expected an nz_number token as the second argument to the APPENDUID RESP-CODE\n"));
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
goto exception;
}
-
+
if (resp != NULL)
resp->v.appenduid.uid = token.v.number;
-
+
break;
case CAMEL_IMAP4_RESP_CODE_COPYUID:
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
return -1;
-
+
if (token.token != CAMEL_IMAP4_TOKEN_NUMBER) {
d(fprintf (stderr, "Expected an nz_number token as the first argument to the COPYUID RESP-CODE\n"));
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
goto exception;
}
-
+
if (resp != NULL)
resp->v.copyuid.uidvalidity = token.v.number;
-
+
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
return -1;
-
+
if (token.token != CAMEL_IMAP4_TOKEN_ATOM && token.token != CAMEL_IMAP4_TOKEN_NUMBER) {
d(fprintf (stderr, "Expected an atom or numeric token as the second argument to the COPYUID RESP-CODE\n"));
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
goto exception;
}
-
+
if (resp != NULL) {
if (token.token == CAMEL_IMAP4_TOKEN_NUMBER)
resp->v.copyuid.srcset = g_strdup_printf ("%lu", token.v.number);
else
resp->v.copyuid.srcset = g_strdup (token.v.atom);
}
-
+
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
return -1;
-
+
if (token.token != CAMEL_IMAP4_TOKEN_ATOM && token.token != CAMEL_IMAP4_TOKEN_NUMBER) {
d(fprintf (stderr, "Expected an atom or numeric token as the third argument to the APPENDUID RESP-CODE\n"));
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
goto exception;
}
-
+
if (resp != NULL) {
if (token.token == CAMEL_IMAP4_TOKEN_NUMBER)
resp->v.copyuid.destset = g_strdup_printf ("%lu", token.v.number);
else
resp->v.copyuid.destset = g_strdup (token.v.atom);
}
-
+
break;
default:
d(fprintf (stderr, "Unknown RESP-CODE encountered: %s\n", token.v.atom));
-
+
/* extensions are of the form: "[" atom [SPACE 1*<any TEXT_CHAR except "]">] "]" */
-
+
/* eat up the TEXT_CHARs */
while (token.token != ']' && token.token != '\n') {
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
goto exception;
}
-
+
break;
}
-
+
while (token.token != ']' && token.token != '\n') {
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
goto exception;
}
-
+
if (token.token != ']') {
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
d(fprintf (stderr, "Expected to find a ']' token after the RESP-CODE\n"));
return -1;
}
-
+
if (code == CAMEL_IMAP4_RESP_CODE_ALERT) {
if (camel_imap4_engine_line (engine, &linebuf, &len, ex) == -1)
goto exception;
-
+
camel_session_alert_user (engine->session, CAMEL_SESSION_ALERT_INFO, linebuf, FALSE);
g_free (linebuf);
} else if (resp != NULL && code == CAMEL_IMAP4_RESP_CODE_PARSE) {
if (camel_imap4_engine_line (engine, &linebuf, &len, ex) == -1)
goto exception;
-
+
resp->v.parse = linebuf;
} else {
/* eat up the rest of the response */
if (camel_imap4_engine_line (engine, NULL, NULL, ex) == -1)
goto exception;
}
-
+
if (resp != NULL)
g_ptr_array_add (engine->current->resp_codes, resp);
-
+
return 0;
-
+
exception:
-
+
if (resp != NULL)
camel_imap4_resp_code_free (resp);
-
+
return -1;
}
@@ -1076,10 +1076,10 @@
CamelIMAP4UntaggedCallback untagged;
CamelFolder *folder;
unsigned int v;
-
+
if (camel_imap4_engine_next_token (engine, token, ex) == -1)
return -1;
-
+
if (token->token == CAMEL_IMAP4_TOKEN_ATOM) {
if (!strcmp ("BYE", token->v.atom)) {
/* we don't care if we fail here, either way we've been disconnected */
@@ -1091,19 +1091,19 @@
camel_imap4_engine_line (engine, NULL, NULL, NULL);
}
}
-
+
engine->state = CAMEL_IMAP4_ENGINE_DISCONNECTED;
-
+
/* we don't return -1 here because there may be more untagged responses after the BYE */
} else if (!strcmp ("CAPABILITY", token->v.atom)) {
/* capability tokens follow */
if (engine_parse_capability (engine, '\n', ex) == -1)
return -1;
-
+
/* find the eoln token */
if (camel_imap4_engine_next_token (engine, token, ex) == -1)
return -1;
-
+
if (token->token != '\n') {
camel_imap4_utils_set_unexpected_token_error (ex, engine, token);
return -1;
@@ -1117,11 +1117,11 @@
return -1;
} else if (!strcmp ("NO", token->v.atom) || !strcmp ("BAD", token->v.atom)) {
code = !strcmp ("NO", token->v.atom) ? CAMEL_IMAP4_UNTAGGED_NO : CAMEL_IMAP4_UNTAGGED_BAD;
-
+
/* our command has been rejected */
if (camel_imap4_engine_next_token (engine, token, ex) == -1)
return -1;
-
+
if (token->token == '[') {
/* we have a resp code */
camel_imap4_stream_unget_token (engine->istream, token);
@@ -1134,15 +1134,15 @@
}
} else if (!strcmp ("OK", token->v.atom)) {
code = CAMEL_IMAP4_UNTAGGED_OK;
-
+
if (engine->state == CAMEL_IMAP4_ENGINE_CONNECTED) {
/* initial server greeting */
engine->state = CAMEL_IMAP4_ENGINE_PREAUTH;
}
-
+
if (camel_imap4_engine_next_token (engine, token, ex) == -1)
return -1;
-
+
if (token->token == '[') {
/* we have a resp code */
camel_imap4_stream_unget_token (engine->istream, token);
@@ -1155,10 +1155,10 @@
}
} else if (!strcmp ("PREAUTH", token->v.atom)) {
code = CAMEL_IMAP4_UNTAGGED_PREAUTH;
-
+
if (engine->state == CAMEL_IMAP4_ENGINE_CONNECTED)
engine->state = CAMEL_IMAP4_ENGINE_AUTHENTICATED;
-
+
if (camel_imap4_engine_parse_resp_code (engine, ex) == -1)
return -1;
} else if (ic && (untagged = g_hash_table_lookup (ic->untagged, token->v.atom))) {
@@ -1167,23 +1167,23 @@
return -1;
} else {
d(fprintf (stderr, "Unhandled atom token in untagged response: %s", token->v.atom));
-
+
if (camel_imap4_engine_eat_line (engine, ex) == -1)
return -1;
}
} else if (token->token == CAMEL_IMAP4_TOKEN_NUMBER) {
/* we probably have something like "* 1 EXISTS" */
v = token->v.number;
-
+
if (camel_imap4_engine_next_token (engine, token, ex) == -1)
return -1;
-
+
if (token->token != CAMEL_IMAP4_TOKEN_ATOM) {
camel_imap4_utils_set_unexpected_token_error (ex, engine, token);
-
+
return -1;
}
-
+
/* which folder is this EXISTS/EXPUNGE/RECENT acting on? */
if (engine->current && engine->current->folder)
folder = (CamelFolder *) engine->current->folder;
@@ -1191,7 +1191,7 @@
folder = (CamelFolder *) engine->folder;
else
folder = NULL;
-
+
/* NOTE: these can be over-ridden by a registered untagged response handler */
if (!strcmp ("EXISTS", token->v.atom)) {
camel_imap4_summary_set_exists (folder->summary, v);
@@ -1206,16 +1206,16 @@
} else {
d(fprintf (stderr, "Unrecognized untagged response: * %lu %s\n", v, token->v.atom));
}
-
+
/* find the eoln token */
if (camel_imap4_engine_eat_line (engine, ex) == -1)
return -1;
} else {
camel_imap4_utils_set_unexpected_token_error (ex, engine, token);
-
+
return -1;
}
-
+
return code;
}
@@ -1231,26 +1231,26 @@
camel_imap4_engine_handle_untagged (CamelIMAP4Engine *engine, CamelException *ex)
{
camel_imap4_token_t token;
-
+
g_return_if_fail (CAMEL_IS_IMAP4_ENGINE (engine));
-
+
do {
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
goto exception;
-
+
if (token.token != '*')
break;
-
+
if (camel_imap4_engine_handle_untagged_1 (engine, &token, ex) == -1)
goto exception;
} while (1);
-
+
camel_imap4_stream_unget_token (engine->istream, &token);
-
+
return;
-
+
exception:
-
+
engine->state = CAMEL_IMAP4_ENGINE_DISCONNECTED;
}
@@ -1259,15 +1259,15 @@
imap4_process_command (CamelIMAP4Engine *engine, CamelIMAP4Command *ic)
{
int retval;
-
+
while ((retval = camel_imap4_command_step (ic)) == 0)
;
-
+
if (retval == -1) {
engine->state = CAMEL_IMAP4_ENGINE_DISCONNECTED;
return -1;
}
-
+
return 0;
}
@@ -1277,20 +1277,20 @@
{
CamelIMAP4Command *ic;
const char *cmd;
-
+
ic = (CamelIMAP4Command *) engine->queue.head;
cmd = (const char *) ic->parts->buffer;
-
+
if (!ic->folder || ic->folder == engine->folder ||
!strncmp (cmd, "SELECT ", 7) || !strncmp (cmd, "EXAMINE ", 8)) {
/* no need to pre-queue a SELECT */
return;
}
-
+
/* we need to pre-queue a SELECT */
ic = camel_imap4_engine_prequeue (engine, (CamelFolder *) ic->folder, "SELECT %F\r\n", ic->folder);
ic->user_data = engine;
-
+
camel_imap4_command_unref (ic);
}
@@ -1300,7 +1300,7 @@
{
const char *cmd;
int retval = 0;
-
+
cmd = ic->parts->buffer;
if (!strncmp (cmd, "SELECT ", 7) || !strncmp (cmd, "EXAMINE ", 8)) {
if (ic->result == CAMEL_IMAP4_RESULT_OK) {
@@ -1309,7 +1309,7 @@
if (engine->folder)
camel_object_unref (engine->folder);
engine->folder = ic->folder;
-
+
engine->state = CAMEL_IMAP4_ENGINE_SELECTED;
} else if (ic->user_data == engine) {
/* the engine pre-queued this SELECT command */
@@ -1321,7 +1321,7 @@
} else if (!strncmp (cmd, "LOGOUT", 6)) {
engine->state = CAMEL_IMAP4_ENGINE_DISCONNECTED;
}
-
+
return retval;
}
@@ -1344,27 +1344,27 @@
CamelIMAP4Command *ic, *nic;
GPtrArray *resp_codes;
int retval = -1;
-
+
if (e_dlist_empty (&engine->queue))
return 0;
-
+
/* This sucks... it would be nicer if we didn't have to check the stream's disconnected status */
if ((engine->state == CAMEL_IMAP4_ENGINE_DISCONNECTED || engine->istream->disconnected) && !engine->reconnecting) {
CamelException rex;
gboolean connected;
-
+
camel_exception_init (&rex);
engine->reconnecting = TRUE;
connected = engine->reconnect (engine, &rex);
engine->reconnecting = FALSE;
-
+
if (!connected) {
/* pop the first command and act as tho it failed (which, technically, it did...) */
ic = (CamelIMAP4Command *) e_dlist_remhead (&engine->queue);
ic->status = CAMEL_IMAP4_COMMAND_ERROR;
camel_exception_xfer (&ic->ex, &rex);
camel_imap4_command_unref (ic);
-
+
/* FIXME: in a perfect world, if the connect failure was due to the user cancelling the
* passwd dialog, we'd either send a LOGOUT command here -or- we'd leave the connection
* open but in the PREAUTH state that we'd later be able to handle if the user queued
@@ -1374,17 +1374,17 @@
engine->istream = NULL;
camel_object_unref (engine->ostream);
engine->ostream = NULL;
-
+
return -1;
}
}
-
+
/* check to see if we need to pre-queue a SELECT, if so do it */
engine_prequeue_folder_select (engine);
-
+
engine->current = ic = (CamelIMAP4Command *) e_dlist_remhead (&engine->queue);
ic->status = CAMEL_IMAP4_COMMAND_ACTIVE;
-
+
if (imap4_process_command (engine, ic) != -1) {
if (engine_state_change (engine, ic) == -1) {
/* This can ONLY happen if @ic was the pre-queued SELECT command
@@ -1395,26 +1395,26 @@
* information as possible, we move all @ic status information
* over to @nic and pretend we just processed @nic.
**/
-
+
nic = (CamelIMAP4Command *) e_dlist_remhead (&engine->queue);
-
+
nic->status = ic->status;
nic->result = ic->result;
resp_codes = nic->resp_codes;
nic->resp_codes = ic->resp_codes;
ic->resp_codes = resp_codes;
-
+
camel_exception_xfer (&nic->ex, &ic->ex);
-
+
camel_imap4_command_unref (ic);
ic = nic;
}
-
+
retval = ic->id;
}
-
+
camel_imap4_command_unref (ic);
-
+
return retval;
}
@@ -1436,17 +1436,17 @@
{
CamelIMAP4Command *ic;
va_list args;
-
+
g_return_val_if_fail (CAMEL_IS_IMAP4_ENGINE (engine), NULL);
-
+
va_start (args, format);
ic = camel_imap4_command_newv (engine, (CamelIMAP4Folder *) folder, format, args);
va_end (args);
-
+
ic->id = engine->nextid++;
e_dlist_addtail (&engine->queue, (EDListNode *) ic);
camel_imap4_command_ref (ic);
-
+
return ic;
}
@@ -1468,25 +1468,25 @@
{
CamelIMAP4Command *ic;
va_list args;
-
+
g_return_val_if_fail (CAMEL_IS_IMAP4_ENGINE (engine), NULL);
-
+
va_start (args, format);
ic = camel_imap4_command_newv (engine, (CamelIMAP4Folder *) folder, format, args);
va_end (args);
-
+
if (e_dlist_empty (&engine->queue)) {
e_dlist_addtail (&engine->queue, (EDListNode *) ic);
ic->id = engine->nextid++;
} else {
CamelIMAP4Command *nic;
EDListNode *node;
-
+
node = (EDListNode *) ic;
e_dlist_addhead (&engine->queue, node);
nic = (CamelIMAP4Command *) node->next;
ic->id = nic->id - 1;
-
+
if (ic->id == 0) {
/* increment all command ids */
node = engine->queue.head;
@@ -1497,9 +1497,9 @@
}
}
}
-
+
camel_imap4_command_ref (ic);
-
+
return ic;
}
@@ -1515,14 +1515,14 @@
camel_imap4_engine_dequeue (CamelIMAP4Engine *engine, CamelIMAP4Command *ic)
{
EDListNode *node = (EDListNode *) ic;
-
+
if (node->next == NULL && node->prev == NULL)
return;
-
+
e_dlist_remove (node);
node->next = NULL;
node->prev = NULL;
-
+
camel_imap4_command_unref (ic);
}
@@ -1546,12 +1546,12 @@
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("IMAP4 server %s unexpectedly disconnected: %s"),
engine->url->host, errno ? g_strerror (errno) : _("Unknown"));
-
+
engine->state = CAMEL_IMAP4_ENGINE_DISCONNECTED;
-
+
return -1;
}
-
+
return 0;
}
@@ -1572,27 +1572,27 @@
unsigned char *literal;
int retval;
size_t n;
-
+
do {
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
return -1;
-
+
if (token.token == CAMEL_IMAP4_TOKEN_LITERAL) {
while ((retval = camel_imap4_stream_literal (engine->istream, &literal, &n)) == 1)
;
-
+
if (retval == -1) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("IMAP4 server %s unexpectedly disconnected: %s"),
engine->url->host, errno ? g_strerror (errno) : _("Unknown"));
-
+
engine->state = CAMEL_IMAP4_ENGINE_DISCONNECTED;
-
+
return -1;
}
}
} while (token.token != '\n');
-
+
return 0;
}
@@ -1617,37 +1617,37 @@
unsigned char *buf;
size_t buflen;
int retval;
-
+
if (line != NULL)
linebuf = g_byte_array_new ();
-
+
while ((retval = camel_imap4_stream_line (engine->istream, &buf, &buflen)) > 0) {
if (linebuf != NULL)
g_byte_array_append (linebuf, buf, buflen);
}
-
+
if (retval == -1) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("IMAP4 server %s unexpectedly disconnected: %s"),
engine->url->host, errno ? g_strerror (errno) : _("Unknown"));
-
+
if (linebuf != NULL)
g_byte_array_free (linebuf, TRUE);
-
+
engine->state = CAMEL_IMAP4_ENGINE_DISCONNECTED;
-
+
return -1;
}
-
+
if (linebuf != NULL) {
g_byte_array_append (linebuf, buf, buflen);
-
+
*line = linebuf->data;
*len = linebuf->len;
-
+
g_byte_array_free (linebuf, FALSE);
}
-
+
return 0;
}
@@ -1673,38 +1673,38 @@
unsigned char *buf;
size_t buflen;
int retval;
-
+
if (literal != NULL)
literalbuf = g_byte_array_new ();
-
+
while ((retval = camel_imap4_stream_literal (engine->istream, &buf, &buflen)) > 0) {
if (literalbuf != NULL)
g_byte_array_append (literalbuf, buf, buflen);
}
-
+
if (retval == -1) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("IMAP4 server %s unexpectedly disconnected: %s"),
engine->url->host, errno ? g_strerror (errno) : _("Unknown"));
-
+
if (literalbuf != NULL)
g_byte_array_free (literalbuf, TRUE);
-
+
engine->state = CAMEL_IMAP4_ENGINE_DISCONNECTED;
-
+
return -1;
}
-
+
if (literalbuf != NULL) {
g_byte_array_append (literalbuf, buf, buflen);
g_byte_array_append (literalbuf, "", 1);
-
+
*literal = literalbuf->data;
*len = literalbuf->len - 1;
-
+
g_byte_array_free (literalbuf, FALSE);
}
-
+
return 0;
}
@@ -1725,10 +1725,10 @@
{
camel_imap4_token_t token;
size_t n;
-
+
if (camel_imap4_engine_next_token (engine, &token, ex) == -1)
return -1;
-
+
switch (token.token) {
case CAMEL_IMAP4_TOKEN_NIL:
*nstring = NULL;
@@ -1747,7 +1747,7 @@
camel_imap4_utils_set_unexpected_token_error (ex, engine, &token);
return -1;
}
-
+
return 0;
}
@@ -1776,6 +1776,6 @@
default:
break;
}
-
+
g_free (rcode);
}
Modified: trunk/camel/providers/imap4/camel-imap4-engine.h
==============================================================================
--- trunk/camel/providers/imap4/camel-imap4-engine.h (original)
+++ trunk/camel/providers/imap4/camel-imap4-engine.h Wed May 7 01:20:17 2008
@@ -78,10 +78,10 @@
CAMEL_IMAP4_CAPABILITY_ACL = (1 << 10),
CAMEL_IMAP4_CAPABILITY_MULTIAPPEND = (1 << 11),
CAMEL_IMAP4_CAPABILITY_UNSELECT = (1 << 12),
-
+
CAMEL_IMAP4_CAPABILITY_XGWEXTENSIONS = (1 << 16),
CAMEL_IMAP4_CAPABILITY_XGWMOVE = (1 << 17),
-
+
CAMEL_IMAP4_CAPABILITY_useful_lsub = (1 << 30),
CAMEL_IMAP4_CAPABILITY_utf8_search = (1 << 31),
};
@@ -155,40 +155,40 @@
struct _CamelIMAP4Engine {
CamelObject parent_object;
-
+
CamelIMAP4ReconnectFunc reconnect;
gboolean reconnecting;
-
+
CamelSession *session;
CamelService *service;
CamelURL *url;
-
+
camel_imap4_engine_t state;
camel_imap4_level_t level;
guint32 capa;
-
+
guint32 maxlen:31;
guint32 maxlentype:1;
-
+
CamelIMAP4NamespaceList namespaces;
GHashTable *authtypes; /* supported authtypes */
-
+
struct _CamelIMAP4Stream *istream;
CamelStream *ostream;
-
+
unsigned char tagprefix; /* 'A'..'Z' */
unsigned int tag; /* next command tag */
int nextid;
-
+
struct _CamelIMAP4Folder *folder; /* currently selected folder */
-
+
EDList queue; /* queue of waiting commands */
struct _CamelIMAP4Command *current;
};
struct _CamelIMAP4EngineClass {
CamelObjectClass parent_class;
-
+
unsigned char tagprefix;
};
Modified: trunk/camel/providers/imap4/camel-imap4-folder.h
==============================================================================
--- trunk/camel/providers/imap4/camel-imap4-folder.h (original)
+++ trunk/camel/providers/imap4/camel-imap4-folder.h Wed May 7 01:20:17 2008
@@ -54,22 +54,22 @@
struct _CamelIMAP4Folder {
CamelOfflineFolder parent_object;
-
+
CamelFolderSearch *search;
-
+
CamelOfflineJournal *journal;
CamelDataCache *cache;
-
+
char *cachedir;
char *utf7_name;
-
+
unsigned int read_only:1;
unsigned int enable_mlist:1;
};
struct _CamelIMAP4FolderClass {
CamelOfflineFolderClass parent_class;
-
+
};
Modified: trunk/camel/providers/imap4/camel-imap4-journal.c
==============================================================================
--- trunk/camel/providers/imap4/camel-imap4-journal.c (original)
+++ trunk/camel/providers/imap4/camel-imap4-journal.c Wed May 7 01:20:17 2008
@@ -63,7 +63,7 @@
camel_imap4_journal_get_type (void)
{
static CamelType type = 0;
-
+
if (!type) {
type = camel_type_register (camel_offline_journal_get_type (),
"CamelIMAP4Journal",
@@ -74,7 +74,7 @@
(CamelObjectInitFunc) camel_imap4_journal_init,
(CamelObjectFinalizeFunc) camel_imap4_journal_finalize);
}
-
+
return type;
}
@@ -82,9 +82,9 @@
camel_imap4_journal_class_init (CamelIMAP4JournalClass *klass)
{
CamelOfflineJournalClass *journal_class = (CamelOfflineJournalClass *) klass;
-
+
parent_class = (CamelOfflineJournalClass *) camel_type_get_global_classfuncs (CAMEL_TYPE_OFFLINE_JOURNAL);
-
+
journal_class->entry_free = imap4_entry_free;
journal_class->entry_load = imap4_entry_load;
journal_class->entry_write = imap4_entry_write;
@@ -102,7 +102,7 @@
{
CamelIMAP4Journal *journal = (CamelIMAP4Journal *) object;
int i;
-
+
if (journal->failed) {
for (i = 0; i < journal->failed->len; i++)
camel_message_info_free (journal->failed->pdata[i]);
@@ -114,7 +114,7 @@
imap4_entry_free (CamelOfflineJournal *journal, EDListNode *entry)
{
CamelIMAP4JournalEntry *imap4_entry = (CamelIMAP4JournalEntry *) entry;
-
+
g_free (imap4_entry->v.append_uid);
g_free (imap4_entry);
}
@@ -123,26 +123,26 @@
imap4_entry_load (CamelOfflineJournal *journal, FILE *in)
{
CamelIMAP4JournalEntry *entry;
-
+
entry = g_malloc0 (sizeof (CamelIMAP4JournalEntry));
-
+
if (camel_file_util_decode_uint32 (in, &entry->type) == -1)
goto exception;
-
+
switch (entry->type) {
case CAMEL_IMAP4_JOURNAL_ENTRY_APPEND:
if (camel_file_util_decode_string (in, &entry->v.append_uid) == -1)
goto exception;
-
+
break;
default:
goto exception;
}
-
+
return (EDListNode *) entry;
-
+
exception:
-
+
switch (entry->type) {
case CAMEL_IMAP4_JOURNAL_ENTRY_APPEND:
g_free (entry->v.append_uid);
@@ -150,9 +150,9 @@
default:
g_assert_not_reached ();
}
-
+
g_free (entry);
-
+
return NULL;
}
@@ -160,20 +160,20 @@
imap4_entry_write (CamelOfflineJournal *journal, EDListNode *entry, FILE *out)
{
CamelIMAP4JournalEntry *imap4_entry = (CamelIMAP4JournalEntry *) entry;
-
+
if (camel_file_util_encode_uint32 (out, imap4_entry->type) == -1)
return -1;
-
+
switch (imap4_entry->type) {
case CAMEL_IMAP4_JOURNAL_ENTRY_APPEND:
if (camel_file_util_encode_string (out, imap4_entry->v.append_uid))
return -1;
-
+
break;
default:
g_assert_not_reached ();
}
-
+
return 0;
}
@@ -198,31 +198,31 @@
CamelStream *stream;
CamelException lex;
char *uid = NULL;
-
+
/* if the message isn't in the cache, the user went behind our backs so "not our problem" */
if (!imap4_folder->cache || !(stream = camel_data_cache_get (imap4_folder->cache, "cache", entry->v.append_uid, ex)))
goto done;
-
+
message = camel_mime_message_new ();
if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream) == -1) {
camel_object_unref (message);
camel_object_unref (stream);
goto done;
}
-
+
camel_object_unref (stream);
-
+
if (!(info = camel_folder_summary_uid (folder->summary, entry->v.append_uid))) {
/* info not in the summary, either because the summary
* got corrupted or because the previous time this
* journal was replay'd, it failed [1] */
info = camel_message_info_new (NULL);
}
-
+
camel_exception_init (&lex);
camel_folder_append_message (folder, message, info, &uid, &lex);
camel_object_unref (message);
-
+
if (camel_exception_is_set (&lex)) {
/* Remove the message-info from the summary even if we fail or the next
* summary downsync will break because info indexes will be wrong */
@@ -234,27 +234,27 @@
camel_folder_summary_remove_uid (folder->summary, entry->v.append_uid);
camel_message_info_free (info);
}
-
+
camel_exception_xfer (ex, &lex);
-
+
return -1;
}
-
+
if (uid != NULL && (real = camel_folder_summary_uid (folder->summary, uid))) {
/* Copy the system flags and user flags/tags over to the real
message-info now stored in the summary to prevent the user
from losing any of this meta-data */
imap4_message_info_dup_to ((CamelMessageInfoBase *) real, (CamelMessageInfoBase *) info);
}
-
+
camel_message_info_free (info);
g_free (uid);
-
+
done:
-
+
camel_folder_summary_remove_uid (folder->summary, entry->v.append_uid);
camel_data_cache_remove (imap4_folder->cache, "cache", entry->v.append_uid, NULL);
-
+
return 0;
}
@@ -262,7 +262,7 @@
imap4_entry_play (CamelOfflineJournal *journal, EDListNode *entry, CamelException *ex)
{
CamelIMAP4JournalEntry *imap4_entry = (CamelIMAP4JournalEntry *) entry;
-
+
switch (imap4_entry->type) {
case CAMEL_IMAP4_JOURNAL_ENTRY_APPEND:
return imap4_entry_play_append (journal, imap4_entry, ex);
@@ -278,12 +278,12 @@
camel_imap4_journal_new (CamelIMAP4Folder *folder, const char *filename)
{
CamelOfflineJournal *journal;
-
+
g_return_val_if_fail (CAMEL_IS_IMAP4_FOLDER (folder), NULL);
-
+
journal = (CamelOfflineJournal *) camel_object_new (camel_imap4_journal_get_type ());
camel_offline_journal_construct (journal, (CamelFolder *) folder, filename);
-
+
return journal;
}
@@ -293,10 +293,10 @@
{
CamelFolderSummary *summary = ((CamelOfflineJournal *) journal)->folder->summary;
int i;
-
+
for (i = 0; i < journal->failed->len; i++)
camel_folder_summary_add (summary, journal->failed->pdata[i]);
-
+
g_ptr_array_set_size (journal->failed, 0);
}
@@ -313,22 +313,22 @@
CamelStream *cache;
guint32 nextuid;
char *uid;
-
+
if (imap4_folder->cache == NULL) {
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
_("Cannot append message in offline mode: cache unavailable"));
return;
}
-
+
nextuid = camel_folder_summary_next_uid (folder->summary);
uid = g_strdup_printf ("-%lu", nextuid);
-
+
if (!(cache = camel_data_cache_add (imap4_folder->cache, "cache", uid, ex))) {
folder->summary->nextuid--;
g_free (uid);
return;
}
-
+
if (camel_data_wrapper_write_to_stream ((CamelDataWrapper *) message, cache) == -1
|| camel_stream_flush (cache) == -1) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
@@ -340,23 +340,23 @@
g_free (uid);
return;
}
-
+
camel_object_unref (cache);
-
+
entry = g_new (CamelIMAP4JournalEntry, 1);
entry->type = CAMEL_IMAP4_JOURNAL_ENTRY_APPEND;
entry->v.append_uid = uid;
-
+
e_dlist_addtail (&journal->queue, (EDListNode *) entry);
-
+
info = camel_folder_summary_info_new_from_message (folder->summary, message);
g_free(info->uid);
info->uid = g_strdup (uid);
-
+
imap4_message_info_dup_to ((CamelMessageInfoBase *) info, (CamelMessageInfoBase *) mi);
-
+
camel_folder_summary_add (folder->summary, info);
-
+
if (appended_uid)
*appended_uid = g_strdup (uid);
}
Modified: trunk/camel/providers/imap4/camel-imap4-journal.h
==============================================================================
--- trunk/camel/providers/imap4/camel-imap4-journal.h (original)
+++ trunk/camel/providers/imap4/camel-imap4-journal.h Wed May 7 01:20:17 2008
@@ -51,9 +51,9 @@
struct _CamelIMAP4JournalEntry {
EDListNode node;
-
+
int type;
-
+
union {
char *append_uid;
} v;
@@ -61,13 +61,13 @@
struct _CamelIMAP4Journal {
CamelOfflineJournal parent_object;
-
+
GPtrArray *failed;
};
struct _CamelIMAP4JournalClass {
CamelOfflineJournalClass parent_class;
-
+
};
Modified: trunk/camel/providers/imap4/camel-imap4-provider.c
==============================================================================
--- trunk/camel/providers/imap4/camel-imap4-provider.c (original)
+++ trunk/camel/providers/imap4/camel-imap4-provider.c Wed May 7 01:20:17 2008
@@ -64,27 +64,27 @@
static CamelProvider imap4_provider = {
"imap4",
N_("IMAP4rev1"),
-
+
N_("For reading and storing mail on IMAPv4rev1 servers."),
-
+
"mail",
-
+
CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_IS_SOURCE |
CAMEL_PROVIDER_IS_STORAGE | CAMEL_PROVIDER_SUPPORTS_SSL,
-
+
CAMEL_URL_NEED_USER | CAMEL_URL_NEED_HOST | CAMEL_URL_ALLOW_AUTH | CAMEL_URL_FRAGMENT_IS_PATH,
-
+
imap4_conf_entries,
-
+
/* ... */
};
CamelServiceAuthType camel_imap4_password_authtype = {
N_("Password"),
-
+
N_("This option will connect to the IMAPv4rev1 server using a "
"plaintext password."),
-
+
"",
TRUE
};
@@ -102,12 +102,12 @@
{
const CamelURL *u = (CamelURL *)key;
guint hash = 0;
-
+
add_hash (&hash, u->user);
add_hash (&hash, u->authmech);
add_hash (&hash, u->host);
hash ^= u->port;
-
+
return hash;
}
@@ -120,10 +120,10 @@
else
return FALSE;
}
-
+
if (s2 == NULL)
return FALSE;
-
+
return strcmp (s1, s2) == 0;
}
@@ -131,7 +131,7 @@
imap4_url_equal (gconstpointer a, gconstpointer b)
{
const CamelURL *u1 = a, *u2 = b;
-
+
return check_equal (u1->protocol, u2->protocol)
&& check_equal (u1->user, u2->user)
&& check_equal (u1->authmech, u2->authmech)
@@ -149,6 +149,6 @@
imap4_provider.authtypes = camel_sasl_authtype_list (FALSE);
imap4_provider.authtypes = g_list_prepend (imap4_provider.authtypes, &camel_imap4_password_authtype);
imap4_provider.translation_domain = GETTEXT_PACKAGE;
-
+
camel_provider_register (&imap4_provider);
}
Modified: trunk/camel/providers/imap4/camel-imap4-search.c
==============================================================================
--- trunk/camel/providers/imap4/camel-imap4-search.c (original)
+++ trunk/camel/providers/imap4/camel-imap4-search.c Wed May 7 01:20:17 2008
@@ -50,7 +50,7 @@
camel_imap4_search_get_type (void)
{
static CamelType type = 0;
-
+
if (!type) {
type = camel_type_register (camel_folder_search_get_type (),
"CamelIMAP4Search",
@@ -61,7 +61,7 @@
(CamelObjectInitFunc) camel_imap4_search_init,
(CamelObjectFinalizeFunc) camel_imap4_search_finalize);
}
-
+
return type;
}
@@ -69,9 +69,9 @@
camel_imap4_search_class_init (CamelIMAP4SearchClass *klass)
{
CamelFolderSearchClass *search_class = (CamelFolderSearchClass *) klass;
-
+
parent_class = (CamelFolderSearchClass *) camel_type_get_global_classfuncs (CAMEL_FOLDER_SEARCH_TYPE);
-
+
search_class->body_contains = imap4_body_contains;
}
@@ -92,11 +92,11 @@
camel_imap4_search_new (CamelIMAP4Engine *engine, const char *cachedir)
{
CamelIMAP4Search *search;
-
+
search = (CamelIMAP4Search *) camel_object_new (camel_imap4_search_get_type ());
camel_folder_search_construct ((CamelFolderSearch *) search);
search->engine = engine;
-
+
return (CamelFolderSearch *) search;
}
@@ -108,30 +108,30 @@
GPtrArray *matches = ic->user_data;
CamelMessageInfo *info;
char uid[12];
-
+
while (1) {
if (camel_imap4_engine_next_token (engine, token, ex) == -1)
return -1;
-
+
if (token->token == '\n')
break;
-
+
if (token->token != CAMEL_IMAP4_TOKEN_NUMBER || token->v.number == 0)
goto unexpected;
-
+
sprintf (uid, "%lu", token->v.number);
if ((info = camel_folder_summary_uid (summary, uid))) {
g_ptr_array_add (matches, (char *) camel_message_info_uid (info));
camel_message_info_free (info);
}
}
-
+
return 0;
-
+
unexpected:
-
+
camel_imap4_utils_set_unexpected_token_error (ex, engine, token);
-
+
return -1;
}
@@ -151,12 +151,12 @@
int id, i, n;
size_t used;
char *set;
-
+
if (((CamelOfflineStore *) engine->service)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
return parent_class->body_contains (f, argc, argv, search);
-
+
summary_set = search->summary_set ? search->summary_set : search->summary;
-
+
/* check the simple cases */
if (argc == 0 || summary_set->len == 0) {
/* match nothing */
@@ -167,7 +167,7 @@
r = e_sexp_result_new (f, ESEXP_RES_ARRAY_PTR);
r->value.ptrarray = g_ptr_array_new ();
}
-
+
return r;
} else if (argc == 1 && argv[0]->type == ESEXP_RES_STRING && argv[0]->value.string[0] == '\0') {
/* match everything */
@@ -184,10 +184,10 @@
r->value.ptrarray->pdata[i] = (char *) camel_message_info_uid (info);
}
}
-
+
return r;
}
-
+
strings = g_ptr_array_new ();
for (i = 0; i < argc; i++) {
if (argv[i]->type == ESEXP_RES_STRING && argv[i]->value.string[0] != '\0') {
@@ -199,17 +199,17 @@
utf8_search = TRUE;
break;
}
-
+
inptr++;
}
}
}
}
-
+
if (strings->len == 0) {
/* match everything */
g_ptr_array_free (strings, TRUE);
-
+
if (search->current) {
r = e_sexp_result_new (f, ESEXP_RES_BOOL);
r->value.bool = TRUE;
@@ -223,14 +223,14 @@
r->value.ptrarray->pdata[i] = (char *) camel_message_info_uid (info);
}
}
-
+
return r;
}
-
+
g_ptr_array_add (strings, NULL);
matches = g_ptr_array_new ();
infos = g_ptr_array_new ();
-
+
if (search->current) {
g_ptr_array_add (infos, search->current);
} else {
@@ -239,39 +239,39 @@
for (i = 0; i < summary_set->len; i++)
infos->pdata[i] = summary_set->pdata[i];
}
-
+
retry:
if (utf8_search && (engine->capa & CAMEL_IMAP4_CAPABILITY_utf8_search))
expr = "UID SEARCH CHARSET UTF-8 UID %s BODY %V\r\n";
else
expr = "UID SEARCH UID %s BODY %V\r\n";
-
+
used = strlen (expr) + (5 * (strings->len - 2));
-
+
for (i = 0; i < infos->len; i += n) {
n = camel_imap4_get_uid_set (engine, search->folder->summary, infos, i, used, &set);
-
+
ic = camel_imap4_engine_queue (engine, search->folder, expr, set, strings->pdata);
camel_imap4_command_register_untagged (ic, "SEARCH", untagged_search);
ic->user_data = matches;
g_free (set);
-
+
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
;
-
+
if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE) {
camel_imap4_command_unref (ic);
goto done;
}
-
-
+
+
if (ic->result == CAMEL_IMAP4_RESULT_NO && utf8_search && (engine->capa & CAMEL_IMAP4_CAPABILITY_utf8_search)) {
int j;
-
+
/* might be because the server is lame and doesn't support UTF-8 */
for (j = 0; j < ic->resp_codes->len; j++) {
CamelIMAP4RespCode *resp = ic->resp_codes->pdata[j];
-
+
if (resp->code == CAMEL_IMAP4_RESP_CODE_BADCHARSET) {
engine->capa &= ~CAMEL_IMAP4_CAPABILITY_utf8_search;
camel_imap4_command_unref (ic);
@@ -279,23 +279,23 @@
}
}
}
-
+
if (ic->result != CAMEL_IMAP4_RESULT_OK) {
camel_imap4_command_unref (ic);
break;
}
-
+
camel_imap4_command_unref (ic);
}
-
+
done:
-
+
g_ptr_array_free (strings, TRUE);
g_ptr_array_free (infos, TRUE);
-
+
if (search->current) {
const char *uid;
-
+
uid = camel_message_info_uid (search->current);
r = e_sexp_result_new (f, ESEXP_RES_BOOL);
r->value.bool = FALSE;
@@ -305,12 +305,12 @@
break;
}
}
-
+
g_ptr_array_free (matches, TRUE);
} else {
r = e_sexp_result_new (f, ESEXP_RES_ARRAY_PTR);
r->value.ptrarray = matches;
}
-
+
return r;
}
Modified: trunk/camel/providers/imap4/camel-imap4-search.h
==============================================================================
--- trunk/camel/providers/imap4/camel-imap4-search.h (original)
+++ trunk/camel/providers/imap4/camel-imap4-search.h Wed May 7 01:20:17 2008
@@ -43,14 +43,14 @@
struct _CamelIMAP4Search {
CamelFolderSearch parent_object;
-
+
struct _CamelIMAP4Engine *engine;
-
+
guint32 lastuid; /* current 'last uid' for the folder */
guint32 validity; /* validity of the current folder */
-
+
CamelDataCache *cache; /* disk-cache for searches */
-
+
/* cache of body search matches */
EDList matches;
GHashTable *matches_hash;
@@ -59,7 +59,7 @@
struct _CamelIMAP4SearchClass {
CamelFolderSearchClass parent_class;
-
+
};
Modified: trunk/camel/providers/imap4/camel-imap4-specials.c
==============================================================================
--- trunk/camel/providers/imap4/camel-imap4-specials.c (original)
+++ trunk/camel/providers/imap4/camel-imap4-specials.c Wed May 7 01:20:17 2008
@@ -57,7 +57,7 @@
imap4_init_bits (unsigned short bit, unsigned short bitcopy, int remove, unsigned char *vals)
{
int i, len = strlen (vals);
-
+
if (!remove) {
for (i = 0; i < len; i++)
camel_imap4_specials[vals[i]] |= bit;
@@ -86,15 +86,15 @@
camel_imap4_specials_init (void)
{
int i;
-
+
for (i = 0; i < 256; i++) {
camel_imap4_specials[i] = 0;
if (i <= 0x1f || i >= 0x7f)
camel_imap4_specials[i] |= IS_CTRL;
}
-
+
camel_imap4_specials[' '] |= IS_SPACE;
-
+
imap4_init_bits (IS_LWSP, 0, 0, CHARS_LWSP);
imap4_init_bits (IS_ASPECIAL, 0, 0, CHARS_ATOM_SPECIALS);
imap4_init_bits (IS_QSPECIAL, 0, 0, CHARS_QUOTED_SPECIALS);
Modified: trunk/camel/providers/imap4/camel-imap4-store-summary.c
==============================================================================
--- trunk/camel/providers/imap4/camel-imap4-store-summary.c (original)
+++ trunk/camel/providers/imap4/camel-imap4-store-summary.c Wed May 7 01:20:17 2008
@@ -60,7 +60,7 @@
camel_imap4_store_summary_get_type (void)
{
static CamelType type = CAMEL_INVALID_TYPE;
-
+
if (type == CAMEL_INVALID_TYPE) {
type = camel_type_register (camel_store_summary_get_type (),
"CamelIMAP4StoreSummary",
@@ -71,7 +71,7 @@
(CamelObjectInitFunc) camel_imap4_store_summary_init,
(CamelObjectFinalizeFunc) camel_imap4_store_summary_finalize);
}
-
+
return type;
}
@@ -80,12 +80,12 @@
camel_imap4_store_summary_class_init (CamelIMAP4StoreSummaryClass *klass)
{
CamelStoreSummaryClass *ssklass = (CamelStoreSummaryClass *) klass;
-
+
parent_class = (CamelStoreSummaryClass *) camel_store_summary_get_type ();
-
+
ssklass->summary_header_load = summary_header_load;
ssklass->summary_header_save = summary_header_save;
-
+
ssklass->store_info_load = store_info_load;
ssklass->store_info_save = store_info_save;
ssklass->store_info_free = store_info_free;
@@ -103,7 +103,7 @@
camel_imap4_store_summary_finalize (CamelObject *obj)
{
CamelIMAP4StoreSummary *s = (CamelIMAP4StoreSummary *) obj;
-
+
if (s->namespaces)
camel_imap4_namespace_list_free (s->namespaces);
}
@@ -115,12 +115,12 @@
CamelIMAP4Namespace *ns, *tail = NULL;
CamelIMAP4NamespaceList *nsl;
guint32 i, j, n;
-
+
nsl = g_malloc (sizeof (CamelIMAP4NamespaceList));
nsl->personal = NULL;
nsl->shared = NULL;
nsl->other = NULL;
-
+
for (j = 0; j < 3; j++) {
switch (j) {
case 0:
@@ -133,22 +133,22 @@
tail = (CamelIMAP4Namespace *) &nsl->other;
break;
}
-
+
if (camel_file_util_decode_fixed_int32 (in, &n) == -1)
goto exception;
-
+
for (i = 0; i < n; i++) {
guint32 sep;
char *path;
-
+
if (camel_file_util_decode_string (in, &path) == -1)
goto exception;
-
+
if (camel_file_util_decode_uint32 (in, &sep) == -1) {
g_free (path);
goto exception;
}
-
+
tail->next = ns = g_malloc (sizeof (CamelIMAP4Namespace));
ns->sep = sep & 0xff;
ns->path = path;
@@ -156,13 +156,13 @@
tail = ns;
}
}
-
+
return nsl;
-
+
exception:
-
+
camel_imap4_namespace_list_free (nsl);
-
+
return NULL;
}
@@ -171,28 +171,28 @@
{
CamelIMAP4StoreSummary *is = (CamelIMAP4StoreSummary *) s;
guint32 version, capa;
-
+
if (parent_class->summary_header_load (s, in) == -1)
return -1;
-
+
if (camel_file_util_decode_fixed_int32 (in, &version) == -1)
return -1;
-
+
is->version = version;
if (version < CAMEL_IMAP4_STORE_SUMMARY_VERSION_0) {
g_warning ("IMAP4 store summary header version too low");
errno = EINVAL;
return -1;
}
-
+
if (camel_file_util_decode_fixed_int32 (in, &capa) == -1)
return -1;
-
+
is->capa = capa;
-
+
if (!(is->namespaces = load_namespaces (in)))
return -1;
-
+
return 0;
}
@@ -201,7 +201,7 @@
{
CamelIMAP4Namespace *ns, *cur = NULL;
guint32 i, n;
-
+
for (i = 0; i < 3; i++) {
switch (i) {
case 0:
@@ -214,25 +214,25 @@
cur = nsl->other;
break;
}
-
+
for (ns = cur, n = 0; ns; n++)
ns = ns->next;
-
+
if (camel_file_util_encode_fixed_int32 (out, n) == -1)
return -1;
-
+
ns = cur;
while (ns != NULL) {
if (camel_file_util_encode_string (out, ns->path) == -1)
return -1;
-
+
if (camel_file_util_encode_uint32 (out, ns->sep) == -1)
return -1;
-
+
ns = ns->next;
}
}
-
+
return 0;
}
@@ -240,19 +240,19 @@
summary_header_save (CamelStoreSummary *s, FILE *out)
{
CamelIMAP4StoreSummary *is = (CamelIMAP4StoreSummary *) s;
-
+
if (parent_class->summary_header_save (s, out) == -1)
return -1;
-
+
if (camel_file_util_encode_fixed_int32 (out, is->version) == -1)
return -1;
-
+
if (camel_file_util_encode_fixed_int32 (out, is->capa) == -1)
return -1;
-
+
if (save_namespaces (out, is->namespaces) == -1)
return -1;
-
+
return 0;
}
@@ -279,7 +279,7 @@
* camel_imap4_store_summary_new:
*
* Create a new CamelIMAP4StoreSummary object.
- *
+ *
* Returns a new CamelIMAP4StoreSummary object.
**/
CamelIMAP4StoreSummary *
@@ -310,31 +310,31 @@
{
CamelStoreSummary *ss = (CamelStoreSummary *) s;
CamelStoreInfo *si;
-
+
if ((si = camel_store_summary_path (ss, fi->full_name))) {
if (fi->unread != -1) {
si->unread = fi->unread;
ss->flags |= CAMEL_STORE_SUMMARY_DIRTY;
}
-
+
if (fi->total != -1) {
si->total = fi->total;
ss->flags |= CAMEL_STORE_SUMMARY_DIRTY;
}
-
+
camel_store_summary_info_free (ss, si);
return;
}
-
+
si = camel_store_summary_info_new (ss);
si->path = g_strdup (fi->full_name);
si->uri = g_strdup (fi->uri);
si->flags = fi->flags;
si->unread = fi->unread;
si->total = fi->total;
-
+
camel_store_summary_add (ss, si);
-
+
/* FIXME: should this be recursive? */
}
@@ -343,7 +343,7 @@
camel_imap4_store_summary_unnote_info (CamelIMAP4StoreSummary *s, CamelFolderInfo *fi)
{
CamelStoreSummary *ss = (CamelStoreSummary *) s;
-
+
camel_store_summary_remove_path (ss, fi->full_name);
}
@@ -368,7 +368,7 @@
} else {
fi->name = g_strdup (name);
}
-
+
return fi;
}
@@ -381,31 +381,31 @@
CamelStoreInfo *si;
size_t toplen, len;
int i;
-
+
toplen = strlen (top);
folders = g_ptr_array_new ();
-
+
for (i = 0; i < ss->folders->len; i++) {
si = ss->folders->pdata[i];
if (strncmp (si->path, top, toplen) != 0)
continue;
-
+
len = strlen (si->path);
if (toplen > 0 && len > toplen && si->path[toplen] != '/')
continue;
-
+
if (len == toplen) {
/* found toplevel folder */
g_ptr_array_add (folders, store_info_to_folder_info (ss, si));
continue;
}
-
+
if ((flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE) || !strchr (si->path + toplen + 1, '/'))
g_ptr_array_add (folders, store_info_to_folder_info (ss, si));
}
-
+
fi = camel_folder_info_build (folders, top, '/', TRUE);
g_ptr_array_free (folders, TRUE);
-
+
return fi;
}
Modified: trunk/camel/providers/imap4/camel-imap4-store-summary.h
==============================================================================
--- trunk/camel/providers/imap4/camel-imap4-store-summary.h (original)
+++ trunk/camel/providers/imap4/camel-imap4-store-summary.h Wed May 7 01:20:17 2008
@@ -52,12 +52,12 @@
struct _CamelIMAP4StoreSummary {
CamelStoreSummary summary;
-
+
struct _CamelIMAP4StoreSummaryPrivate *priv;
-
+
/* header info */
guint32 version;
-
+
CamelIMAP4NamespaceList *namespaces;
guint32 capa;
};
Modified: trunk/camel/providers/imap4/camel-imap4-store.c
==============================================================================
--- trunk/camel/providers/imap4/camel-imap4-store.c (original)
+++ trunk/camel/providers/imap4/camel-imap4-store.c Wed May 7 01:20:17 2008
@@ -84,7 +84,7 @@
camel_imap4_store_get_type (void)
{
static CamelType type = 0;
-
+
if (!type) {
type = camel_type_register (camel_offline_store_get_type (),
"CamelIMAP4Store",
@@ -95,7 +95,7 @@
(CamelObjectInitFunc) camel_imap4_store_init,
(CamelObjectFinalizeFunc) camel_imap4_store_finalize);
}
-
+
return type;
}
@@ -112,12 +112,12 @@
imap4_compare_folder_name (gconstpointer a, gconstpointer b)
{
gconstpointer aname = a, bname = b;
-
+
if (g_ascii_strcasecmp (a, "INBOX") == 0)
aname = "INBOX";
if (g_ascii_strcasecmp (b, "INBOX") == 0)
bname = "INBOX";
-
+
return g_str_equal (aname, bname);
}
@@ -126,18 +126,18 @@
{
CamelServiceClass *service_class = (CamelServiceClass *) klass;
CamelStoreClass *store_class = (CamelStoreClass *) klass;
-
+
parent_class = (CamelOfflineStoreClass *) camel_type_get_global_classfuncs (CAMEL_TYPE_OFFLINE_STORE);
-
+
service_class->construct = imap4_construct;
service_class->get_name = imap4_get_name;
service_class->connect = imap4_connect;
service_class->disconnect = imap4_disconnect;
service_class->query_auth_types = imap4_query_auth_types;
-
+
store_class->hash_folder_name = imap4_hash_folder_name;
store_class->compare_folder_name = imap4_compare_folder_name;
-
+
store_class->get_folder = imap4_get_folder;
store_class->create_folder = imap4_create_folder;
store_class->delete_folder = imap4_delete_folder;
@@ -161,15 +161,15 @@
camel_imap4_store_finalize (CamelObject *object)
{
CamelIMAP4Store *store = (CamelIMAP4Store *) object;
-
+
if (store->summary) {
camel_store_summary_save ((CamelStoreSummary *) store->summary);
camel_object_unref (store->summary);
}
-
+
if (store->engine)
camel_object_unref (store->engine);
-
+
g_free (store->storage_path);
}
@@ -179,29 +179,29 @@
{
CamelIMAP4Store *store = (CamelIMAP4Store *) service;
char *buf;
-
+
CAMEL_SERVICE_CLASS (parent_class)->construct (service, session, provider, url, ex);
if (camel_exception_is_set (ex))
return;
-
+
if (camel_url_get_param (url, "use_lsub"))
((CamelStore *) store)->flags |= CAMEL_STORE_SUBSCRIPTIONS;
-
+
store->storage_path = camel_session_get_storage_path (session, service, ex);
store->engine = camel_imap4_engine_new (service, imap4_reconnect);
-
+
/* setup/load the summary */
buf = g_alloca (strlen (store->storage_path) + 32);
sprintf (buf, "%s/.summary", store->storage_path);
store->summary = camel_imap4_store_summary_new ();
camel_store_summary_set_filename ((CamelStoreSummary *) store->summary, buf);
-
+
buf = camel_url_to_string (service->url, CAMEL_URL_HIDE_ALL);
url = camel_url_new (buf, NULL);
g_free (buf);
camel_store_summary_set_uri_base ((CamelStoreSummary *) store->summary, url);
camel_url_free (url);
-
+
camel_store_summary_load ((CamelStoreSummary *) store->summary);
}
@@ -236,7 +236,7 @@
CamelIMAP4Command *ic;
int id;
#endif
-
+
if (ssl_mode != MODE_CLEAR) {
#ifdef HAVE_SSL
if (ssl_mode == MODE_TLS) {
@@ -248,13 +248,13 @@
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
_("Could not connect to %s: %s"),
service->url->host, _("SSL unavailable"));
-
+
return FALSE;
#endif /* HAVE_SSL */
} else {
tcp_stream = camel_tcp_stream_raw_new ();
}
-
+
if (camel_tcp_stream_connect ((CamelTcpStream *) tcp_stream, ai) == -1) {
if (errno == EINTR)
camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
@@ -264,48 +264,48 @@
_("Could not connect to %s: %s"),
service->url->host,
g_strerror (errno));
-
+
camel_object_unref (tcp_stream);
-
+
return FALSE;
}
-
+
/* set some socket options to better tailor the connection to our needs */
sockopt.option = CAMEL_SOCKOPT_NODELAY;
sockopt.value.no_delay = TRUE;
camel_tcp_stream_setsockopt ((CamelTcpStream *) tcp_stream, &sockopt);
-
+
sockopt.option = CAMEL_SOCKOPT_KEEPALIVE;
sockopt.value.keep_alive = TRUE;
camel_tcp_stream_setsockopt ((CamelTcpStream *) tcp_stream, &sockopt);
-
+
if (camel_imap4_engine_take_stream (engine, tcp_stream, ex) == -1)
return FALSE;
-
+
if (camel_imap4_engine_capability (engine, ex) == -1)
return FALSE;
-
+
camel_imap4_store_summary_set_capabilities (((CamelIMAP4Store *) service)->summary, engine->capa);
-
+
if (ssl_mode != MODE_TLS) {
/* we're done */
return TRUE;
}
-
+
#ifdef HAVE_SSL
if (!(engine->capa & CAMEL_IMAP4_CAPABILITY_STARTTLS)) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Failed to connect to IMAP server %s in secure mode: "
"Server does not support STARTTLS"),
service->url->host);
-
+
return FALSE;
}
-
+
ic = camel_imap4_engine_prequeue (engine, NULL, "STARTTLS\r\n");
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
;
-
+
if (id == -1 || ic->result != CAMEL_IMAP4_RESULT_OK) {
if (ic->result != CAMEL_IMAP4_RESULT_OK) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
@@ -314,27 +314,27 @@
} else {
camel_exception_xfer (ex, &ic->ex);
}
-
+
camel_imap4_command_unref (ic);
-
+
return FALSE;
}
-
+
camel_imap4_command_unref (ic);
-
+
if (camel_tcp_stream_ssl_enable_ssl ((CamelTcpStreamSSL *) tcp_stream) == -1) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Failed to connect to IMAP server %s in secure mode: %s"),
service->url->host, _("TLS negotiations failed"));
return FALSE;
}
-
+
return TRUE;
#else
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Failed to connect to IMAP server %s in secure mode: %s"),
service->url->host, _("SSL is not available in this build"));
-
+
return FALSE;
#endif /* HAVE_SSL */
}
@@ -361,7 +361,7 @@
int mode, ret, i;
const char *port;
char *serv;
-
+
if ((ssl_mode = camel_url_get_param (service->url, "use_ssl"))) {
for (i = 0; ssl_options[i].value; i++)
if (!strcmp (ssl_options[i].value, ssl_mode))
@@ -374,13 +374,13 @@
serv = "imap";
port = "143";
}
-
+
if (service->url->port) {
serv = g_alloca (16);
sprintf (serv, "%d", service->url->port);
port = NULL;
}
-
+
memset (&hints, 0, sizeof (hints));
hints.ai_socktype = SOCK_STREAM;
hints.ai_family = PF_UNSPEC;
@@ -389,14 +389,14 @@
camel_exception_clear (ex);
ai = camel_getaddrinfo (service->url->host, port, &hints, ex);
}
-
+
if (ai == NULL)
return FALSE;
-
+
ret = connect_to_server (engine, ai, mode, ex);
-
+
camel_freeaddrinfo (ai);
-
+
return ret;
}
@@ -406,35 +406,35 @@
/* Perform a single challenge iteration */
CamelSasl *sasl = ic->user_data;
char *challenge;
-
+
if (camel_sasl_authenticated (sasl)) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
_("Cannot authenticate to IMAP server %s using the %s authentication mechanism"),
engine->url->host, engine->url->authmech);
return -1;
}
-
+
while (isspace (*linebuf))
linebuf++;
-
+
if (*linebuf == '\0')
linebuf = NULL;
-
+
if (!(challenge = camel_sasl_challenge_base64 (sasl, (const char *) linebuf, ex)))
return -1;
-
+
d(fprintf (stderr, "sending : %s\r\n", challenge));
-
+
if (camel_stream_printf (engine->ostream, "%s\r\n", challenge) == -1) {
g_free (challenge);
return -1;
}
-
+
g_free (challenge);
-
+
if (camel_stream_flush (engine->ostream) == -1)
return -1;
-
+
return 0;
}
@@ -488,31 +488,31 @@
ic = camel_imap4_engine_prequeue (engine, NULL, "LOGIN %S %S\r\n",
service->url->user, service->url->passwd);
}
-
+
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
;
-
+
if (sasl != NULL)
camel_object_unref (sasl);
-
+
if (id == -1 || ic->status == CAMEL_IMAP4_COMMAND_ERROR) {
/* unrecoverable error */
camel_exception_xfer (ex, &ic->ex);
camel_imap4_command_unref (ic);
-
+
return FALSE;
}
-
+
if (ic->result != CAMEL_IMAP4_RESULT_OK) {
camel_imap4_command_unref (ic);
-
+
/* try again */
-
+
return TRUE;
}
-
+
camel_imap4_command_unref (ic);
-
+
return FALSE;
}
@@ -523,10 +523,10 @@
gboolean reprompt = FALSE;
char *errmsg = NULL;
CamelException lex;
-
+
if (!connect_to_server_wrapper (engine, ex))
return FALSE;
-
+
if (engine->state != CAMEL_IMAP4_ENGINE_AUTHENTICATED) {
#define CANT_USE_AUTHMECH (!g_hash_table_lookup (engine->authtypes, service->url->authmech))
if (service->url->authmech && CANT_USE_AUTHMECH) {
@@ -534,10 +534,10 @@
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
_("Cannot authenticate to IMAP server %s using %s"),
service->url->host, service->url->authmech);
-
+
return FALSE;
}
-
+
camel_exception_init (&lex);
while (imap4_try_authenticate (engine, reprompt, errmsg, &lex)) {
g_free (errmsg);
@@ -548,18 +548,18 @@
reprompt = TRUE;
}
g_free (errmsg);
-
+
if (camel_exception_is_set (&lex)) {
camel_exception_xfer (ex, &lex);
return FALSE;
}
}
-
+
if (camel_imap4_engine_namespace (engine, ex) == -1)
return FALSE;
-
+
camel_imap4_store_summary_set_namespaces (((CamelIMAP4Store *) service)->summary, &engine->namespaces);
-
+
return TRUE;
}
@@ -568,17 +568,17 @@
{
CamelIMAP4Store *store = (CamelIMAP4Store *) service;
gboolean retval;
-
+
if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
return TRUE;
-
+
CAMEL_SERVICE_REC_LOCK (service, connect_lock);
if (store->engine->state == CAMEL_IMAP4_ENGINE_DISCONNECTED)
retval = imap4_reconnect (store->engine, ex);
else
retval = TRUE;
CAMEL_SERVICE_REC_UNLOCK (service, connect_lock);
-
+
return retval;
}
@@ -588,20 +588,20 @@
CamelIMAP4Store *store = (CamelIMAP4Store *) service;
CamelIMAP4Command *ic;
int id;
-
+
if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
return TRUE;
-
+
CAMEL_SERVICE_REC_LOCK (store, connect_lock);
if (clean && store->engine->state != CAMEL_IMAP4_ENGINE_DISCONNECTED) {
ic = camel_imap4_engine_queue (store->engine, NULL, "LOGOUT\r\n");
while ((id = camel_imap4_engine_iterate (store->engine)) < ic->id && id != -1)
;
-
+
camel_imap4_command_unref (ic);
}
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
-
+
return 0;
}
@@ -614,27 +614,27 @@
CamelServiceAuthType *authtype;
GList *sasl_types, *t, *next;
gboolean connected;
-
+
if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
return NULL;
-
+
CAMEL_SERVICE_REC_LOCK (store, connect_lock);
connected = connect_to_server_wrapper (store->engine, ex);
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
if (!connected)
return NULL;
-
+
sasl_types = camel_sasl_authtype_list (FALSE);
for (t = sasl_types; t; t = next) {
authtype = t->data;
next = t->next;
-
+
if (!g_hash_table_lookup (store->engine->authtypes, authtype->authproto)) {
sasl_types = g_list_remove_link (sasl_types, t);
g_list_free_1 (t);
}
}
-
+
return g_list_prepend (sasl_types, &camel_imap4_password_authtype);
}
@@ -644,10 +644,10 @@
char *real_name, *p;
char sep = '\0';
int len;
-
+
if (*folder_name) {
sep = camel_imap4_get_path_delim (((CamelIMAP4Store *) store)->summary, folder_name);
-
+
if (sep != '/') {
p = real_name = g_alloca (strlen (folder_name) + 1);
strcpy (real_name, folder_name);
@@ -656,25 +656,25 @@
*p = sep;
p++;
}
-
+
folder_name = real_name;
}
-
+
real_name = camel_utf8_utf7 (folder_name);
} else
real_name = g_strdup ("");
-
+
if (wildcard) {
len = strlen (real_name);
real_name = g_realloc (real_name, len + 3);
-
+
if (len > 0)
real_name[len++] = sep;
-
+
real_name[len++] = wildcard;
real_name[len] = '\0';
}
-
+
return real_name;
}
@@ -690,48 +690,48 @@
char *utf7_name;
int create;
int id, i;
-
+
CAMEL_SERVICE_REC_LOCK (store, connect_lock);
-
+
if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
if ((flags & CAMEL_STORE_FOLDER_CREATE) != 0) {
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot create IMAP folders in offline mode."));
} else {
folder = camel_imap4_folder_new (store, folder_name, ex);
}
-
+
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
-
+
return folder;
}
-
+
/* make sure the folder exists - try LISTing it? */
utf7_name = imap4_folder_utf7_name (store, folder_name, '\0');
ic = camel_imap4_engine_queue (engine, NULL, "LIST \"\" %S\r\n", utf7_name);
camel_imap4_command_register_untagged (ic, "LIST", camel_imap4_untagged_list);
ic->user_data = array = g_ptr_array_new ();
g_free (utf7_name);
-
+
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
;
-
+
if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE) {
camel_exception_xfer (ex, &ic->ex);
camel_imap4_command_unref (ic);
g_ptr_array_free (array, TRUE);
goto done;
}
-
+
create = array->len == 0;
-
+
for (i = 0; i < array->len; i++) {
list = array->pdata[i];
g_free (list->name);
g_free (list);
}
-
+
g_ptr_array_free (array, TRUE);
-
+
if (ic->result != CAMEL_IMAP4_RESULT_OK) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Cannot get folder `%s' on IMAP server %s: Unknown"),
@@ -739,39 +739,39 @@
camel_imap4_command_unref (ic);
goto done;
}
-
+
camel_imap4_command_unref (ic);
-
+
if (create) {
const char *basename;
char *parent;
int len;
-
+
if (!(flags & CAMEL_STORE_FOLDER_CREATE))
goto done;
-
+
if (!(basename = strrchr (folder_name, '/')))
basename = folder_name;
else
basename++;
-
+
len = basename > folder_name ? (basename - folder_name) - 1 : 0;
parent = g_alloca (len + 1);
memcpy (parent, folder_name, len);
parent[len] = '\0';
-
+
if (!(fi = imap4_create_folder (store, parent, basename, ex)))
goto done;
-
+
camel_store_free_folder_info (store, fi);
}
-
+
folder = camel_imap4_folder_new (store, folder_name, ex);
-
+
done:
-
+
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
-
+
return folder;
}
@@ -786,48 +786,48 @@
GPtrArray *array;
char *utf7_name;
int id, i;
-
+
CAMEL_SERVICE_REC_LOCK (store, connect_lock);
-
+
utf7_name = imap4_folder_utf7_name (store, folder_name, '\0');
-
+
ic = camel_imap4_engine_queue (engine, NULL, "LIST \"\" %S\r\n", utf7_name);
camel_imap4_command_register_untagged (ic, "LIST", camel_imap4_untagged_list);
ic->user_data = array = g_ptr_array_new ();
-
+
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
;
-
+
if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE) {
camel_exception_xfer (ex, &ic->ex);
camel_imap4_command_unref (ic);
-
+
for (i = 0; i < array->len; i++) {
list = array->pdata[i];
g_free (list->name);
g_free (list);
}
-
+
goto done;
}
-
+
if (ic->result != CAMEL_IMAP4_RESULT_OK) {
camel_imap4_command_unref (ic);
-
+
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Cannot get LIST information for `%s' on IMAP server %s: %s"),
folder_name, engine->url->host, ic->result == CAMEL_IMAP4_RESULT_BAD ?
_("Bad command") : _("Unknown"));
-
+
for (i = 0; i < array->len; i++) {
list = array->pdata[i];
g_free (list->name);
g_free (list);
}
-
+
goto done;
}
-
+
flags = 0;
for (i = 0; i < array->len; i++) {
list = array->pdata[i];
@@ -836,14 +836,14 @@
g_free (list->name);
g_free (list);
}
-
+
done:
-
+
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
-
+
g_ptr_array_free (array, TRUE);
g_free (utf7_name);
-
+
return (flags & CAMEL_FOLDER_NOINFERIORS) == 0;
}
@@ -888,9 +888,9 @@
fi->flags = 0;
fi->unread = -1;
fi->total = -1;
-
+
camel_imap4_store_summary_note_info (((CamelIMAP4Store *) store)->summary, fi);
-
+
camel_object_trigger_event (store, "folder_created", fi);
break;
case CAMEL_IMAP4_RESULT_NO:
@@ -907,13 +907,13 @@
default:
g_assert_not_reached ();
}
-
+
camel_imap4_command_unref (ic);
-
+
done:
-
+
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
-
+
return fi;
}
@@ -923,19 +923,19 @@
CamelFolderInfo *fi = NULL;
char hint[2];
char sep;
-
+
sep = camel_imap4_get_path_delim (((CamelIMAP4Store *) store)->summary, folder_name);
sprintf (hint, "%c", sep);
-
+
imap4_delete_folder (store, folder_name, ex);
if (camel_exception_is_set (ex))
return FALSE;
-
+
if (!(fi = imap4_folder_create (store, folder_name, hint, ex)))
return FALSE;
-
+
camel_folder_info_free (fi);
-
+
return TRUE;
}
@@ -946,9 +946,9 @@
const char *c;
char *name;
char sep;
-
+
sep = camel_imap4_get_path_delim (((CamelIMAP4Store *) store)->summary, parent_name);
-
+
c = folder_name;
while (*c != '\0') {
if (*c == sep || strchr ("/#%*", *c)) {
@@ -958,38 +958,38 @@
folder_name, *c);
return NULL;
}
-
+
c++;
}
-
+
if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot create IMAP folders in offline mode."));
return NULL;
}
-
+
if (parent_name != NULL && *parent_name) {
CamelException lex;
-
+
camel_exception_init (&lex);
if (!imap4_folder_can_contain_folders (store, parent_name, &lex)) {
if (camel_exception_is_set (&lex)) {
camel_exception_xfer (ex, &lex);
return NULL;
}
-
+
if (!imap4_folder_recreate (store, parent_name, &lex)) {
camel_exception_xfer (ex, &lex);
return NULL;
}
}
-
+
name = g_strdup_printf ("%s/%s", parent_name, folder_name);
} else
name = g_strdup (folder_name);
-
+
fi = imap4_folder_create (store, name, "", ex);
g_free (name);
-
+
return fi;
}
@@ -1063,11 +1063,11 @@
fi->flags = 0;
fi->unread = -1;
fi->total = -1;
-
+
camel_imap4_store_summary_unnote_info (((CamelIMAP4Store *) store)->summary, fi);
-
+
camel_object_trigger_event (store, "folder_deleted", fi);
-
+
camel_folder_info_free (fi);
break;
case CAMEL_IMAP4_RESULT_NO:
@@ -1082,9 +1082,9 @@
folder_name);
break;
}
-
+
camel_imap4_command_unref (ic);
-
+
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
}
@@ -1095,39 +1095,39 @@
char *old_uname, *new_uname;
CamelIMAP4Command *ic;
int id;
-
+
if (!g_ascii_strcasecmp (old_name, "INBOX")) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Cannot rename folder `%s' to `%s': Special folder"),
old_name, new_name);
-
+
return;
}
-
+
if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot rename IMAP folders in offline mode."));
return;
}
-
+
CAMEL_SERVICE_REC_LOCK (store, connect_lock);
-
+
old_uname = imap4_folder_utf7_name (store, old_name, '\0');
new_uname = imap4_folder_utf7_name (store, new_name, '\0');
-
+
ic = camel_imap4_engine_queue (engine, NULL, "RENAME %S %S\r\n", old_uname, new_uname);
g_free (old_uname);
g_free (new_uname);
-
+
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
;
-
+
if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE) {
camel_exception_xfer (ex, &ic->ex);
camel_imap4_command_unref (ic);
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
return;
}
-
+
switch (ic->result) {
case CAMEL_IMAP4_RESULT_OK:
/* FIXME: need to update state on the renamed folder object */
@@ -1145,9 +1145,9 @@
old_name, new_name);
break;
}
-
+
camel_imap4_command_unref (ic);
-
+
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
}
@@ -1162,7 +1162,7 @@
{
camel_imap4_list_t *list, *last;
int i;
-
+
last = array->pdata[0];
for (i = 1; i < array->len; i++) {
list = array->pdata[i];
@@ -1263,23 +1263,23 @@
GPtrArray *array;
char *mailbox;
int id, i;
-
+
mailbox = imap4_folder_utf7_name (store, fi->full_name, '\0');
ic = camel_imap4_engine_queue (engine, NULL, "STATUS %S (MESSAGES UNSEEN)\r\n", mailbox);
g_free (mailbox);
-
+
camel_imap4_command_register_untagged (ic, "STATUS", camel_imap4_untagged_status);
ic->user_data = array = g_ptr_array_new ();
-
+
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
;
-
+
if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE) {
camel_imap4_command_unref (ic);
g_ptr_array_free (array, TRUE);
return;
}
-
+
for (i = 0; i < array->len; i++) {
status = array->pdata[i];
attr = status->attr_list;
@@ -1292,11 +1292,11 @@
g_free (attr);
attr = next;
}
-
+
g_free (status->mailbox);
g_free (status);
}
-
+
camel_imap4_command_unref (ic);
g_ptr_array_free (array, TRUE);
}
@@ -1310,26 +1310,26 @@
GPtrArray *array;
char *mailbox;
int id, i;
-
+
mailbox = imap4_folder_utf7_name (store, fi->full_name, '\0');
ic = camel_imap4_engine_queue (engine, NULL, "LSUB \"\" %S\r\n", mailbox);
camel_imap4_command_register_untagged (ic, "LSUB", camel_imap4_untagged_list);
ic->user_data = array = g_ptr_array_new ();
-
+
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
;
-
+
camel_imap4_command_unref (ic);
for (i = 0; i < array->len; i++) {
lsub = array->pdata[i];
-
+
if (!strcmp (lsub->name, mailbox))
fi->flags |= CAMEL_FOLDER_SUBSCRIBED;
-
+
g_free (lsub->name);
g_free (lsub);
}
-
+
g_ptr_array_free (array, TRUE);
}
@@ -1433,20 +1433,20 @@
char *pattern;
char wildcard;
int id, i;
-
+
if (top == NULL)
top = "";
-
+
if (!(namespace = camel_url_get_param (((CamelService *) store)->url, "namespace")))
namespace = "";
-
+
if (!strcmp (top, ""))
base = namespace;
else
base = top;
-
+
CAMEL_SERVICE_REC_LOCK (store, connect_lock);
-
+
#ifdef USE_FOLDER_INFO_CACHE_LOGIC_FOR_SPEED
if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL
|| engine->state == CAMEL_IMAP4_ENGINE_DISCONNECTED) {
@@ -1459,7 +1459,7 @@
fi = inbox;
}
}
-
+
if (fi == NULL && ((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL) {
/* folder info hasn't yet been cached and the store hasn't been
* connected yet, but the network is available so we can connect
@@ -1487,20 +1487,20 @@
return fi;
}
#endif
-
+
#ifdef USE_FOLDER_INFO_CACHE_LOGIC_FOR_SPEED
check_online:
#endif
-
+
if (flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED)
cmd = "LSUB";
else
cmd = "LIST";
-
+
wildcard = (flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE) ? '*' : '%';
pattern = imap4_folder_utf7_name (store, base, wildcard);
array = g_ptr_array_new ();
-
+
if (base == namespace && *namespace) {
/* Make sure to get INBOX: we always use LIST so the user sees his/her INBOX even
if it isn't subscribed and the user has enabled "Only show subscribed folders" */
@@ -1508,29 +1508,29 @@
camel_imap4_command_register_untagged (ic1, "LIST", camel_imap4_untagged_list);
ic1->user_data = array;
}
-
+
if (*top != '\0') {
size_t len;
char sep;
-
+
len = strlen (pattern);
sep = pattern[len - 2];
pattern[len - 2] = '\0';
-
+
ic0 = camel_imap4_engine_queue (engine, NULL, "%s \"\" %S\r\n", cmd, pattern);
camel_imap4_command_register_untagged (ic0, cmd, camel_imap4_untagged_list);
ic0->user_data = array;
-
+
pattern[len - 2] = sep;
}
-
+
ic = camel_imap4_engine_queue (engine, NULL, "%s \"\" %S\r\n", cmd, pattern);
camel_imap4_command_register_untagged (ic, cmd, camel_imap4_untagged_list);
ic->user_data = array;
-
+
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
;
-
+
if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE) {
if (ic1 && ic1->status != CAMEL_IMAP4_COMMAND_COMPLETE)
camel_exception_xfer (ex, &ic1->ex);
@@ -1538,62 +1538,62 @@
camel_exception_xfer (ex, &ic0->ex);
else
camel_exception_xfer (ex, &ic->ex);
-
+
if (ic1 != NULL)
camel_imap4_command_unref (ic1);
-
+
if (ic0 != NULL)
camel_imap4_command_unref (ic0);
-
+
camel_imap4_command_unref (ic);
-
+
for (i = 0; i < array->len; i++) {
list = array->pdata[i];
g_free (list->name);
g_free (list);
}
-
+
g_ptr_array_free (array, TRUE);
g_free (pattern);
-
+
goto done;
}
-
+
if (ic1 != NULL)
camel_imap4_command_unref (ic1);
-
+
if (ic0 != NULL)
camel_imap4_command_unref (ic0);
-
+
if (ic->result != CAMEL_IMAP4_RESULT_OK) {
camel_imap4_command_unref (ic);
-
+
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Cannot get %s information for pattern `%s' on IMAP server %s: %s"),
cmd, pattern, engine->url->host, ic->result == CAMEL_IMAP4_RESULT_BAD ?
_("Bad command") : _("Unknown"));
-
+
for (i = 0; i < array->len; i++) {
list = array->pdata[i];
g_free (list->name);
g_free (list);
}
-
+
g_ptr_array_free (array, TRUE);
-
+
g_free (pattern);
-
+
goto done;
}
-
+
g_free (pattern);
-
+
fi = imap4_build_folder_info (store, top, flags, array);
-
+
done:
-
+
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
-
+
return fi;
}
@@ -1645,9 +1645,9 @@
fi->flags = CAMEL_FOLDER_NOCHILDREN;
fi->unread = -1;
fi->total = -1;
-
+
camel_imap4_store_summary_note_info (((CamelIMAP4Store *) store)->summary, fi);
-
+
camel_object_trigger_event (store, "folder_subscribed", fi);
camel_folder_info_free (fi);
break;
@@ -1663,9 +1663,9 @@
folder_name);
break;
}
-
+
camel_imap4_command_unref (ic);
-
+
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
}
@@ -1717,9 +1717,9 @@
fi->flags = 0;
fi->unread = -1;
fi->total = -1;
-
+
camel_imap4_store_summary_unnote_info (((CamelIMAP4Store *) store)->summary, fi);
-
+
camel_object_trigger_event (store, "folder_unsubscribed", fi);
camel_folder_info_free (fi);
break;
@@ -1735,9 +1735,9 @@
folder_name);
break;
}
-
+
camel_imap4_command_unref (ic);
-
+
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
}
@@ -1748,12 +1748,12 @@
CamelFolder *folder = (CamelFolder *) engine->folder;
CamelIMAP4Command *ic;
int id;
-
+
if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
return;
-
+
CAMEL_SERVICE_REC_LOCK (store, connect_lock);
-
+
if (folder) {
camel_folder_sync (folder, FALSE, ex);
if (camel_exception_is_set (ex)) {
@@ -1761,18 +1761,18 @@
return;
}
}
-
+
ic = camel_imap4_engine_queue (engine, NULL, "NOOP\r\n");
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
;
-
+
if (id == -1 || ic->status != CAMEL_IMAP4_COMMAND_COMPLETE)
camel_exception_xfer (ex, &ic->ex);
-
+
camel_imap4_command_unref (ic);
-
+
if (folder && !camel_exception_is_set (ex))
camel_imap4_summary_flush_updates (folder->summary, ex);
-
+
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
}
Modified: trunk/camel/providers/imap4/camel-imap4-store.h
==============================================================================
--- trunk/camel/providers/imap4/camel-imap4-store.h (original)
+++ trunk/camel/providers/imap4/camel-imap4-store.h Wed May 7 01:20:17 2008
@@ -41,7 +41,7 @@
struct _CamelIMAP4Store {
CamelOfflineStore parent_object;
-
+
struct _CamelIMAP4StoreSummary *summary;
struct _CamelIMAP4Engine *engine;
char *storage_path;
@@ -49,7 +49,7 @@
struct _CamelIMAP4StoreClass {
CamelOfflineStoreClass parent_class;
-
+
};
Modified: trunk/camel/providers/imap4/camel-imap4-stream.c
==============================================================================
--- trunk/camel/providers/imap4/camel-imap4-stream.c (original)
+++ trunk/camel/providers/imap4/camel-imap4-stream.c Wed May 7 01:20:17 2008
@@ -57,7 +57,7 @@
camel_imap4_stream_get_type (void)
{
static CamelType type = 0;
-
+
if (!type) {
type = camel_type_register (CAMEL_STREAM_TYPE,
"CamelIMAP4Stream",
@@ -68,7 +68,7 @@
(CamelObjectInitFunc) camel_imap4_stream_init,
(CamelObjectFinalizeFunc) camel_imap4_stream_finalize);
}
-
+
return type;
}
@@ -76,9 +76,9 @@
camel_imap4_stream_class_init (CamelIMAP4StreamClass *klass)
{
CamelStreamClass *stream_class = (CamelStreamClass *) klass;
-
+
parent_class = (CamelStreamClass *) camel_type_get_global_classfuncs (CAMEL_STREAM_TYPE);
-
+
/* virtual method overload */
stream_class->read = stream_read;
stream_class->write = stream_write;
@@ -91,18 +91,18 @@
camel_imap4_stream_init (CamelIMAP4Stream *imap4, CamelIMAP4StreamClass *klass)
{
imap4->stream = NULL;
-
+
imap4->mode = CAMEL_IMAP4_STREAM_MODE_TOKEN;
imap4->disconnected = FALSE;
imap4->have_unget = FALSE;
imap4->eol = FALSE;
-
+
imap4->literal = 0;
-
+
imap4->inbuf = imap4->realbuf + IMAP4_READ_PRELEN;
imap4->inptr = imap4->inbuf;
imap4->inend = imap4->inbuf;
-
+
imap4->tokenbuf = g_malloc (IMAP4_TOKEN_LEN);
imap4->tokenptr = imap4->tokenbuf;
imap4->tokenleft = IMAP4_TOKEN_LEN;
@@ -112,10 +112,10 @@
camel_imap4_stream_finalize (CamelObject *object)
{
CamelIMAP4Stream *imap4 = (CamelIMAP4Stream *) object;
-
+
if (imap4->stream)
camel_object_unref (imap4->stream);
-
+
g_free (imap4->tokenbuf);
}
@@ -126,19 +126,19 @@
unsigned char *inbuf, *inptr, *inend;
ssize_t nread;
size_t inlen;
-
+
if (imap4->disconnected) {
errno = EINVAL;
return -1;
}
-
+
inbuf = imap4->inbuf;
inptr = imap4->inptr;
inend = imap4->inend;
inlen = inend - inptr;
-
+
g_assert (inptr <= inend);
-
+
/* attempt to align 'inend' with realbuf + SCAN_HEAD */
if (inptr >= inbuf) {
inbuf -= inlen < IMAP4_READ_PRELEN ? inlen : IMAP4_READ_PRELEN;
@@ -147,7 +147,7 @@
inbuf += inlen;
} else if (inptr > imap4->realbuf) {
size_t shift;
-
+
shift = MIN (inptr - imap4->realbuf, inend - inbuf);
memmove (inptr - shift, inptr, inlen);
inptr -= shift;
@@ -156,18 +156,18 @@
/* we can't shift... */
inbuf = inend;
}
-
+
imap4->inptr = inptr;
imap4->inend = inbuf;
inend = imap4->realbuf + IMAP4_READ_PRELEN + IMAP4_READ_BUFLEN - 1;
-
+
if ((nread = camel_stream_read (imap4->stream, inbuf, inend - inbuf)) == -1)
return -1;
else if (nread == 0)
imap4->disconnected = TRUE;
-
+
imap4->inend += nread;
-
+
return imap4->inend - imap4->inptr;
}
@@ -176,37 +176,37 @@
{
CamelIMAP4Stream *imap4 = (CamelIMAP4Stream *) stream;
ssize_t len, nread = 0;
-
+
if (imap4->mode == CAMEL_IMAP4_STREAM_MODE_LITERAL) {
/* don't let our caller read past the end of the literal */
n = MIN (n, imap4->literal);
}
-
+
if (imap4->inptr < imap4->inend) {
len = MIN (n, imap4->inend - imap4->inptr);
memcpy (buffer, imap4->inptr, len);
imap4->inptr += len;
nread = len;
}
-
+
if (nread < n) {
if ((len = camel_stream_read (imap4->stream, buffer + nread, n - nread)) == 0)
imap4->disconnected = TRUE;
else if (len == -1)
return -1;
-
+
nread += len;
}
-
+
if (imap4->mode == CAMEL_IMAP4_STREAM_MODE_LITERAL) {
imap4->literal -= nread;
-
+
if (imap4->literal == 0) {
imap4->mode = CAMEL_IMAP4_STREAM_MODE_TOKEN;
imap4->eol = TRUE;
}
}
-
+
return nread;
}
@@ -215,15 +215,15 @@
{
CamelIMAP4Stream *imap4 = (CamelIMAP4Stream *) stream;
ssize_t nwritten;
-
+
if (imap4->disconnected) {
errno = EINVAL;
return -1;
}
-
+
if ((nwritten = camel_stream_write (imap4->stream, buffer, n)) == 0)
imap4->disconnected = TRUE;
-
+
return nwritten;
}
@@ -231,7 +231,7 @@
stream_flush (CamelStream *stream)
{
CamelIMAP4Stream *imap4 = (CamelIMAP4Stream *) stream;
-
+
return camel_stream_flush (imap4->stream);
}
@@ -239,15 +239,15 @@
stream_close (CamelStream *stream)
{
CamelIMAP4Stream *imap4 = (CamelIMAP4Stream *) stream;
-
+
if (camel_stream_close (imap4->stream) == -1)
return -1;
-
+
camel_object_unref (imap4->stream);
imap4->stream = NULL;
-
+
imap4->disconnected = TRUE;
-
+
return 0;
}
@@ -255,16 +255,16 @@
stream_eos (CamelStream *stream)
{
CamelIMAP4Stream *imap4 = (CamelIMAP4Stream *) stream;
-
+
if (imap4->eol)
return TRUE;
-
+
if (imap4->disconnected && imap4->inptr == imap4->inend)
return TRUE;
-
+
if (camel_stream_eos (imap4->stream))
return TRUE;
-
+
return FALSE;
}
@@ -279,13 +279,13 @@
camel_imap4_stream_new (CamelStream *stream)
{
CamelIMAP4Stream *imap4;
-
+
g_return_val_if_fail (CAMEL_IS_STREAM (stream), NULL);
-
+
imap4 = (CamelIMAP4Stream *) camel_object_new (CAMEL_TYPE_IMAP4_STREAM);
camel_object_ref (stream);
imap4->stream = stream;
-
+
return (CamelStream *) imap4;
}
@@ -336,23 +336,23 @@
size_t literal = 0;
guint32 nz_number;
int ret;
-
+
g_return_val_if_fail (CAMEL_IS_IMAP4_STREAM (stream), -1);
g_return_val_if_fail (stream->mode != CAMEL_IMAP4_STREAM_MODE_LITERAL, -1);
g_return_val_if_fail (token != NULL, -1);
-
+
if (stream->have_unget) {
memcpy (token, &stream->unget, sizeof (camel_imap4_token_t));
stream->have_unget = FALSE;
return 0;
}
-
+
token_clear (stream);
-
+
inptr = stream->inptr;
inend = stream->inend;
*inend = '\0';
-
+
do {
if (inptr == inend) {
if ((ret = imap4_fill (stream)) < 0) {
@@ -362,31 +362,31 @@
token->token = CAMEL_IMAP4_TOKEN_NO_DATA;
return 0;
}
-
+
inptr = stream->inptr;
inend = stream->inend;
*inend = '\0';
}
-
+
while (*inptr == ' ' || *inptr == '\r')
inptr++;
} while (inptr == inend);
-
+
do {
if (inptr < inend) {
if (*inptr == '"') {
/* qstring token */
escaped = FALSE;
start = inptr;
-
+
/* eat the beginning " */
inptr++;
-
+
p = inptr;
while (inptr < inend) {
if (*inptr == '"' && !escaped)
break;
-
+
if (*inptr == '\\' && !escaped) {
token_save (stream, p, inptr - p);
escaped = TRUE;
@@ -397,82 +397,82 @@
escaped = FALSE;
}
}
-
+
token_save (stream, p, inptr - p);
-
+
if (inptr == inend) {
stream->inptr = start;
goto refill;
}
-
+
/* eat the ending " */
inptr++;
-
+
/* nul-terminate the atom token */
token_save (stream, "", 1);
-
+
token->token = CAMEL_IMAP4_TOKEN_QSTRING;
token->v.qstring = stream->tokenbuf;
-
+
d(fprintf (stderr, "token: \"%s\"\n", token->v.qstring));
-
+
break;
} else if (strchr ("+*()[]\n", *inptr)) {
/* special character token */
token->token = *inptr++;
-
+
if (camel_debug ("imap4:stream")) {
if (token->token != '\n')
fprintf (stderr, "token: %c\n", token->token);
else
fprintf (stderr, "token: \\n\n");
}
-
+
break;
} else if (*inptr == '{') {
/* literal identifier token */
if ((p = strchr (inptr, '}')) && strchr (p, '\n')) {
inptr++;
-
+
while (isdigit ((int) *inptr) && literal < UINT_MAX / 10)
literal = (literal * 10) + (*inptr++ - '0');
-
+
if (*inptr != '}') {
if (isdigit ((int) *inptr))
g_warning ("illegal literal identifier: literal too large");
else if (*inptr != '+')
g_warning ("illegal literal identifier: garbage following size");
-
+
while (*inptr != '}')
inptr++;
}
-
+
/* skip over '}' */
inptr++;
-
+
/* skip over any trailing whitespace */
while (*inptr == ' ' || *inptr == '\r')
inptr++;
-
+
if (*inptr != '\n') {
g_warning ("illegal token following literal identifier: %s", inptr);
-
+
/* skip ahead to the eoln */
inptr = strchr (inptr, '\n');
}
-
+
/* skip over '\n' */
inptr++;
-
+
token->token = CAMEL_IMAP4_TOKEN_LITERAL;
token->v.literal = literal;
-
+
d(fprintf (stderr, "token: {%lu}\n", literal));
-
+
stream->mode = CAMEL_IMAP4_STREAM_MODE_LITERAL;
stream->literal = literal;
stream->eol = FALSE;
-
+
break;
} else {
stream->inptr = inptr;
@@ -484,37 +484,37 @@
nz_number = strtoul ((char *) inptr, (char **) &start, 10);
if (start == inend)
goto refill;
-
+
if (*start == ':' || *start == ',') {
/* workaround for 'set' tokens (APPENDUID / COPYUID) */
goto atom_token;
}
-
+
inptr = start;
token->token = CAMEL_IMAP4_TOKEN_NUMBER;
token->v.number = nz_number;
-
+
d(fprintf (stderr, "token: %lu\n", nz_number));
-
+
break;
} else if (is_atom (*inptr)) {
atom_token:
/* simple atom token */
start = inptr;
-
+
while (inptr < inend && is_atom (*inptr))
inptr++;
-
+
if (inptr == inend) {
stream->inptr = start;
goto refill;
}
-
+
token_save (stream, start, inptr - start);
-
+
/* nul-terminate the atom token */
token_save (stream, "", 1);
-
+
if (!strcmp (stream->tokenbuf, "NIL")) {
/* special atom token */
token->token = CAMEL_IMAP4_TOKEN_NIL;
@@ -524,30 +524,30 @@
token->v.atom = stream->tokenbuf;
d(fprintf (stderr, "token: %s\n", token->v.atom));
}
-
+
break;
} else if (*inptr == '\\') {
/* possible flag token ("\" atom) */
start = inptr++;
-
+
while (inptr < inend && is_atom (*inptr))
inptr++;
-
+
if (inptr == inend) {
stream->inptr = start;
goto refill;
}
-
+
/* handle the \* case */
if ((inptr - start) == 1 && *inptr == '*')
inptr++;
-
+
if ((inptr - start) > 1) {
token_save (stream, start, inptr - start);
-
+
/* nul-terminate the flag token */
token_save (stream, "", 1);
-
+
token->token = CAMEL_IMAP4_TOKEN_FLAG;
token->v.atom = stream->tokenbuf;
d(fprintf (stderr, "token: %s\n", token->v.atom));
@@ -567,20 +567,20 @@
} else {
refill:
token_clear (stream);
-
+
if (imap4_fill (stream) <= 0) {
token->token = CAMEL_IMAP4_TOKEN_ERROR;
return -1;
}
-
+
inptr = stream->inptr;
inend = stream->inend;
*inend = '\0';
}
} while (inptr < inend);
-
+
stream->inptr = inptr;
-
+
return 0;
}
@@ -602,12 +602,12 @@
{
if (stream->have_unget)
return -1;
-
+
if (token->token != CAMEL_IMAP4_TOKEN_NO_DATA) {
memcpy (&stream->unget, token, sizeof (camel_imap4_token_t));
stream->have_unget = TRUE;
}
-
+
return 0;
}
@@ -630,46 +630,46 @@
{
register unsigned char *inptr;
unsigned char *inend;
-
+
g_return_val_if_fail (CAMEL_IS_IMAP4_STREAM (stream), -1);
g_return_val_if_fail (stream->mode != CAMEL_IMAP4_STREAM_MODE_LITERAL, -1);
g_return_val_if_fail (line != NULL, -1);
g_return_val_if_fail (len != NULL, -1);
-
+
inptr = stream->inptr;
inend = stream->inend;
-
+
*inend = '\0';
if (inptr == inend || ((inend - inptr) < 2 && *inptr != '\n')) {
if (imap4_fill (stream) == -1 && stream->inptr == stream->inend)
return -1;
}
-
+
*line = stream->inptr;
inptr = stream->inptr;
inend = stream->inend;
*inend = '\n';
-
+
while (*inptr != '\n')
inptr++;
-
+
*len = (inptr - stream->inptr);
-
+
if (inptr > stream->inptr && inptr[-1] == '\r')
inptr[-1] = '\0';
-
+
if (inptr < inend) {
/* got the eoln */
inptr[0] = '\0';
*len += 1;
-
+
stream->inptr = inptr + 1;
-
+
return 0;
}
-
+
stream->inptr = inptr;
-
+
return 1;
}
@@ -692,40 +692,40 @@
{
unsigned char *inptr, *inend;
size_t nread;
-
+
g_return_val_if_fail (CAMEL_IS_IMAP4_STREAM (stream), -1);
g_return_val_if_fail (stream->mode == CAMEL_IMAP4_STREAM_MODE_LITERAL, -1);
g_return_val_if_fail (literal != NULL, -1);
g_return_val_if_fail (len != NULL, -1);
-
+
if (stream->eol) {
*len = 0;
return 0;
}
-
+
if ((stream->inend - stream->inptr) < 1) {
/* keep our buffer full to the optimal size */
if (imap4_fill (stream) == -1 && stream->inptr == stream->inend)
return -1;
}
-
+
*literal = inptr = stream->inptr;
inend = stream->inend;
if ((inend - inptr) > stream->literal)
inend = inptr + stream->literal;
else
inend = stream->inend;
-
+
*len = nread = inend - inptr;
-
+
stream->literal -= nread;
stream->inptr += nread;
-
+
if (stream->literal == 0) {
stream->mode = CAMEL_IMAP4_STREAM_MODE_TOKEN;
stream->eol = TRUE;
return 0;
}
-
+
return 1;
}
Modified: trunk/camel/providers/imap4/camel-imap4-stream.h
==============================================================================
--- trunk/camel/providers/imap4/camel-imap4-stream.h (original)
+++ trunk/camel/providers/imap4/camel-imap4-stream.h Wed May 7 01:20:17 2008
@@ -75,33 +75,33 @@
struct _CamelIMAP4Stream {
CamelStream parent_object;
-
+
CamelStream *stream;
-
+
guint disconnected:1; /* disconnected state */
guint have_unget:1; /* have an unget token */
guint mode:1; /* TOKEN vs LITERAL */
guint eol:1; /* end-of-literal */
-
+
size_t literal;
-
+
/* i/o buffers */
unsigned char realbuf[IMAP4_READ_PRELEN + IMAP4_READ_BUFLEN + 1];
unsigned char *inbuf;
unsigned char *inptr;
unsigned char *inend;
-
+
/* token buffers */
unsigned char *tokenbuf;
unsigned char *tokenptr;
unsigned int tokenleft;
-
+
camel_imap4_token_t unget;
};
struct _CamelIMAP4StreamClass {
CamelStreamClass parent_class;
-
+
/* Virtual methods */
};
Modified: trunk/camel/providers/imap4/camel-imap4-summary.h
==============================================================================
--- trunk/camel/providers/imap4/camel-imap4-summary.h (original)
+++ trunk/camel/providers/imap4/camel-imap4-summary.h Wed May 7 01:20:17 2008
@@ -51,33 +51,33 @@
struct _CamelIMAP4MessageInfo {
CamelMessageInfoBase info;
-
+
guint32 server_flags;
};
struct _CamelIMAP4MessageContentInfo {
CamelMessageContentInfo info;
-
+
};
struct _CamelIMAP4Summary {
CamelFolderSummary parent_object;
-
+
guint32 version;
-
+
guint32 exists;
guint32 recent;
guint32 unseen;
-
+
guint32 uidvalidity;
-
+
guint uidvalidity_changed:1;
guint update_flags:1;
};
struct _CamelIMAP4SummaryClass {
CamelFolderSummaryClass parent_class;
-
+
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]