1
0
mirror of https://github.com/moparisthebest/davmail synced 2025-01-12 22:18:11 -05:00

IMAP: refactor BODYSTRUCTURE generation

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@479 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-03-27 09:07:03 +00:00
parent 285c543d6b
commit d3aa687124

View File

@ -609,31 +609,30 @@ public class ImapConnection extends AbstractConnection {
buffer.append(" ()"); buffer.append(" ()");
} }
} }
// body id appendBodyStructureValue(buffer, bodyPart.getContentID());
if (bodyPart.getContentID() == null) { appendBodyStructureValue(buffer, bodyPart.getDescription());
buffer.append(" NIL"); appendBodyStructureValue(buffer, bodyPart.getEncoding());
} else { appendBodyStructureValue(buffer, bodyPart.getSize());
buffer.append(" \"").append(bodyPart.getContentID()).append("\""); appendBodyStructureValue(buffer, bodyPart.getLineCount());
}
if (bodyPart.getDescription() == null) {
buffer.append(" NIL");
} else {
buffer.append(" \"").append(bodyPart.getDescription()).append("\"");
}
if (bodyPart.getHeader("Content-Transfer-Encoding") == null) {
buffer.append(" NIL");
} else {
buffer.append(" \"").append(bodyPart.getEncoding().toUpperCase()).append("\"");
}
buffer.append(' ').append(bodyPart.getSize());
if (bodyPart.getLineCount() < 0) {
buffer.append(" NIL");
} else {
buffer.append(' ').append(bodyPart.getLineCount()).append('"');
}
buffer.append(')'); buffer.append(')');
} }
protected void appendBodyStructureValue(StringBuilder buffer, String value) throws IOException, MessagingException {
if (value == null) {
buffer.append(" NIL");
} else {
buffer.append(" \"").append(value.toUpperCase()).append("\"");
}
}
protected void appendBodyStructureValue(StringBuilder buffer, int value) throws IOException, MessagingException {
if (value < 0) {
buffer.append(" NIL");
} else {
buffer.append(' ').append(value);
}
}
static final class SearchConditions { static final class SearchConditions {
Boolean flagged = null; Boolean flagged = null;
Boolean answered = null; Boolean answered = null;