diff options
author | Jeffrey Stedfast <fejj@novell.com> | 2004-07-27 05:24:20 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-07-27 05:24:20 +0800 |
commit | 8cfdad88c98a0e7a7f09e7ae07cff451a9c6cce4 (patch) | |
tree | 340b2752994e8c4ded399c2247d1a106b74e0189 /camel/providers/imap4/camel-imap4-engine.c | |
parent | bde01cf042eeb5ea55874828a334ad1cbb492108 (diff) | |
download | gsoc2013-evolution-8cfdad88c98a0e7a7f09e7ae07cff451a9c6cce4.tar.gz gsoc2013-evolution-8cfdad88c98a0e7a7f09e7ae07cff451a9c6cce4.tar.zst gsoc2013-evolution-8cfdad88c98a0e7a7f09e7ae07cff451a9c6cce4.zip |
Don't instantiate an engine here. Instead, take an engine as an argument
2004-07-26 Jeffrey Stedfast <fejj@novell.com>
* providers/imap4/camel-imap4-store.c (connect_to_server): Don't
instantiate an engine here. Instead, take an engine as an argument
(it has a service pointer) and connect using that. Also, if
connect fails, don't unref the engine.
(connect_to_server_wrapper): Now also takes an engine argument
rather than a service argument.
(imap4_try_authenticate): Now also takes an engine argument.
(imap4_connect): Pass the engine to connect/auth functions rather
than the store.
(imap4_query_auth_types): Updated.
(imap4_disconnect): Don't unref the engine here.
(camel_imap4_store_init): Create the engine here.
(imap4_get_folder_info): Can't check engine == NULL to know to
connect (that was a broken check anyway).
* providers/imap4/camel-imap4-engine.c (camel_imap4_engine_new):
Now simply takes a service argument rather than a session and url.
(camel_imap4_engine_next_token): Set the state to DISCONNECTED.
(camel_imap4_engine_eat_line): Same.
(camel_imap4_engine_line): Same.
(camel_imap4_engine_literal): Same.
svn path=/trunk/; revision=26740
Diffstat (limited to 'camel/providers/imap4/camel-imap4-engine.c')
-rw-r--r-- | camel/providers/imap4/camel-imap4-engine.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/camel/providers/imap4/camel-imap4-engine.c b/camel/providers/imap4/camel-imap4-engine.c index bd5ebfff07..40501ae399 100644 --- a/camel/providers/imap4/camel-imap4-engine.c +++ b/camel/providers/imap4/camel-imap4-engine.c @@ -82,6 +82,7 @@ camel_imap4_engine_init (CamelIMAP4Engine *engine, CamelIMAP4EngineClass *klass) engine->level = CAMEL_IMAP4_LEVEL_UNKNOWN; engine->session = NULL; + engine->service = NULL; engine->url = NULL; engine->istream = NULL; @@ -134,9 +135,6 @@ camel_imap4_engine_finalize (CamelObject *object) CamelIMAP4Engine *engine = (CamelIMAP4Engine *) object; EDListNode *node; - if (engine->session) - camel_object_unref (engine->session); - if (engine->istream) camel_object_unref (engine->istream); @@ -164,22 +162,21 @@ camel_imap4_engine_finalize (CamelObject *object) /** * camel_imap4_engine_new: - * @session: session - * @url: service url + * @service: service * * Returns a new imap4 engine **/ CamelIMAP4Engine * -camel_imap4_engine_new (CamelSession *session, CamelURL *url) +camel_imap4_engine_new (CamelService *service) { CamelIMAP4Engine *engine; - g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL); + g_return_val_if_fail (CAMEL_IS_SERVICE (service), NULL); engine = (CamelIMAP4Engine *) camel_object_new (CAMEL_TYPE_IMAP4_ENGINE); - camel_object_ref (session); - engine->session = session; - engine->url = url; + engine->session = service->session; + engine->url = service->url; + engine->service = service; return engine; } @@ -989,15 +986,7 @@ camel_imap4_engine_handle_untagged_1 (CamelIMAP4Engine *engine, camel_imap4_toke engine->state = CAMEL_IMAP4_ENGINE_DISCONNECTED; - /* FIXME: emit a "disconnected" signal for our Store? - * The Store could then initiate a reconnect if - * desirable. */ - - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("IMAP4 server %s unexpectedly disconnected: %s"), - engine->url->host, _("Got BYE response")); - - return -1; + /* 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) @@ -1377,6 +1366,9 @@ camel_imap4_engine_next_token (CamelIMAP4Engine *engine, camel_imap4_token_t *to 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; } @@ -1405,6 +1397,8 @@ camel_imap4_engine_eat_line (CamelIMAP4Engine *engine, CamelException *ex) _("IMAP4 server %s unexpectedly disconnected: %s"), engine->url->host, errno ? g_strerror (errno) : _("Unknown")); + engine->state = CAMEL_IMAP4_ENGINE_DISCONNECTED; + return -1; } } @@ -1438,6 +1432,8 @@ camel_imap4_engine_line (CamelIMAP4Engine *engine, unsigned char **line, size_t if (linebuf != NULL) g_byte_array_free (linebuf, TRUE); + engine->state = CAMEL_IMAP4_ENGINE_DISCONNECTED; + return -1; } @@ -1478,6 +1474,8 @@ camel_imap4_engine_literal (CamelIMAP4Engine *engine, unsigned char **literal, s if (literalbuf != NULL) g_byte_array_free (literalbuf, TRUE); + engine->state = CAMEL_IMAP4_ENGINE_DISCONNECTED; + return -1; } |