1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-26 01:28:50 -05:00

Use 997 as maximum line length for References header. See http://code.google.com/p/k9mail/source/detail?r=1714 for details.

This commit is contained in:
cketti 2010-05-21 16:37:45 +00:00
parent c5486469c2
commit 5627117ddf

View File

@ -369,17 +369,22 @@ public class MimeMessage extends Message
public void setReferences(String references) throws MessagingException public void setReferences(String references) throws MessagingException
{ {
/* /*
* Make sure the References header doesn't exceed 998 characters and * Make sure the References header doesn't exceed the maximum header
* won't get (Q-)encoded later. Otherwise some clients will break * line length and won't get (Q-)encoded later. Otherwise some clients
* threads apart. * will break threads apart.
* *
* For more information see issue 1559. * For more information see issue 1559.
*/ */
// Make sure separator is SPACE to prevent Q-encoding when TAB is encountered // Make sure separator is SPACE to prevent Q-encoding when TAB is encountered
references = references.replaceAll("\\s+", " "); references = references.replaceAll("\\s+", " ");
final int limit = 986; // "References: " /*
* NOTE: Usually the maximum header line is 998 + CRLF = 1000 characters.
* But at least one implementations seems to have problems with 998
* characters, so we adjust for that fact.
*/
final int limit = 1000 - 2 /* CRLF */ - 12 /* "References: " */ - 1 /* Off-by-one bugs */;
final int originalLength = references.length(); final int originalLength = references.length();
if (originalLength >= limit) if (originalLength >= limit)
{ {