final Type serverResponseType = response.getServerResponseType();
final String type = asString(serverResponseType);
final ResponseCode responseCode = response.getResponseCode();
final String code = asString(responseCode);
final String tag = response.getTag();
final ImapCommand command = response.getCommand();
final HumanReadableText textKey = response.getTextKey();
final String text = asString(textKey, session);
final Collection<String> parameters;
final long number;
final boolean useParens;
if (responseCode == null) {
parameters = null;
number = -1;
useParens = false;
} else {
parameters = responseCode.getParameters();
number = responseCode.getNumber();
useParens = responseCode.useParens();
}
//composer.statusResponse(tag, command, type, code, parameters, useParens, number, text);
if (tag == null) {
composer.untagged();
} else {
composer.tag(tag);
}
composer.message(type);
if (responseCode != null) {
composer.openSquareBracket();
composer.message(code);
if (number > -1) {
composer.message(number);
}
if (parameters != null && !parameters.isEmpty()) {
if (useParens)
composer.openParen();
for (Iterator<String> it = parameters.iterator(); it.hasNext();) {
final String parameter = it.next();
composer.message(parameter);
}
if (useParens)
composer.closeParen();
}
composer.closeSquareBracket();
}
if (command != null) {
composer.commandName(command.getName());
}
if (text != null && !"".equals(text)) {
composer.message(text);
}
composer.end();