mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-14 19:52:21 -05:00
IMAP: fix BODYSTRUCTURE, build message on full buffer, do not rely on partial buffer (header, body, ...)
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@707 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
b36085f241
commit
f1fa54311d
@ -501,9 +501,7 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
bodystructure = true;
|
bodystructure = true;
|
||||||
} else {
|
} else {
|
||||||
// thunderbird : send BODYSTRUCTURE
|
// thunderbird : send BODYSTRUCTURE
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
appendBodyStructure(buffer, message);
|
||||||
message.write(baos);
|
|
||||||
appendBodyStructure(buffer, baos);
|
|
||||||
}
|
}
|
||||||
} else if ("INTERNALDATE".equals(param) && message.date != null && message.date.length() > 0) {
|
} else if ("INTERNALDATE".equals(param) && message.date != null && message.date.length() > 0) {
|
||||||
try {
|
try {
|
||||||
@ -524,7 +522,7 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
if (bodystructure) {
|
if (bodystructure) {
|
||||||
bodystructure = false;
|
bodystructure = false;
|
||||||
// Apple Mail: need to build full bodystructure
|
// Apple Mail: need to build full bodystructure
|
||||||
appendBodyStructure(buffer, baos);
|
appendBodyStructure(buffer, message);
|
||||||
}
|
}
|
||||||
buffer.append(" RFC822.SIZE ").append(partOutputStream.size);
|
buffer.append(" RFC822.SIZE ").append(partOutputStream.size);
|
||||||
if ("BODY.PEEK[HEADER]".equals(param)) {
|
if ("BODY.PEEK[HEADER]".equals(param)) {
|
||||||
@ -563,7 +561,7 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
if (bodystructure) {
|
if (bodystructure) {
|
||||||
bodystructure = false;
|
bodystructure = false;
|
||||||
// Apple Mail: need to build full bodystructure
|
// Apple Mail: need to build full bodystructure
|
||||||
appendBodyStructure(buffer, baos);
|
appendBodyStructure(buffer, message);
|
||||||
}
|
}
|
||||||
buffer.append(" RFC822.SIZE ").append(rfc822size).append(' ');
|
buffer.append(" RFC822.SIZE ").append(rfc822size).append(' ');
|
||||||
if ("BODY.PEEK[TEXT]".equals(param)) {
|
if ("BODY.PEEK[TEXT]".equals(param)) {
|
||||||
@ -587,7 +585,10 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
sendClient(buffer.toString());
|
sendClient(buffer.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void appendBodyStructure(StringBuilder buffer, ByteArrayOutputStream baos) throws IOException {
|
protected void appendBodyStructure(StringBuilder buffer, ExchangeSession.Message message) throws IOException {
|
||||||
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
message.write(baos);
|
||||||
|
|
||||||
buffer.append(" BODYSTRUCTURE ");
|
buffer.append(" BODYSTRUCTURE ");
|
||||||
try {
|
try {
|
||||||
MimeMessage mimeMessage = new MimeMessage(null, new ByteArrayInputStream(baos.toByteArray()));
|
MimeMessage mimeMessage = new MimeMessage(null, new ByteArrayInputStream(baos.toByteArray()));
|
||||||
|
Loading…
Reference in New Issue
Block a user