1.1 --- a/src/org/sonews/daemon/command/ArticleCommand.java Sun Sep 11 14:19:19 2011 +0200
1.2 +++ b/src/org/sonews/daemon/command/ArticleCommand.java Sun Sep 11 15:05:04 2011 +0200
1.3 @@ -15,13 +15,12 @@
1.4 * You should have received a copy of the GNU General Public License
1.5 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1.6 */
1.7 -
1.8 package org.sonews.daemon.command;
1.9
1.10 import java.io.IOException;
1.11 import org.sonews.storage.Article;
1.12 import org.sonews.daemon.NNTPConnection;
1.13 -import org.sonews.storage.Channel;
1.14 +import org.sonews.storage.Group;
1.15 import org.sonews.storage.StorageBackendException;
1.16
1.17 /**
1.18 @@ -30,38 +29,32 @@
1.19 * @author Dennis Schwerdel
1.20 * @since n3tpd/0.1
1.21 */
1.22 -public class ArticleCommand implements Command
1.23 -{
1.24 +public class ArticleCommand implements Command {
1.25
1.26 @Override
1.27 - public String[] getSupportedCommandStrings()
1.28 - {
1.29 - return new String[] {"ARTICLE", "BODY", "HEAD"};
1.30 + public String[] getSupportedCommandStrings() {
1.31 + return new String[]{"ARTICLE", "BODY", "HEAD"};
1.32 }
1.33
1.34 @Override
1.35 - public boolean hasFinished()
1.36 - {
1.37 + public boolean hasFinished() {
1.38 return true;
1.39 }
1.40
1.41 @Override
1.42 - public String impliedCapability()
1.43 - {
1.44 + public String impliedCapability() {
1.45 return null;
1.46 }
1.47
1.48 @Override
1.49 - public boolean isStateful()
1.50 - {
1.51 + public boolean isStateful() {
1.52 return false;
1.53 }
1.54
1.55 // TODO: Refactor this method to reduce its complexity!
1.56 @Override
1.57 public void processLine(NNTPConnection conn, final String line, byte[] raw)
1.58 - throws IOException
1.59 - {
1.60 + throws IOException {
1.61 final String[] command = line.split(" ");
1.62
1.63 Article article = null;
1.64 @@ -82,7 +75,7 @@
1.65 } else {
1.66 // Message Number
1.67 try {
1.68 - Channel currentGroup = conn.getCurrentChannel();
1.69 + Group currentGroup = conn.getCurrentChannel();
1.70 if (currentGroup == null) {
1.71 conn.println("400 no group selected");
1.72 return;
1.73 @@ -105,7 +98,7 @@
1.74
1.75 if (command[0].equalsIgnoreCase("ARTICLE")) {
1.76 conn.println("220 " + artIndex + " " + article.getMessageID()
1.77 - + " article retrieved - head and body follow");
1.78 + + " article retrieved - head and body follow");
1.79 conn.println(article.getHeaderSource());
1.80 conn.println("");
1.81 conn.println(article.getBody());
1.82 @@ -144,7 +137,7 @@
1.83 * message-id Article message-id
1.84 */ else if (command[0].equalsIgnoreCase("HEAD")) {
1.85 conn.println("221 " + artIndex + " " + article.getMessageID()
1.86 - + " Headers follow (multi-line)");
1.87 + + " Headers follow (multi-line)");
1.88 conn.println(article.getHeaderSource());
1.89 conn.println(".");
1.90 }