1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-14 03:32:22 -05:00

IMAP: Fix FETCH answers to match Outlook expectations

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@395 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-02-24 12:14:03 +00:00
parent e45328fe43
commit cb441d22ef

View File

@ -445,22 +445,28 @@ public class ImapConnection extends AbstractConnection {
} catch (ParseException e) { } catch (ParseException e) {
throw new IOException("Invalid date: " + message.date); throw new IOException("Invalid date: " + message.date);
} }
} else if ("BODY[]".equals(param) || "BODY.PEEK[]".equals(param)) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
message.write(baos);
baos.close();
DavGatewayTray.debug("Message size: " + message.size + " actual size:" + baos.size() + " message+headers: " + (message.size + baos.size()));
buffer.append(" RFC822.SIZE ").append(baos.size()).append(" ").append(param).append("<0> {").append(baos.size()).append("}");
sendClient(buffer.toString());
os.write(baos.toByteArray());
os.flush();
buffer.setLength(0);
} else if ("BODY.PEEK[HEADER]".equals(param) || param.startsWith("BODY.PEEK[HEADER")) { } else if ("BODY.PEEK[HEADER]".equals(param) || param.startsWith("BODY.PEEK[HEADER")) {
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
HeaderOutputStream headerOutputStream = new HeaderOutputStream(baos); HeaderOutputStream headerOutputStream = new HeaderOutputStream(baos);
message.write(headerOutputStream); message.write(headerOutputStream);
baos.close(); baos.close();
buffer.append(" RFC822.SIZE ").append(baos.size()).append(" BODY[HEADER.FIELDS ()] {").append(baos.size()).append("}"); buffer.append(" RFC822.SIZE ").append(headerOutputStream.size);
if ("BODY.PEEK[HEADER]".equals(param)) {
buffer.append(" BODY[HEADER] {");
} else {
buffer.append(" BODY[HEADER.FIELDS ()] {");
}
buffer.append(baos.size()).append("}");
sendClient(buffer.toString());
os.write(baos.toByteArray());
os.flush();
buffer.setLength(0);
} else if ("BODY[]".equals(param) || "BODY.PEEK[]".equals(param)) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
message.write(baos);
baos.close();
DavGatewayTray.debug("Message size: " + message.size + " actual size:" + baos.size() + " message+headers: " + (message.size + baos.size()));
buffer.append(" RFC822.SIZE ").append(baos.size()).append(" ").append("BODY[]").append(" {").append(baos.size()).append("}");
sendClient(buffer.toString()); sendClient(buffer.toString());
os.write(baos.toByteArray()); os.write(baos.toByteArray());
os.flush(); os.flush();