[evolution-patches] imap append hanging, bug 42573



This problem has been coming up on the lists a fair bit.

Sigh, we already had this patch from Timo Sirainen but it got lost
somewhere along the way.

The code changes look ok, but he forgot a changelog.

Index: camel-imap-folder.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/imap/camel-imap-folder.c,v
retrieving revision 1.298
diff -u -r1.298 camel-imap-folder.c
--- camel-imap-folder.c	6 Mar 2003 21:42:11 -0000	1.298
+++ camel-imap-folder.c	2 Apr 2003 22:56:42 -0000
@@ -1124,12 +1124,12 @@
 	   CamelException *ex)
 {
 	CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store);
-	CamelImapResponse *response;
+	CamelImapResponse *response, *response2;
 	CamelStream *memstream;
 	CamelMimeFilter *crlf_filter;
 	CamelStreamFilter *streamfilter;
 	GByteArray *ba;
-	char *flagstr, *result, *end;
+	char *flagstr, *end;
 	
 	/* create flag string param */
 	if (info && info->flags)
@@ -1164,22 +1164,24 @@
 		g_byte_array_free (ba, TRUE);
 		return NULL;
 	}
-	
-	result = camel_imap_response_extract_continuation (store, response, ex);
-	if (!result) {
+
+	if (*response->status != '+') {
+		camel_imap_response_free (store, response);
 		g_byte_array_free (ba, TRUE);
 		return NULL;
 	}
-	g_free (result);
 	
 	/* send the rest of our data - the mime message */
-	response = camel_imap_command_continuation (store, ba->data, ba->len, ex);
+	response2 = camel_imap_command_continuation (store, ba->data, ba->len, ex);
 	g_byte_array_free (ba, TRUE);
-	if (!response)
-		return response;
+
+	/* free it only after message is sent. This may cause more FETCHes. */
+	camel_imap_response_free (store, response);
+	if (!response2)
+		return response2;
 	
 	if (store->capabilities & IMAP_CAPABILITY_UIDPLUS) {
-		*uid = camel_strstrcase (response->status, "[APPENDUID ");
+		*uid = camel_strstrcase (response2->status, "[APPENDUID ");
 		if (*uid)
 			*uid = strchr (*uid + 11, ' ');
 		if (*uid) {
@@ -1193,7 +1195,7 @@
 	} else
 		*uid = NULL;
 	
-	return response;
+	return response2;
 }
 
 static void


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