diff options
author | Peter Williams <peterw@src.gnome.org> | 2000-08-30 05:28:46 +0800 |
---|---|---|
committer | Peter Williams <peterw@src.gnome.org> | 2000-08-30 05:28:46 +0800 |
commit | da570c66609a9baea34d4899c4ca7e1f8329d471 (patch) | |
tree | 78f82074f39463fc8db0cfb92728d57fe9c2ac84 /camel/providers/pop3/camel-pop3-store.c | |
parent | ba2eaa68b17882b0fec2eac160f674d29598795f (diff) | |
download | gsoc2013-evolution-da570c66609a9baea34d4899c4ca7e1f8329d471.tar gsoc2013-evolution-da570c66609a9baea34d4899c4ca7e1f8329d471.tar.gz gsoc2013-evolution-da570c66609a9baea34d4899c4ca7e1f8329d471.tar.bz2 gsoc2013-evolution-da570c66609a9baea34d4899c4ca7e1f8329d471.tar.lz gsoc2013-evolution-da570c66609a9baea34d4899c4ca7e1f8329d471.tar.xz gsoc2013-evolution-da570c66609a9baea34d4899c4ca7e1f8329d471.tar.zst gsoc2013-evolution-da570c66609a9baea34d4899c4ca7e1f8329d471.zip |
CamelRemoteStore: a new generic store for stores that connect to servers. Prepare for the ability to cancel operations (much better exception handling). Clean up IMAP like nobody's business
svn path=/trunk/; revision=5103
Diffstat (limited to 'camel/providers/pop3/camel-pop3-store.c')
-rw-r--r-- | camel/providers/pop3/camel-pop3-store.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c index 4f618e521e..6ee7361959 100644 --- a/camel/providers/pop3/camel-pop3-store.c +++ b/camel/providers/pop3/camel-pop3-store.c @@ -277,6 +277,9 @@ connect_to_server (CamelService *service, gboolean real, CamelException *ex) store->supports_uidl = -1; store->expires = -1; + /* good enough for us */ + service->connected = TRUE; + status = camel_pop3_command (store, NULL, "CAPA"); if (status == CAMEL_POP3_OK) { char *p; @@ -285,6 +288,7 @@ connect_to_server (CamelService *service, gboolean real, CamelException *ex) buf = camel_pop3_command_get_additional_data (store, ex); if (camel_exception_is_set (ex)) { pop3_disconnect (service, ex); + service->connected = FALSE; return FALSE; } @@ -534,6 +538,7 @@ pop3_connect (CamelService *service, CamelException *ex) if (camel_exception_is_set (ex)) { pop3_disconnect (service, NULL); + service->connected = FALSE; return FALSE; } @@ -628,6 +633,21 @@ camel_pop3_command (CamelPop3Store *store, char **ret, char *fmt, ...) char *cmdbuf; va_list ap; + /* Check for connectedness. Failed (or cancelled) operations will + * close the connection. */ + if (CAMEL_SERVICE (store)->connected == FALSE) { + CamelException ex; + + d(g_message ("pop3: disconnected, reconnecting.")); + camel_exception_init (&ex); + CAMEL_SERVICE_CLASS (CAMEL_OBJECT_GET_CLASS (store))->connect (store, &ex); + if (camel_exception_is_set (&ex)) { + camel_exception_clear (&ex); + return CAMEL_POP3_FAIL; + } + camel_exception_clear (&ex); + } + if (!store->ostream) { /*CamelException ex; * @@ -769,3 +789,4 @@ camel_pop3_command_get_additional_data (CamelPop3Store *store, CamelException *e return buf; } + |