1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-12 10:42:21 -05:00

IMAP: fix regression in append envelope

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2131 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2013-05-28 22:10:36 +00:00
parent d8d73b122e
commit 44e6900ec6
2 changed files with 10 additions and 3 deletions

View File

@ -1072,10 +1072,10 @@ public class ImapConnection extends AbstractConnection {
}
protected void appendEnvelope(StringBuilder buffer, MessageWrapper message) throws IOException {
buffer.append(" ENVELOPE (");
try {
MimeMessage mimeMessage = message.getMimeMessage();
buffer.append(" ENVELOPE (");
// Envelope for date, subject, from, sender, reply-to, to, cc, bcc,in-reply-to, message-id
appendEnvelopeHeader(buffer, mimeMessage.getHeader("Date"));
appendEnvelopeHeader(buffer, mimeMessage.getHeader("Subject"));
@ -1087,13 +1087,13 @@ public class ImapConnection extends AbstractConnection {
appendMailEnvelopeHeader(buffer, mimeMessage.getHeader("BCC"));
appendEnvelopeHeader(buffer, mimeMessage.getHeader("In-Reply-To"));
appendEnvelopeHeader(buffer, mimeMessage.getHeader("Message-Id"));
buffer.append(')');
} catch (MessagingException me) {
DavGatewayTray.warn(me);
// send fake envelope
buffer.append(" NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL");
buffer.append(" ENVELOPE (NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL)");
}
buffer.append(')');
}
protected void appendEnvelopeHeader(StringBuilder buffer, String[] value) throws UnsupportedEncodingException {

View File

@ -501,4 +501,11 @@ public class TestImap extends AbstractImapTestCase {
System.in.read();
}
public void testAnotherFetch() throws IOException {
writeLine(". SELECT INBOX");
assertEquals(". OK [READ-WRITE] SELECT completed", readFullAnswer("."));
writeLine(". UID FETCH 1:* (BODY.PEEK [HEADER.FIELDS (References X-Ref X-Priority X-MSMail-Priority Importance X-MSOESRec Newsgroups)] ENVELOPE RFC822.SIZE UID FLAGS INTERNALDATE)");
assertEquals(". OK UID FETCH completed", readFullAnswer("."));
}
}