1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-14 11:42:23 -05:00

IMAP: fix new ENVELOPE feature, must return encoded values

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@803 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-10-29 22:45:17 +00:00
parent dad57ca648
commit 857e491e1a
2 changed files with 13 additions and 10 deletions

View File

@ -1458,6 +1458,12 @@ public class ExchangeSession {
} }
} }
/**
* Load message content in a Mime message
* @return mime message
* @throws IOException on error
* @throws MessagingException on error
*/
public MimeMessage getMimeMessage() throws IOException, MessagingException { public MimeMessage getMimeMessage() throws IOException, MessagingException {
if (mimeMessage == null) { if (mimeMessage == null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();

View File

@ -679,15 +679,9 @@ public class ImapConnection extends AbstractConnection {
protected void appendEnvelopeHeader(StringBuilder buffer, String[] value) { protected void appendEnvelopeHeader(StringBuilder buffer, String[] value) {
buffer.append(' '); buffer.append(' ');
if (value != null && value.length > 0) { if (value != null && value.length > 0) {
try {
buffer.append('"'); buffer.append('"');
// TODO: replace with MimeUtility.unfold buffer.append(MimeUtility.unfold(value[0]));
buffer.append(MimeUtility.decodeText(value[0]).replaceAll("\r\n", ""));
buffer.append('"'); buffer.append('"');
} catch (UnsupportedEncodingException e) {
DavGatewayTray.warn(e);
buffer.append("nil");
}
} else { } else {
buffer.append("nil"); buffer.append("nil");
} }
@ -703,7 +697,7 @@ public class ImapConnection extends AbstractConnection {
buffer.append('('); buffer.append('(');
String personal = address.getPersonal(); String personal = address.getPersonal();
if (personal != null) { if (personal != null) {
buffer.append('"').append(personal).append('"'); buffer.append('"').append(MimeUtility.encodeText(personal)).append('"');
} else { } else {
buffer.append("nil"); buffer.append("nil");
} }
@ -723,6 +717,9 @@ public class ImapConnection extends AbstractConnection {
} catch (AddressException e) { } catch (AddressException e) {
DavGatewayTray.warn(e); DavGatewayTray.warn(e);
buffer.append("nil"); buffer.append("nil");
} catch (UnsupportedEncodingException e) {
DavGatewayTray.warn(e);
buffer.append("nil");
} }
} else { } else {
buffer.append("nil"); buffer.append("nil");