IMAP: fix 3297849, ENVELOPE formating error/bogus quotes

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1676 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2011-05-08 21:32:35 +00:00
parent eb912da404
commit 0c01e83c3c
1 changed files with 15 additions and 11 deletions

View File

@ -941,17 +941,7 @@ public class ImapConnection extends AbstractConnection {
buffer.append(' ');
}
if (value != null && value.length > 0) {
String unfoldedValue = MimeUtility.unfold(value[0]);
if (unfoldedValue.indexOf('"') >= 0) {
buffer.append('{');
buffer.append(unfoldedValue.length());
buffer.append("}\r\n");
buffer.append(unfoldedValue);
} else {
buffer.append('"');
buffer.append(unfoldedValue);
buffer.append('"');
}
appendEnvelopeHeaderValue(buffer, MimeUtility.unfold(value[0]));
} else {
buffer.append("NIL");
}
@ -997,6 +987,20 @@ public class ImapConnection extends AbstractConnection {
}
}
protected void appendEnvelopeHeaderValue(StringBuilder buffer, String unfoldedValue) {
if (unfoldedValue.indexOf('"') >= 0) {
buffer.append('{');
buffer.append(unfoldedValue.length());
buffer.append("}\r\n");
buffer.append(unfoldedValue);
} else {
buffer.append('"');
buffer.append(unfoldedValue);
buffer.append('"');
}
}
protected void appendBodyStructure(StringBuilder buffer, ExchangeSession.Message message) throws IOException {
buffer.append(" BODYSTRUCTURE ");