1.1 --- a/org/sonews/daemon/command/GroupCommand.java Fri Jun 26 16:48:50 2009 +0200
1.2 +++ b/org/sonews/daemon/command/GroupCommand.java Fri Aug 21 17:40:54 2009 +0200
1.3 @@ -19,9 +19,9 @@
1.4 package org.sonews.daemon.command;
1.5
1.6 import java.io.IOException;
1.7 -import java.sql.SQLException;
1.8 import org.sonews.daemon.NNTPConnection;
1.9 -import org.sonews.daemon.storage.Group;
1.10 +import org.sonews.storage.Channel;
1.11 +import org.sonews.storage.StorageBackendException;
1.12
1.13 /**
1.14 * Class handling the GROUP command.
1.15 @@ -45,12 +45,13 @@
1.16 * @author Dennis Schwerdel
1.17 * @since n3tpd/0.1
1.18 */
1.19 -public class GroupCommand extends AbstractCommand
1.20 +public class GroupCommand implements Command
1.21 {
1.22
1.23 - public GroupCommand(final NNTPConnection conn)
1.24 + @Override
1.25 + public String[] getSupportedCommandStrings()
1.26 {
1.27 - super(conn);
1.28 + return new String[]{"GROUP"};
1.29 }
1.30
1.31 @Override
1.32 @@ -58,32 +59,37 @@
1.33 {
1.34 return true;
1.35 }
1.36 +
1.37 + @Override
1.38 + public boolean isStateful()
1.39 + {
1.40 + return true;
1.41 + }
1.42
1.43 @Override
1.44 - public void processLine(final String line)
1.45 - throws IOException, SQLException
1.46 + public void processLine(NNTPConnection conn, final String line, byte[] raw)
1.47 + throws IOException, StorageBackendException
1.48 {
1.49 final String[] command = line.split(" ");
1.50
1.51 - Group group;
1.52 + Channel group;
1.53 if(command.length >= 2)
1.54 {
1.55 - group = Group.getByName(command[1]);
1.56 - if(group == null)
1.57 + group = Channel.getByName(command[1]);
1.58 + if(group == null || group.isDeleted())
1.59 {
1.60 - printStatus(411, "no such news group");
1.61 + conn.println("411 no such news group");
1.62 }
1.63 else
1.64 {
1.65 - setCurrentGroup(group);
1.66 -
1.67 - printStatus(211, group.getPostingsCount() + " " + group.getFirstArticleNumber()
1.68 + conn.setCurrentGroup(group);
1.69 + conn.println("211 " + group.getPostingsCount() + " " + group.getFirstArticleNumber()
1.70 + " " + group.getLastArticleNumber() + " " + group.getName() + " group selected");
1.71 }
1.72 }
1.73 else
1.74 {
1.75 - printStatus(500, "no group name given");
1.76 + conn.println("500 no group name given");
1.77 }
1.78 }
1.79