* If no parameter is provided, the current selected
* article is used.
*/
private void doBODY(String param) {
// section 9.2.3
NNTPArticle article = null;
if (isMessageId(param)) {
article = theConfigData.getNNTPRepository().getArticleFromID(param);
if ( article == null ) {
writeLoggedFlushedResponse("430 no such article");
return;
} else {
StringBuffer respBuffer =
new StringBuffer(64)
.append("222 0 ")
.append(param);
writeLoggedFlushedResponse(respBuffer.toString());
}
} else {
int newArticleNumber = currentArticleNumber;
if ( group == null ) {
writeLoggedFlushedResponse("412 no newsgroup selected");
return;
} else {
if ( param == null ) {
if ( currentArticleNumber < 0 ) {
writeLoggedFlushedResponse("420 no current article selected");
return;
} else {
article = group.getArticle(currentArticleNumber);
}
}
else {
newArticleNumber = Integer.parseInt(param);
article = group.getArticle(newArticleNumber);
}
if ( article == null ) {
writeLoggedFlushedResponse("423 no such article number in this group");
return;
} else {
currentArticleNumber = newArticleNumber;
String articleID = article.getUniqueID();
if (articleID == null) {
articleID = "<0>";
}
StringBuffer respBuffer =
new StringBuffer(128)
.append("222 ")
.append(article.getArticleNumber())
.append(" ")
.append(articleID);
writeLoggedFlushedResponse(respBuffer.toString());
}
}
}
if (article != null) {
article.writeBody(writer);
writeLoggedFlushedResponse(".");
}
}