[evolution-data-server/gnome-3-2] Bug #660615 - Make POP3 provider more cancellable ready



commit ccea0444789ee61f69841b90fdcac6fa068c27f5
Author: Milan Crha <mcrha redhat com>
Date:   Mon Oct 3 11:23:40 2011 +0200

    Bug #660615 - Make POP3 provider more cancellable ready

 camel/providers/pop3/camel-pop3-engine.c |   38 ++++++++++++++-----------
 camel/providers/pop3/camel-pop3-engine.h |    8 +++--
 camel/providers/pop3/camel-pop3-folder.c |   45 ++++++++++++++++--------------
 camel/providers/pop3/camel-pop3-store.c  |   25 ++++++++--------
 camel/providers/pop3/camel-pop3-store.h  |    1 +
 camel/providers/pop3/camel-pop3-stream.c |    2 +-
 6 files changed, 65 insertions(+), 54 deletions(-)
---
diff --git a/camel/providers/pop3/camel-pop3-engine.c b/camel/providers/pop3/camel-pop3-engine.c
index 9a49a6b..1ce98c3 100644
--- a/camel/providers/pop3/camel-pop3-engine.c
+++ b/camel/providers/pop3/camel-pop3-engine.c
@@ -41,7 +41,7 @@ extern CamelServiceAuthType camel_pop3_apop_authtype;
 
 #define dd(x) (camel_debug ("pop3")?(x):0)
 
-static void get_capabilities (CamelPOP3Engine *pe);
+static void get_capabilities (CamelPOP3Engine *pe, GCancellable *cancellable);
 
 G_DEFINE_TYPE (CamelPOP3Engine, camel_pop3_engine, CAMEL_TYPE_OBJECT)
 
@@ -93,13 +93,13 @@ camel_pop3_engine_init (CamelPOP3Engine *engine)
 }
 
 static gint
-read_greeting (CamelPOP3Engine *pe)
+read_greeting (CamelPOP3Engine *pe, GCancellable *cancellable)
 {
 	guchar *line, *apop, *apopend;
 	guint len;
 
 	/* first, read the greeting */
-	if (camel_pop3_stream_line (pe->stream, &line, &len, NULL, NULL) == -1
+	if (camel_pop3_stream_line (pe->stream, &line, &len, cancellable, NULL) == -1
 	    || strncmp ((gchar *) line, "+OK", 3) != 0)
 		return -1;
 
@@ -120,6 +120,7 @@ read_greeting (CamelPOP3Engine *pe)
  * camel_pop3_engine_new:
  * @source: source stream
  * @flags: engine flags
+ * @cancellable: optional #GCancellable object, or %NULL
  *
  * Returns a NULL stream.  A null stream is always at eof, and
  * always returns success for all reads and writes.
@@ -128,7 +129,8 @@ read_greeting (CamelPOP3Engine *pe)
  **/
 CamelPOP3Engine *
 camel_pop3_engine_new (CamelStream *source,
-                       guint32 flags)
+                       guint32 flags,
+		       GCancellable *cancellable)
 {
 	CamelPOP3Engine *pe;
 
@@ -138,12 +140,12 @@ camel_pop3_engine_new (CamelStream *source,
 	pe->state = CAMEL_POP3_ENGINE_AUTH;
 	pe->flags = flags;
 
-	if (read_greeting (pe) == -1) {
+	if (read_greeting (pe, cancellable) == -1) {
 		g_object_unref (pe);
 		return NULL;
 	}
 
-	get_capabilities (pe);
+	get_capabilities (pe, cancellable);
 
 	return pe;
 }
@@ -151,15 +153,16 @@ camel_pop3_engine_new (CamelStream *source,
 /**
  * camel_pop3_engine_reget_capabilities:
  * @engine: pop3 engine
+ * @cancellable: optional #GCancellable object, or %NULL
  *
  * Regets server capabilities (needed after a STLS command is issued for example).
  **/
 void
-camel_pop3_engine_reget_capabilities (CamelPOP3Engine *engine)
+camel_pop3_engine_reget_capabilities (CamelPOP3Engine *engine, GCancellable *cancellable)
 {
 	g_return_if_fail (CAMEL_IS_POP3_ENGINE (engine));
 
-	get_capabilities (engine);
+	get_capabilities (engine, cancellable);
 }
 
 /* TODO: read implementation too?
@@ -178,6 +181,7 @@ static struct {
 static void
 cmd_capa (CamelPOP3Engine *pe,
           CamelPOP3Stream *stream,
+	  GCancellable *cancellable,
           gpointer data)
 {
 	guchar *line, *tok, *next;
@@ -189,7 +193,7 @@ cmd_capa (CamelPOP3Engine *pe,
 	dd(printf("cmd_capa\n"));
 
 	do {
-		ret = camel_pop3_stream_line (stream, &line, &len, NULL, NULL);
+		ret = camel_pop3_stream_line (stream, &line, &len, cancellable, NULL);
 		if (ret >= 0) {
 			if (strncmp((gchar *) line, "SASL ", 5) == 0) {
 				tok = line + 5;
@@ -218,20 +222,20 @@ cmd_capa (CamelPOP3Engine *pe,
 }
 
 static void
-get_capabilities (CamelPOP3Engine *pe)
+get_capabilities (CamelPOP3Engine *pe, GCancellable *cancellable)
 {
 	CamelPOP3Command *pc;
 
 	if (!(pe->flags & CAMEL_POP3_ENGINE_DISABLE_EXTENSIONS)) {
-		pc = camel_pop3_engine_command_new(pe, CAMEL_POP3_COMMAND_MULTI, cmd_capa, NULL, NULL, NULL, "CAPA\r\n");
-		while (camel_pop3_engine_iterate (pe, pc, NULL, NULL) > 0)
+		pc = camel_pop3_engine_command_new(pe, CAMEL_POP3_COMMAND_MULTI, cmd_capa, NULL, cancellable, NULL, "CAPA\r\n");
+		while (camel_pop3_engine_iterate (pe, pc, cancellable, NULL) > 0)
 			;
 		camel_pop3_engine_command_free (pe, pc);
 
 		if (pe->state == CAMEL_POP3_ENGINE_TRANSACTION && !(pe->capa & CAMEL_POP3_CAP_UIDL)) {
 			/* check for UIDL support manually */
-			pc = camel_pop3_engine_command_new (pe, CAMEL_POP3_COMMAND_SIMPLE, NULL, NULL, NULL, NULL, "UIDL 1\r\n");
-			while (camel_pop3_engine_iterate (pe, pc, NULL, NULL) > 0)
+			pc = camel_pop3_engine_command_new (pe, CAMEL_POP3_COMMAND_SIMPLE, NULL, NULL, cancellable, NULL, "UIDL 1\r\n");
+			while (camel_pop3_engine_iterate (pe, pc, cancellable, NULL) > 0)
 				;
 
 			if (pc->state == CAMEL_POP3_COMMAND_OK)
@@ -305,10 +309,10 @@ camel_pop3_engine_iterate (CamelPOP3Engine *pe,
 			camel_pop3_stream_set_mode (pe->stream, CAMEL_POP3_STREAM_DATA);
 
 			if (pc->func)
-				pc->func (pe, pe->stream, pc->func_data);
+				pc->func (pe, pe->stream, cancellable, pc->func_data);
 
 			/* Make sure we get all data before going back to command mode */
-			while (camel_pop3_stream_getd (pe->stream, &p, &len, NULL, NULL) > 0)
+			while (camel_pop3_stream_getd (pe->stream, &p, &len, cancellable, NULL) > 0)
 				;
 			camel_pop3_stream_set_mode (pe->stream, CAMEL_POP3_STREAM_LINE);
 		} else {
@@ -340,7 +344,7 @@ camel_pop3_engine_iterate (CamelPOP3Engine *pe,
 		    && pe->current != NULL)
 			break;
 
-		if (camel_stream_write ((CamelStream *) pe->stream, pw->data, strlen (pw->data), NULL, NULL) == -1)
+		if (camel_stream_write ((CamelStream *) pe->stream, pw->data, strlen (pw->data), cancellable, NULL) == -1)
 			goto ioerror;
 
 		camel_dlist_remove ((CamelDListNode *) pw);
diff --git a/camel/providers/pop3/camel-pop3-engine.h b/camel/providers/pop3/camel-pop3-engine.h
index b611361..e713061 100644
--- a/camel/providers/pop3/camel-pop3-engine.h
+++ b/camel/providers/pop3/camel-pop3-engine.h
@@ -90,7 +90,7 @@ enum {
 	CAMEL_POP3_ENGINE_DISABLE_EXTENSIONS = 1 << 0
 };
 
-typedef void (*CamelPOP3CommandFunc)(CamelPOP3Engine *pe, CamelPOP3Stream *stream, gpointer data);
+typedef void (*CamelPOP3CommandFunc)(CamelPOP3Engine *pe, CamelPOP3Stream *stream, GCancellable *cancellable, gpointer data);
 
 struct _CamelPOP3Command {
 	struct _CamelPOP3Command *next;
@@ -139,9 +139,11 @@ struct _CamelPOP3EngineClass {
 GType		camel_pop3_engine_get_type	(void);
 CamelPOP3Engine *
 		camel_pop3_engine_new		(CamelStream *source,
-						 guint32 flags);
+						 guint32 flags,
+						 GCancellable *cancellable);
 void		camel_pop3_engine_reget_capabilities
-						(CamelPOP3Engine *engine);
+						(CamelPOP3Engine *engine,
+						 GCancellable *cancellable);
 void		camel_pop3_engine_command_free	(CamelPOP3Engine *pe,
 						 CamelPOP3Command *pc);
 gint		camel_pop3_engine_iterate	(CamelPOP3Engine *pe,
diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c
index 5acffa3..bb49124 100644
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ b/camel/providers/pop3/camel-pop3-folder.c
@@ -42,6 +42,7 @@ G_DEFINE_TYPE (CamelPOP3Folder, camel_pop3_folder, CAMEL_TYPE_FOLDER)
 static void
 cmd_uidl (CamelPOP3Engine *pe,
           CamelPOP3Stream *stream,
+	  GCancellable *cancellable,
           gpointer data)
 {
 	gint ret;
@@ -53,7 +54,7 @@ cmd_uidl (CamelPOP3Engine *pe,
 	CamelPOP3Folder *folder = data;
 
 	do {
-		ret = camel_pop3_stream_line (stream, &line, &len, NULL, NULL);
+		ret = camel_pop3_stream_line (stream, &line, &len, cancellable, NULL);
 		if (ret >= 0) {
 			if (strlen ((gchar *) line) > 1024)
 				line[1024] = 0;
@@ -75,6 +76,7 @@ cmd_uidl (CamelPOP3Engine *pe,
 static void
 cmd_builduid (CamelPOP3Engine *pe,
               CamelPOP3Stream *stream,
+	      GCancellable *cancellable,
               gpointer data)
 {
 	GChecksum *checksum;
@@ -122,6 +124,7 @@ cmd_builduid (CamelPOP3Engine *pe,
 static void
 cmd_list (CamelPOP3Engine *pe,
           CamelPOP3Stream *stream,
+	  GCancellable *cancellable,
           gpointer data)
 {
 	gint ret;
@@ -136,7 +139,7 @@ cmd_list (CamelPOP3Engine *pe,
 	pop3_store = CAMEL_POP3_STORE (parent_store);
 
 	do {
-		ret = camel_pop3_stream_line (stream, &line, &len, NULL, NULL);
+		ret = camel_pop3_stream_line (stream, &line, &len, cancellable, NULL);
 		if (ret >= 0) {
 			if (sscanf((gchar *) line, "%u %u", &id, &size) == 2) {
 				fi = g_malloc0 (sizeof (*fi));
@@ -144,7 +147,7 @@ cmd_list (CamelPOP3Engine *pe,
 				fi->id = id;
 				fi->index = ((CamelPOP3Folder *) folder)->uids->len;
 				if ((pop3_store->engine->capa & CAMEL_POP3_CAP_UIDL) == 0)
-					fi->cmd = camel_pop3_engine_command_new(pe, CAMEL_POP3_COMMAND_MULTI, cmd_builduid, fi, NULL, NULL, "TOP %u 0\r\n", id);
+					fi->cmd = camel_pop3_engine_command_new(pe, CAMEL_POP3_COMMAND_MULTI, cmd_builduid, fi, cancellable, NULL, "TOP %u 0\r\n", id);
 				g_ptr_array_add (((CamelPOP3Folder *) folder)->uids, fi);
 				g_hash_table_insert (((CamelPOP3Folder *) folder)->uids_id, GINT_TO_POINTER (id), fi);
 			}
@@ -155,6 +158,7 @@ cmd_list (CamelPOP3Engine *pe,
 static void
 cmd_tocache (CamelPOP3Engine *pe,
              CamelPOP3Stream *stream,
+	     GCancellable *cancellable,
              gpointer data)
 {
 	CamelPOP3FolderInfo *fi = data;
@@ -166,11 +170,11 @@ cmd_tocache (CamelPOP3Engine *pe,
 
 	/* We write an '*' to the start of the stream to say its not complete yet */
 	/* This should probably be part of the cache code */
-	if ((n = camel_stream_write (fi->stream, "*", 1, NULL, &error)) == -1)
+	if ((n = camel_stream_write (fi->stream, "*", 1, cancellable, &error)) == -1)
 		goto done;
 
-	while ((n = camel_stream_read ((CamelStream *) stream, buffer, sizeof (buffer), NULL, &error)) > 0) {
-		n = camel_stream_write (fi->stream, buffer, n, NULL, &error);
+	while ((n = camel_stream_read ((CamelStream *) stream, buffer, sizeof (buffer), cancellable, &error)) > 0) {
+		n = camel_stream_write (fi->stream, buffer, n, cancellable, &error);
 		if (n == -1)
 			break;
 
@@ -185,8 +189,8 @@ cmd_tocache (CamelPOP3Engine *pe,
 	if (error == NULL) {
 		g_seekable_seek (
 			G_SEEKABLE (fi->stream),
-			0, G_SEEK_SET, NULL, NULL);
-		camel_stream_write (fi->stream, "#", 1, NULL, &error);
+			0, G_SEEK_SET, cancellable, NULL);
+		camel_stream_write (fi->stream, "#", 1, cancellable, &error);
 	}
 
 done:
@@ -383,7 +387,7 @@ pop3_folder_get_message_sync (CamelFolder *folder,
 
 		/* ref it, the cache storage routine unref's when done */
 		fi->stream = g_object_ref (stream);
-		pcr = camel_pop3_engine_command_new(pop3_store->engine, CAMEL_POP3_COMMAND_MULTI, cmd_tocache, fi, NULL, NULL, "RETR %u\r\n", fi->id);
+		pcr = camel_pop3_engine_command_new(pop3_store->engine, CAMEL_POP3_COMMAND_MULTI, cmd_tocache, fi, cancellable, NULL, "RETR %u\r\n", fi->id);
 
 		/* Also initiate retrieval of some of the following messages, assume we'll be receiving them */
 		if (pop3_store->cache != NULL) {
@@ -398,7 +402,7 @@ pop3_folder_get_message_sync (CamelFolder *folder,
 					pfi->stream = camel_data_cache_add(pop3_store->cache, "cache", pfi->uid, NULL);
 					if (pfi->stream) {
 						pfi->cmd = camel_pop3_engine_command_new (pop3_store->engine, CAMEL_POP3_COMMAND_MULTI,
-											 cmd_tocache, pfi, NULL, NULL, "RETR %u\r\n", pfi->id);
+											 cmd_tocache, pfi, cancellable, NULL, "RETR %u\r\n", pfi->id);
 					}
 				}
 			}
@@ -421,8 +425,7 @@ pop3_folder_get_message_sync (CamelFolder *folder,
 			goto done;
 		}
 
-		if (camel_stream_read (
-			stream, buffer, 1, cancellable, error) == -1)
+		if (camel_stream_read (stream, buffer, 1, cancellable, error) == -1)
 			goto done;
 
 		if (buffer[0] != '#') {
@@ -572,7 +575,7 @@ pop3_folder_synchronize_sync (CamelFolder *folder,
 		fi = pop3_folder->uids->pdata[i];
 		/* busy already?  wait for that to finish first */
 		if (fi->cmd) {
-			while (camel_pop3_engine_iterate (pop3_store->engine, fi->cmd, NULL, NULL) > 0)
+			while (camel_pop3_engine_iterate (pop3_store->engine, fi->cmd, cancellable, NULL) > 0)
 				;
 			camel_pop3_engine_command_free (pop3_store->engine, fi->cmd);
 			fi->cmd = NULL;
@@ -583,7 +586,7 @@ pop3_folder_synchronize_sync (CamelFolder *folder,
 								0,
 								NULL,
 								NULL,
-								NULL, NULL,
+								cancellable, NULL,
 								"DELE %u\r\n",
 								fi->id);
 
@@ -597,7 +600,7 @@ pop3_folder_synchronize_sync (CamelFolder *folder,
 		fi = pop3_folder->uids->pdata[i];
 		/* wait for delete commands to finish */
 		if (fi->cmd) {
-			while (camel_pop3_engine_iterate (pop3_store->engine, fi->cmd, NULL, NULL) > 0)
+			while (camel_pop3_engine_iterate (pop3_store->engine, fi->cmd, cancellable, NULL) > 0)
 				;
 			camel_pop3_engine_command_free (pop3_store->engine, fi->cmd);
 			fi->cmd = NULL;
@@ -608,7 +611,7 @@ pop3_folder_synchronize_sync (CamelFolder *folder,
 
 	camel_operation_pop_message (cancellable);
 
-	camel_pop3_store_expunge (pop3_store, error);
+	camel_pop3_store_expunge (pop3_store, cancellable, error);
 
 	return TRUE;
 }
@@ -740,7 +743,7 @@ camel_pop3_delete_old (CamelFolder *folder,
 		fi = pop3_folder->uids->pdata[i];
 
 		if (fi->cmd) {
-			while (camel_pop3_engine_iterate (pop3_store->engine, fi->cmd, NULL, NULL) > 0) {
+			while (camel_pop3_engine_iterate (pop3_store->engine, fi->cmd, cancellable, NULL) > 0) {
 				; /* do nothing - iterating until end */
 			}
 
@@ -773,7 +776,7 @@ camel_pop3_delete_old (CamelFolder *folder,
 
 			if (day_lag > days_to_delete) {
 				if (fi->cmd) {
-					while (camel_pop3_engine_iterate (pop3_store->engine, fi->cmd, NULL, NULL) > 0) {
+					while (camel_pop3_engine_iterate (pop3_store->engine, fi->cmd, cancellable, NULL) > 0) {
 						; /* do nothing - iterating until end */
 					}
 
@@ -785,7 +788,7 @@ camel_pop3_delete_old (CamelFolder *folder,
 									0,
 									NULL,
 									NULL,
-									NULL, NULL,
+									cancellable, NULL,
 									"DELE %u\r\n",
 									fi->id);
 				/* also remove from cache */
@@ -800,7 +803,7 @@ camel_pop3_delete_old (CamelFolder *folder,
 		fi = pop3_folder->uids->pdata[i];
 		/* wait for delete commands to finish */
 		if (fi->cmd) {
-			while (camel_pop3_engine_iterate (pop3_store->engine, fi->cmd, NULL, NULL) > 0)
+			while (camel_pop3_engine_iterate (pop3_store->engine, fi->cmd, cancellable, NULL) > 0)
 				;
 			camel_pop3_engine_command_free (pop3_store->engine, fi->cmd);
 			fi->cmd = NULL;
@@ -809,7 +812,7 @@ camel_pop3_delete_old (CamelFolder *folder,
 			cancellable, (i + 1) * 100 / pop3_folder->uids->len);
 	}
 
-	camel_pop3_store_expunge (pop3_store, error);
+	camel_pop3_store_expunge (pop3_store, cancellable, error);
 
 	return 0;
 }
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 756cb60..be1a6b3 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -124,7 +124,7 @@ connect_to_server (CamelService *service,
 	if (disable_extensions)
 		flags |= CAMEL_POP3_ENGINE_DISABLE_EXTENSIONS;
 
-	if (!(store->engine = camel_pop3_engine_new (tcp_stream, flags))) {
+	if (!(store->engine = camel_pop3_engine_new (tcp_stream, flags, cancellable))) {
 		g_set_error (
 			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Failed to read a valid greeting from POP server %s"),
@@ -153,7 +153,7 @@ connect_to_server (CamelService *service,
 	}
 
 	pc = camel_pop3_engine_command_new (store->engine, 0, NULL, NULL, cancellable, error, "STLS\r\n");
-	while (camel_pop3_engine_iterate (store->engine, NULL, NULL, NULL) > 0)
+	while (camel_pop3_engine_iterate (store->engine, NULL, cancellable, NULL) > 0)
 		;
 
 	ret = pc->state == CAMEL_POP3_COMMAND_OK;
@@ -195,15 +195,15 @@ connect_to_server (CamelService *service,
 
 	/* rfc2595, section 4 states that after a successful STLS
 	 * command, the client MUST discard prior CAPA responses */
-	camel_pop3_engine_reget_capabilities (store->engine);
+	camel_pop3_engine_reget_capabilities (store->engine, cancellable);
 
 	return TRUE;
 
  stls_exception:
 	if (clean_quit) {
 		/* try to disconnect cleanly */
-		pc = camel_pop3_engine_command_new (store->engine, 0, NULL, NULL, NULL, NULL, "QUIT\r\n");
-		while (camel_pop3_engine_iterate (store->engine, NULL, NULL, NULL) > 0)
+		pc = camel_pop3_engine_command_new (store->engine, 0, NULL, NULL, cancellable, NULL, "QUIT\r\n");
+		while (camel_pop3_engine_iterate (store->engine, NULL, cancellable, NULL) > 0)
 			;
 		camel_pop3_engine_command_free (store->engine, pc);
 	}
@@ -278,8 +278,8 @@ try_sasl (CamelPOP3Store *store,
 		    || camel_sasl_get_authenticated (sasl)
 		    || (resp = (guchar *) camel_sasl_challenge_base64_sync (sasl, (const gchar *) line + 2, cancellable, NULL)) == NULL) {
 			camel_stream_write_string (
-				CAMEL_STREAM (stream), "*\r\n", NULL, NULL);
-			camel_pop3_stream_line (stream, &line, &len, NULL, NULL);
+				CAMEL_STREAM (stream), "*\r\n", cancellable, NULL);
+			camel_pop3_stream_line (stream, &line, &len, cancellable, NULL);
 			g_set_error (
 				error, CAMEL_SERVICE_ERROR,
 				CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
@@ -558,7 +558,7 @@ pop3_store_connect_sync (CamelService *service,
 	/* Now that we are in the TRANSACTION state,
 	 * try regetting the capabilities */
 	store->engine->state = CAMEL_POP3_ENGINE_TRANSACTION;
-	camel_pop3_engine_reget_capabilities (store->engine);
+	camel_pop3_engine_reget_capabilities (store->engine, cancellable);
 
 	return TRUE;
 }
@@ -577,7 +577,7 @@ pop3_store_disconnect_sync (CamelService *service,
 		CamelPOP3Command *pc;
 
 		pc = camel_pop3_engine_command_new(store->engine, 0, NULL, NULL, cancellable, error, "QUIT\r\n");
-		while (camel_pop3_engine_iterate (store->engine, NULL, NULL, NULL) > 0)
+		while (camel_pop3_engine_iterate (store->engine, NULL, cancellable, NULL) > 0)
 			;
 		camel_pop3_engine_command_free (store->engine, pc);
 	}
@@ -759,6 +759,7 @@ camel_pop3_store_init (CamelPOP3Store *pop3_store)
  * camel_pop3_store_expunge:
  * @store: the store
  * @error: return location for a #GError, or %NULL
+ * @cancellable: optional #GCancellable object, or %NULL
  *
  * Expunge messages from the store. This will result in the connection
  * being closed, which may cause later commands to fail if they can't
@@ -766,18 +767,18 @@ camel_pop3_store_init (CamelPOP3Store *pop3_store)
  **/
 void
 camel_pop3_store_expunge (CamelPOP3Store *store,
+			  GCancellable *cancellable,
                           GError **error)
 {
 	CamelPOP3Command *pc;
 
 	pc = camel_pop3_engine_command_new (
-		store->engine, 0, NULL, NULL, NULL, error, "QUIT\r\n");
+		store->engine, 0, NULL, NULL, cancellable, error, "QUIT\r\n");
 
-	while (camel_pop3_engine_iterate (store->engine, NULL, NULL, NULL) > 0)
+	while (camel_pop3_engine_iterate (store->engine, NULL, cancellable, NULL) > 0)
 		;
 
 	camel_pop3_engine_command_free (store->engine, pc);
 
 	camel_service_disconnect_sync (CAMEL_SERVICE (store), FALSE, error);
 }
-
diff --git a/camel/providers/pop3/camel-pop3-store.h b/camel/providers/pop3/camel-pop3-store.h
index d970780..67b58d5 100644
--- a/camel/providers/pop3/camel-pop3-store.h
+++ b/camel/providers/pop3/camel-pop3-store.h
@@ -69,6 +69,7 @@ struct _CamelPOP3StoreClass {
 
 GType		camel_pop3_store_get_type	(void);
 void		camel_pop3_store_expunge	(CamelPOP3Store *store,
+						 GCancellable *cancellable,
 						 GError **error);
 
 G_END_DECLS
diff --git a/camel/providers/pop3/camel-pop3-stream.c b/camel/providers/pop3/camel-pop3-stream.c
index ec57f73..38dc03c 100644
--- a/camel/providers/pop3/camel-pop3-stream.c
+++ b/camel/providers/pop3/camel-pop3-stream.c
@@ -327,7 +327,7 @@ camel_pop3_stream_line (CamelPOP3Stream *is,
 				/* sentinal? */
 				if (p> e) {
 					is->ptr = e;
-					if (stream_fill (is, NULL, NULL) == -1)
+					if (stream_fill (is, cancellable, error) == -1)
 						return -1;
 					p = is->ptr;
 					e = is->end;



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