int count = 0;
List<MessageMetaData> validResults = new ArrayList<MessageMetaData>();
if (uidList.isEmpty() == false) {
for (int i = 0; i < uidList.size(); i++) {
MessageMetaData data = uidList.get(i);
if (deletedUidList.contains(data.getUid()) == false) {
size += data.getSize();
count++;
validResults.add(data);
}
}
}
StringBuilder responseBuffer = new StringBuilder(32).append(count).append(" ").append(size);
response = new POP3Response(POP3Response.OK_RESPONSE, responseBuffer.toString());
count = 0;
for (int i = 0; i < validResults.size(); i++) {
responseBuffer = new StringBuilder(16).append(i + 1).append(" ").append(validResults.get(i).getSize());
response.appendLine(responseBuffer.toString());
}
response.appendLine(".");
} else {
int num = 0;
try {
num = Integer.parseInt(parameters);
MessageMetaData data = MessageMetaDataUtils.getMetaData(session, num);
if (data == null) {
StringBuilder responseBuffer = new StringBuilder(64).append("Message (").append(num).append(") does not exist.");
return new POP3Response(POP3Response.ERR_RESPONSE, responseBuffer.toString());
}
if (deletedUidList.contains(data.getUid()) == false) {
StringBuilder responseBuffer = new StringBuilder(64).append(num).append(" ").append(data.getSize());
response = new POP3Response(POP3Response.OK_RESPONSE, responseBuffer.toString());
} else {
StringBuilder responseBuffer = new StringBuilder(64).append("Message (").append(num).append(") already deleted.");
response = new POP3Response(POP3Response.ERR_RESPONSE, responseBuffer.toString());
}