# HG changeset patch # User Timo Sirainen # Date 1098295772 -10800 # Node ID 7cc03b8278a8569f5b2324fbe4f261af43516214 # Parent b12e61e55c011b296edc5316a9dccdc69bf8bc36 Added tb-negative-fetch workaround. diff -r b12e61e55c01 -r 7cc03b8278a8 dovecot-example.conf --- 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 } diff -r b12e61e55c01 -r 7cc03b8278a8 src/imap/common.h --- 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; diff -r b12e61e55c01 -r 7cc03b8278a8 src/imap/imap-fetch-body.c --- 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 */ diff -r b12e61e55c01 -r 7cc03b8278a8 src/imap/main.c --- 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 } };