[PATCH] send-pop-quit-on-account-offline



Hi,

  The attached patch makes tny_camel_account_set_online(FALSE) send "QUIT" for POP3 accounts. It also cleans up the logged_in variable that was unused.
  This fixes some problems I had with Yahoo servers when trying to connect twice in a row.

Regards,

--
Martin
Index: libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.h
===================================================================
--- libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.h	(révision 54214)
+++ libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.h	(révision 54217)
@@ -49,7 +49,7 @@
 	guint delete_after;
 	gboolean immediate_delete_after;
 	gchar *storage_path, *base_url;
-	gboolean connected, logged_in, is_refreshing;
+	gboolean connected, is_refreshing;
 	GStaticRecMutex *eng_lock, *uidl_lock;
 	gpointer book;
 	guint login_delay;
Index: libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.c
===================================================================
--- libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.c	(révision 54214)
+++ libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.c	(révision 54217)
@@ -936,9 +936,6 @@
 	int mytry;
 	gboolean auth = FALSE;
 
-	if (store->logged_in)
-		return TRUE;
-
 	session = camel_service_get_session (service);
 
 	if (!connect_to_server_wrapper (service, ex))
@@ -1003,8 +1000,6 @@
 
 	//g_static_rec_mutex_lock (store->eng_lock);
 
-	store->logged_in = FALSE;
-
 	if (store->engine == NULL) {
 		//g_static_rec_mutex_unlock (store->eng_lock);
 		return TRUE;
Index: libtinymail-camel/tny-camel-store-account.c
===================================================================
--- libtinymail-camel/tny-camel-store-account.c	(révision 54214)
+++ libtinymail-camel/tny-camel-store-account.c	(révision 54217)
@@ -2141,10 +2141,19 @@
 
 	g_static_rec_mutex_lock (apriv->service_lock);
 	if (apriv->service) {
-		CamelException mex = CAMEL_EXCEPTION_INITIALISER;
-		camel_service_disconnect (apriv->service, FALSE, &mex);
-		if (camel_exception_is_set (&mex))
-			camel_exception_clear (&mex);
+		CamelException ex = CAMEL_EXCEPTION_INITIALISER;
+
+		/* We first try to disconnect cleanly. If this fails, we try the hard way */ 
+		camel_service_disconnect (apriv->service, TRUE, &ex);
+		if (camel_exception_is_set (&ex)){
+			CamelException subex = CAMEL_EXCEPTION_INITIALISER;
+
+			camel_service_disconnect (apriv->service, FALSE, &subex);
+			if (camel_exception_is_set (&subex))
+				camel_exception_clear (&subex);
+
+			camel_exception_clear (&ex);
+		}
 	}
 	g_static_rec_mutex_unlock (apriv->service_lock);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]