Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.1823
diff -u -r1.1823 ChangeLog
--- ChangeLog	1 Jun 2003 23:49:27 -0000	1.1823
+++ ChangeLog	5 Jun 2003 20:08:54 -0000
@@ -1,3 +1,36 @@
+2003-06-05  Jeffrey Stedfast  <fejj@ximian.com>
+
+	Fix for bug #40788.
+
+	* providers/pop3/camel-pop3-engine.c (camel_pop3_engine_new): Now
+	takes a flags argument. Currently there is only 1 flag which can
+	be used to enable Pop3 server extensions.
+	(get_capabilities): Don't check for Pop3 server extensions unless
+	the flag is set on the engine.
+
+	* providers/pop3/camel-pop3-store.c (connect_to_server): Check for
+	the disable_extensions param.
+
+2003-06-04  Jeffrey Stedfast  <fejj@ximian.com>
+
+	* camel-uid-cache.c (camel_uid_cache_new): Create the directory
+	with mode 0777 and the cache file itself with mode 0666. Let the
+	user's umask filter the permissions. Instead of saving the fd on
+	the Cache object, instead save the filename. Use camel_read()
+	instead of expecting read() to just always work without getting an
+	EINTR/etc.
+	(maybe_write_uid): Don't do anything if cache->fd == -1, this
+	means an error has occured in a previous callback. Replace the 2
+	calls to write() with camel_write() and check their return
+	values. If either of them fails, set cache->fd to -1 (GHashTable
+	doesn't give us a way to abort foreach'ing thru the table).
+	(camel_uid_cache_save): Save to a temp file instead of overwriting
+	the original. Do proper error checking, etc. Also added some
+	smarts about whether to try and overwrite the old cache even if we
+	haven't successfully saved all the uids in the cache.
+	(camel_uid_cache_destroy): Free the cache->filename, no longer
+	need to close (cache->fd).
+
 2003-06-01  Jeffrey Stedfast  <fejj@ximian.com>
 
 	* broken-date-parser.c (d): Turn off debugging.
Index: providers/pop3/camel-pop3-engine.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/pop3/camel-pop3-engine.c,v
retrieving revision 1.6
diff -u -r1.6 camel-pop3-engine.c
--- providers/pop3/camel-pop3-engine.c	1 Jun 2003 23:49:29 -0000	1.6
+++ providers/pop3/camel-pop3-engine.c	5 Jun 2003 20:08:54 -0000
@@ -97,6 +97,7 @@
 /**
  * camel_pop3_engine_new:
  * @source: source stream
+ * @flags: engine flags
  *
  * Returns a NULL stream.  A null stream is always at eof, and
  * always returns success for all reads and writes.
@@ -104,7 +105,7 @@
  * Return value: the stream
  **/
 CamelPOP3Engine *
-camel_pop3_engine_new(CamelStream *source)
+camel_pop3_engine_new(CamelStream *source, guint32 flags)
 {
 	CamelPOP3Engine *pe;
 
@@ -112,7 +113,8 @@
 
 	pe->stream = (CamelPOP3Stream *)camel_pop3_stream_new(source);
 	pe->state = CAMEL_POP3_ENGINE_AUTH;
-
+	pe->flags = flags;
+	
 	get_capabilities(pe, TRUE);
 
 	return pe;
@@ -213,21 +215,23 @@
 		pe->auth = g_list_prepend(pe->auth, &camel_pop3_password_authtype);
 	}
 	
-	pc = camel_pop3_engine_command_new(pe, CAMEL_POP3_COMMAND_MULTI, cmd_capa, NULL, "CAPA\r\n");
-	while (camel_pop3_engine_iterate(pe, pc) > 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, "UIDL 1\r\n");
-		while (camel_pop3_engine_iterate (pe, pc) > 0)
+	if (pe->flags & CAMEL_POP3_ENGINE_ENABLE_EXTENSIONS) {
+		pc = camel_pop3_engine_command_new(pe, CAMEL_POP3_COMMAND_MULTI, cmd_capa, NULL, "CAPA\r\n");
+		while (camel_pop3_engine_iterate(pe, pc) > 0)
 			;
+		camel_pop3_engine_command_free(pe, pc);
 		
-		if (pc->state == CAMEL_POP3_COMMAND_OK)
-			pe->capa |= CAMEL_POP3_CAP_UIDL;
-		
-		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, "UIDL 1\r\n");
+			while (camel_pop3_engine_iterate (pe, pc) > 0)
+				;
+			
+			if (pc->state == CAMEL_POP3_COMMAND_OK)
+				pe->capa |= CAMEL_POP3_CAP_UIDL;
+			
+			camel_pop3_engine_command_free (pe, pc);
+		}
 	}
 }
 
Index: providers/pop3/camel-pop3-engine.h
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/pop3/camel-pop3-engine.h,v
retrieving revision 1.3
diff -u -r1.3 camel-pop3-engine.h
--- providers/pop3/camel-pop3-engine.h	7 May 2002 07:31:26 -0000	1.3
+++ providers/pop3/camel-pop3-engine.h	5 Jun 2003 20:08:55 -0000
@@ -68,6 +68,11 @@
 	CAMEL_POP3_CAP_STLS = 1<<5
 };
 
+/* enable-flags for the engine itself */
+enum {
+	CAMEL_POP3_ENGINE_ENABLE_EXTENSIONS = 1<<0,
+};
+
 typedef void (*CamelPOP3CommandFunc)(CamelPOP3Engine *pe, CamelPOP3Stream *stream, void *data);
 
 struct _CamelPOP3Command {
@@ -86,7 +91,9 @@
 
 struct _CamelPOP3Engine {
 	CamelObject parent;
-
+	
+	guint32 flags;
+	
 	camel_pop3_engine_t state;
 
 	GList *auth;		/* authtypes supported */
@@ -114,7 +121,7 @@
 
 CamelType		  camel_pop3_engine_get_type	(void);
 
-CamelPOP3Engine  *camel_pop3_engine_new		(CamelStream *source);
+CamelPOP3Engine  *camel_pop3_engine_new		(CamelStream *source, guint32 flags);
 
 void              camel_pop3_engine_reget_capabilities (CamelPOP3Engine *engine);
 
Index: providers/pop3/camel-pop3-provider.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/pop3/camel-pop3-provider.c,v
retrieving revision 1.29
diff -u -r1.29 camel-pop3-provider.c
--- providers/pop3/camel-pop3-provider.c	3 Apr 2002 18:18:29 -0000	1.29
+++ providers/pop3/camel-pop3-provider.c	5 Jun 2003 20:08:55 -0000
@@ -42,6 +42,8 @@
 	{ CAMEL_PROVIDER_CONF_CHECKSPIN, "delete_after", "UNIMPLEMENTED",
 	  N_("Delete after %s day(s)"), "0:1:7:365" },
 #endif
+	{ CAMEL_PROVIDER_CONF_CHECKBOX, "disable_extensions", NULL
+	  N_("Enable workarounds for buggy POP servers"), "0" },
 	{ CAMEL_PROVIDER_CONF_SECTION_END },
 	{ CAMEL_PROVIDER_CONF_END }
 };
Index: providers/pop3/camel-pop3-store.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/pop3/camel-pop3-store.c,v
retrieving revision 1.97
diff -u -r1.97 camel-pop3-store.c
--- providers/pop3/camel-pop3-store.c	8 Apr 2003 17:48:12 -0000	1.97
+++ providers/pop3/camel-pop3-store.c	5 Jun 2003 20:08:55 -0000
@@ -197,7 +197,10 @@
 		return FALSE;
 	}
 	
-	store->engine = camel_pop3_engine_new (tcp_stream);
+	if (!camel_url_get_param (service->url, "disable_extensions"))
+		store->engine = camel_pop3_engine_new (tcp_stream, CAMEL_POP3_ENGINE_ENABLE_EXTENSIONS);
+	else
+		store->engine = camel_pop3_engine_new (tcp_stream, 0);
 	
 #ifdef HAVE_SSL
 	if (store->engine) {
