IMAP: another fix for 3297849, ENVELOPE formating error/bogus quotes

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1678 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2011-05-11 10:39:47 +00:00
parent c1f6161c7b
commit a830470398
1 changed files with 7 additions and 7 deletions

View File

@ -936,7 +936,7 @@ public class ImapConnection extends AbstractConnection {
buffer.append(')');
}
protected void appendEnvelopeHeader(StringBuilder buffer, String[] value) {
protected void appendEnvelopeHeader(StringBuilder buffer, String[] value) throws UnsupportedEncodingException {
if (buffer.charAt(buffer.length() - 1) != '(') {
buffer.append(' ');
}
@ -958,7 +958,7 @@ public class ImapConnection extends AbstractConnection {
buffer.append('(');
String personal = address.getPersonal();
if (personal != null) {
buffer.append('"').append(MimeUtility.encodeText(personal)).append('"');
appendEnvelopeHeaderValue(buffer, personal);
} else {
buffer.append("NIL");
}
@ -987,15 +987,15 @@ public class ImapConnection extends AbstractConnection {
}
}
protected void appendEnvelopeHeaderValue(StringBuilder buffer, String unfoldedValue) {
if (unfoldedValue.indexOf('"') >= 0) {
protected void appendEnvelopeHeaderValue(StringBuilder buffer, String value) throws UnsupportedEncodingException {
if (value.indexOf('"') >= 0) {
buffer.append('{');
buffer.append(unfoldedValue.length());
buffer.append(value.length());
buffer.append("}\r\n");
buffer.append(unfoldedValue);
buffer.append(value);
} else {
buffer.append('"');
buffer.append(unfoldedValue);
buffer.append(MimeUtility.encodeText(value));
buffer.append('"');
}