changeset 2792:7cc03b8278a8 HEAD

Added tb-negative-fetch workaround.
author Timo Sirainen <tss@iki.fi>
date Wed, 20 Oct 2004 21:09:32 +0300
parents b12e61e55c01
children 19a6ff9fed58
files dovecot-example.conf src/imap/common.h src/imap/imap-fetch-body.c src/imap/main.c
diffstat 4 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dovecot-example.conf	Wed Oct 20 20:49:02 2004 +0300
+++ b/dovecot-example.conf	Wed Oct 20 21:09:32 2004 +0300
@@ -413,6 +413,10 @@
   #     workaround makes sure that Netscape never breaks by adding the line if
   #     it doesn't exist. This is done only for FETCH BODY[HEADER.FIELDS..]
   #     commands. Note that RFC says this shouldn't be done.
+  #   tb-negative-fetch:
+  #     Thunderbird sometimes messed up some calculations and wants to read
+  #     the message past it's end, giving negative size to FETCH BODY[]<..>
+  #     command. This workaround just hides the error message.
   #imap_client_workarounds = outlook-idle
 }
   
--- a/src/imap/common.h	Wed Oct 20 20:49:02 2004 +0300
+++ b/src/imap/common.h	Wed Oct 20 21:09:32 2004 +0300
@@ -26,7 +26,8 @@
 enum client_workarounds {
 	WORKAROUND_OE6_FETCH_NO_NEWMAIL		= 0x01,
 	WORKAROUND_OUTLOOK_IDLE			= 0x02,
-	WORKAROUND_NETSCAPE_EOH			= 0x04
+	WORKAROUND_NETSCAPE_EOH			= 0x04,
+	WORKAROUND_TB_NEGATIVE_FETCH		= 0x08
 };
 
 extern struct ioloop *ioloop;
--- a/src/imap/imap-fetch-body.c	Wed Oct 20 20:49:02 2004 +0300
+++ b/src/imap/imap-fetch-body.c	Wed Oct 20 21:09:32 2004 +0300
@@ -791,6 +791,14 @@
 
 		if (*p == '.') {
 			p++;
+			if (*p == '-' && (client_workarounds &
+					  WORKAROUND_TB_NEGATIVE_FETCH) != 0) {
+				/* Thunderbird messed up some calculations
+				   and wants to read the message past it's
+				   end. The fetch returns empty result anyway,
+				   so just ignore '-'. */
+				p++;
+			}
 			if (!read_uoff_t(&p, &body->max_size) ||
 			    body->max_size > OFF_T_MAX) {
 				/* wrapped */
--- a/src/imap/main.c	Wed Oct 20 20:49:02 2004 +0300
+++ b/src/imap/main.c	Wed Oct 20 21:09:32 2004 +0300
@@ -30,6 +30,7 @@
 	{ "oe6-fetch-no-newmail", WORKAROUND_OE6_FETCH_NO_NEWMAIL },
 	{ "outlook-idle", WORKAROUND_OUTLOOK_IDLE },
 	{ "netscape-eoh", WORKAROUND_NETSCAPE_EOH },
+	{ "tb-negative-fetch", WORKAROUND_TB_NEGATIVE_FETCH },
 	{ NULL, 0 }
 };