1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 11:12:22 -05:00

IMAP: remove test code

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@393 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-02-24 10:22:55 +00:00
parent eba0e0fded
commit a75fda975e

View File

@ -426,23 +426,22 @@ public class ImapConnection extends AbstractConnection {
private void handleFetch(ExchangeSession.Message message, int currentIndex, String parameters) throws IOException { private void handleFetch(ExchangeSession.Message message, int currentIndex, String parameters) throws IOException {
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder();
buffer.append("* " + (currentIndex) + " FETCH (UID " + message.getUidAsLong()); buffer.append("* ").append(currentIndex).append(" FETCH (UID ").append(message.getUidAsLong());
StringTokenizer paramTokens = new StringTokenizer(parameters); StringTokenizer paramTokens = new StringTokenizer(parameters);
while (paramTokens.hasMoreTokens()) { while (paramTokens.hasMoreTokens()) {
String param = paramTokens.nextToken(); String param = paramTokens.nextToken();
if ("FLAGS".equals(param)) { if ("FLAGS".equals(param)) {
buffer.append(" FLAGS (" + (message.getImapFlags()) + ")"); buffer.append(" FLAGS (").append(message.getImapFlags()).append(")");
} else if ("BODYSTRUCTURE".equals(param)) { } else if ("BODYSTRUCTURE".equals(param)) {
buffer.append(" BODYSTRUCTURE (\"TEXT\" \"PLAIN\" (\"CHARSET\" \"windows-1252\") NIL NIL \"QUOTED-PRINTABLE\" " + message.size + " 50 NIL NIL NIL NIL))"); buffer.append(" BODYSTRUCTURE (\"TEXT\" \"PLAIN\" (\"CHARSET\" \"windows-1252\") NIL NIL \"QUOTED-PRINTABLE\" ").append(message.size).append(" 50 NIL NIL NIL NIL))");
} else if ("INTERNALDATE".equals(param)) { } else if ("INTERNALDATE".equals(param)) {
try { try {
SimpleDateFormat dateParser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); SimpleDateFormat dateParser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
dateParser.setTimeZone(ExchangeSession.GMT_TIMEZONE); dateParser.setTimeZone(ExchangeSession.GMT_TIMEZONE);
Date date = null; Date date = dateParser.parse(message.date);
date = dateParser.parse(message.date);
SimpleDateFormat dateFormatter = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss Z", Locale.ENGLISH); SimpleDateFormat dateFormatter = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss Z", Locale.ENGLISH);
buffer.append(" INTERNALDATE \"" + dateFormatter.format(date) + "\""); buffer.append(" INTERNALDATE \"").append(dateFormatter.format(date)).append("\"");
} catch (ParseException e) { } catch (ParseException e) {
throw new IOException("Invalid date: " + message.date); throw new IOException("Invalid date: " + message.date);
} }
@ -451,9 +450,9 @@ public class ImapConnection extends AbstractConnection {
message.write(baos); message.write(baos);
baos.close(); baos.close();
DavGatewayTray.debug("Message size: " + message.size + " actual size:" + baos.size() + " message+headers: " + (message.size + baos.size())); DavGatewayTray.debug("Message size: " + message.size + " actual size:" + baos.size() + " message+headers: " + (message.size + baos.size()));
buffer.append(" RFC822.SIZE " + baos.size() + " " + param + "<0> {" + (baos.size()-4) + "}"); buffer.append(" RFC822.SIZE ").append(baos.size()).append(" ").append(param).append("<0> {").append(baos.size()).append("}");
sendClient(buffer.toString()); sendClient(buffer.toString());
os.write(baos.toByteArray(), 0, baos.toByteArray().length-4); os.write(baos.toByteArray());
os.flush(); os.flush();
buffer.setLength(0); 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")) {
@ -461,7 +460,7 @@ public class ImapConnection extends AbstractConnection {
HeaderOutputStream headerOutputStream = new HeaderOutputStream(baos); HeaderOutputStream headerOutputStream = new HeaderOutputStream(baos);
message.write(headerOutputStream); message.write(headerOutputStream);
baos.close(); baos.close();
buffer.append(" RFC822.SIZE " + baos.size() + " BODY[HEADER.FIELDS ()] {" + baos.size() + "}"); buffer.append(" RFC822.SIZE ").append(baos.size()).append(" BODY[HEADER.FIELDS ()] {").append(baos.size()).append("}");
sendClient(buffer.toString()); sendClient(buffer.toString());
os.write(baos.toByteArray()); os.write(baos.toByteArray());
os.flush(); os.flush();
@ -475,7 +474,7 @@ public class ImapConnection extends AbstractConnection {
static final class SearchConditions { static final class SearchConditions {
Boolean flagged = null; Boolean flagged = null;
Boolean answered = null; Boolean answered = null;
StringBuilder query = new StringBuilder(); final StringBuilder query = new StringBuilder();
public StringBuilder append(String value) { public StringBuilder append(String value) {
return query.append(value); return query.append(value);
@ -733,7 +732,7 @@ public class ImapConnection extends AbstractConnection {
} }
protected class UIDRangeIterator implements Iterator<ExchangeSession.Message> { protected class UIDRangeIterator implements Iterator<ExchangeSession.Message> {
String[] ranges; final String[] ranges;
int currentIndex = 0; int currentIndex = 0;
int currentRangeIndex = 0; int currentRangeIndex = 0;
long startUid; long startUid;
@ -786,7 +785,7 @@ public class ImapConnection extends AbstractConnection {
} }
protected class RangeIterator implements Iterator<ExchangeSession.Message> { protected class RangeIterator implements Iterator<ExchangeSession.Message> {
String[] ranges; final String[] ranges;
int currentIndex = 0; int currentIndex = 0;
int currentRangeIndex = 0; int currentRangeIndex = 0;
long startUid; long startUid;