aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-11-01 07:44:46 +0800
committerDan Winship <danw@src.gnome.org>2000-11-01 07:44:46 +0800
commit517db3b21fece8d8616620ff299689699b62b277 (patch)
tree0417ff14f0fa20967aba0580e48d8668050ad07b /camel/providers
parent1d60c5cc024dd69b2f0d776bd0f48d1af7fef08b (diff)
downloadgsoc2013-evolution-517db3b21fece8d8616620ff299689699b62b277.tar
gsoc2013-evolution-517db3b21fece8d8616620ff299689699b62b277.tar.gz
gsoc2013-evolution-517db3b21fece8d8616620ff299689699b62b277.tar.bz2
gsoc2013-evolution-517db3b21fece8d8616620ff299689699b62b277.tar.lz
gsoc2013-evolution-517db3b21fece8d8616620ff299689699b62b277.tar.xz
gsoc2013-evolution-517db3b21fece8d8616620ff299689699b62b277.tar.zst
gsoc2013-evolution-517db3b21fece8d8616620ff299689699b62b277.zip
Add a new argument, clean, that says whether or not to try to disconnect
* camel-service.c (service_disconnect): Add a new argument, clean, that says whether or not to try to disconnect cleanly. * camel-remote-store.c (remote_send_string, remote_send_stream, remote_recv_line): disconnect uncleanly on failure to prevent infinite loops when providers would normally send commands from disconnect(). Remove some unneeded CamelException goo. * providers/smtp/camel-smtp-transport.c (smtp_disconnect): * providers/pop3/camel-pop3-store.c (pop3_disconnect): * providers/nntp/camel-nntp-store.c (nntp_store_disconnect): * providers/imap/camel-imap-store.c (imap_disconnect): Don't send QUIT/LOGOUT if !clean. svn path=/trunk/; revision=6303
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-store.c14
-rw-r--r--camel/providers/nntp/camel-nntp-store.c7
-rw-r--r--camel/providers/pop3/camel-pop3-store.c13
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c14
4 files changed, 26 insertions, 22 deletions
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 749785b724..8d53f7579c 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -55,7 +55,7 @@
static CamelRemoteStoreClass *remote_store_class = NULL;
static gboolean imap_connect (CamelService *service, CamelException *ex);
-static gboolean imap_disconnect (CamelService *service, CamelException *ex);
+static gboolean imap_disconnect (CamelService *service, gboolean clean, CamelException *ex);
static GList *query_auth_types_generic (CamelService *service, CamelException *ex);
static GList *query_auth_types_connected (CamelService *service, CamelException *ex);
static CamelFolder *get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex);
@@ -303,13 +303,13 @@ imap_connect (CamelService *service, CamelException *ex)
"authentication type %s",
service->url->host,
service->url->authmech);
- camel_service_disconnect (service, NULL);
+ camel_service_disconnect (service, TRUE, NULL);
return FALSE;
}
authenticated = imap_try_kerberos_v4_auth (store, ex);
if (camel_exception_is_set (ex)) {
- camel_service_disconnect (service, NULL);
+ camel_service_disconnect (service, TRUE, NULL);
return FALSE;
}
}
@@ -344,7 +344,7 @@ imap_connect (CamelService *service, CamelException *ex)
if (!service->url->passwd) {
camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
"You didn\'t enter a password.");
- camel_service_disconnect (service, NULL);
+ camel_service_disconnect (service, TRUE, NULL);
return FALSE;
}
}
@@ -422,12 +422,12 @@ imap_connect (CamelService *service, CamelException *ex)
}
static gboolean
-imap_disconnect (CamelService *service, CamelException *ex)
+imap_disconnect (CamelService *service, gboolean clean, CamelException *ex)
{
CamelImapStore *store = CAMEL_IMAP_STORE (service);
CamelImapResponse *response;
- if (store->connected) {
+ if (store->connected && clean) {
/* send the logout command */
response = camel_imap_command (store, NULL, ex, "LOGOUT");
camel_imap_response_free (response);
@@ -435,7 +435,7 @@ imap_disconnect (CamelService *service, CamelException *ex)
store->current_folder = NULL;
- return CAMEL_SERVICE_CLASS (remote_store_class)->disconnect (service, ex);
+ return CAMEL_SERVICE_CLASS (remote_store_class)->disconnect (service, clean, ex);
}
static gboolean
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
index dbba4356be..41466fe06c 100644
--- a/camel/providers/nntp/camel-nntp-store.c
+++ b/camel/providers/nntp/camel-nntp-store.c
@@ -263,16 +263,17 @@ nntp_store_connect (CamelService *service, CamelException *ex)
}
static gboolean
-nntp_store_disconnect (CamelService *service, CamelException *ex)
+nntp_store_disconnect (CamelService *service, gboolean clean, CamelException *ex)
{
CamelNNTPStore *store = CAMEL_NNTP_STORE (service);
- camel_nntp_command (store, ex, NULL, "QUIT");
+ if (clean)
+ camel_nntp_command (store, ex, NULL, "QUIT");
if (store->newsrc)
camel_nntp_newsrc_write (store->newsrc);
- if (!service_class->disconnect (service, ex))
+ if (!service_class->disconnect (service, clean, ex))
return FALSE;
return TRUE;
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 4932974c16..67d32da796 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -69,7 +69,7 @@ static CamelRemoteStoreClass *parent_class = NULL;
static void finalize (CamelObject *object);
static gboolean pop3_connect (CamelService *service, CamelException *ex);
-static gboolean pop3_disconnect (CamelService *service, CamelException *ex);
+static gboolean pop3_disconnect (CamelService *service, gboolean clean, CamelException *ex);
static GList *query_auth_types_connected (CamelService *service, CamelException *ex);
static GList *query_auth_types_generic (CamelService *service, CamelException *ex);
@@ -308,7 +308,7 @@ query_auth_types_connected (CamelService *service, CamelException *ex)
/* should we check apop too? */
apop = store->apop_timestamp != NULL;
if (passwd)
- camel_service_disconnect (service, ex);
+ camel_service_disconnect (service, TRUE, ex);
camel_exception_clear (ex);
#ifdef HAVE_KRB4
@@ -321,7 +321,7 @@ query_auth_types_connected (CamelService *service, CamelException *ex)
/*return NULL;*/
if (kpop)
- camel_service_disconnect (service, ex);
+ camel_service_disconnect (service, TRUE, ex);
camel_exception_clear (ex);
#endif
@@ -526,13 +526,14 @@ pop3_connect (CamelService *service, CamelException *ex)
}
static gboolean
-pop3_disconnect (CamelService *service, CamelException *ex)
+pop3_disconnect (CamelService *service, gboolean clean, CamelException *ex)
{
CamelPop3Store *store = CAMEL_POP3_STORE (service);
- camel_pop3_command (store, NULL, ex, "QUIT");
+ if (clean)
+ camel_pop3_command (store, NULL, ex, "QUIT");
- if (!CAMEL_SERVICE_CLASS (parent_class)->disconnect (service, ex))
+ if (!CAMEL_SERVICE_CLASS (parent_class)->disconnect (service, clean, ex))
return FALSE;
return TRUE;
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 91693bd1f7..62cd0b7525 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -61,7 +61,7 @@ static gboolean _send_to (CamelTransport *transport, CamelMedium *message, GList
/* support prototypes */
static gboolean smtp_connect (CamelService *service, CamelException *ex);
-static gboolean smtp_disconnect (CamelService *service, CamelException *ex);
+static gboolean smtp_disconnect (CamelService *service, gboolean clean, CamelException *ex);
static GList *esmtp_get_authtypes(gchar *buffer);
static GList *query_auth_types_connected (CamelService *service, CamelException *ex);
static GList *query_auth_types_generic (CamelService *service, CamelException *ex);
@@ -230,18 +230,20 @@ smtp_connect (CamelService *service, CamelException *ex)
}
static gboolean
-smtp_disconnect (CamelService *service, CamelException *ex)
+smtp_disconnect (CamelService *service, gboolean clean, CamelException *ex)
{
CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
/*if (!service->connected)
* return TRUE;
*/
+
+ if (clean) {
+ /* send the QUIT command to the SMTP server */
+ smtp_quit (transport, ex);
+ }
- /* send the QUIT command to the SMTP server */
- smtp_quit (transport, ex);
-
- if (!service_class->disconnect (service, ex))
+ if (!service_class->disconnect (service, clean, ex))
return FALSE;
g_free (transport->esmtp_supported_authtypes);