[evolution-patches] IMAP APPEND fix (from cras)



Apparently some people have been having problems sending to e-p@ since
the mailing-list migration, so I dunno if it is because we now require
people to be subscribed (ok by me) or if it is because their
subscriptions got lost.

anyways, cras poked me about this and I figured I'd forward it on to
e-p@ for him.

I guess it looks okay to me, I don't think there will be any evil
side-effects caused by applying this, but god knows with that imap code
:-)

Jeff

-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
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
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.1782
diff -u -r1.1782 ChangeLog
--- ChangeLog	1 Apr 2003 23:42:57 -0000	1.1782
+++ ChangeLog	2 Apr 2003 23:01:11 -0000
@@ -1,3 +1,9 @@
+2003-04-03  Timo Sirainen  <tss iki fi>
+
+	* providers/imap/camel-imap-folder.c (do_append): If server notified
+	of new mail while we were waiting for command continuation for APPEND,
+	we tried to fetch the new mail before finishing the message sending.
+	
 2003-03-28  Jeffrey Stedfast  <fejj ximian com>
 
 	* camel-sasl-gssapi.c (gssapi_challenge): If we are using the


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