1.1 --- a/src/org/sonews/daemon/command/ListGroupCommand.java Sun Aug 29 18:17:37 2010 +0200
1.2 +++ b/src/org/sonews/daemon/command/ListGroupCommand.java Thu Oct 20 10:50:58 2011 +0200
1.3 @@ -15,14 +15,14 @@
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 java.util.List;
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 +import org.sonews.storage.StorageManager;
1.17
1.18 /**
1.19 * Class handling the LISTGROUP command.
1.20 @@ -30,42 +30,36 @@
1.21 * @author Dennis Schwerdel
1.22 * @since n3tpd/0.1
1.23 */
1.24 -public class ListGroupCommand implements Command
1.25 -{
1.26 +public class ListGroupCommand implements Command {
1.27
1.28 @Override
1.29 - public String[] getSupportedCommandStrings()
1.30 - {
1.31 - return new String[] {"LISTGROUP"};
1.32 + public String[] getSupportedCommandStrings() {
1.33 + return new String[]{"LISTGROUP"};
1.34 }
1.35
1.36 @Override
1.37 - public boolean hasFinished()
1.38 - {
1.39 + public boolean hasFinished() {
1.40 return true;
1.41 }
1.42
1.43 @Override
1.44 - public String impliedCapability()
1.45 - {
1.46 + public String impliedCapability() {
1.47 return null;
1.48 }
1.49
1.50 @Override
1.51 - public boolean isStateful()
1.52 - {
1.53 + public boolean isStateful() {
1.54 return false;
1.55 }
1.56
1.57 @Override
1.58 public void processLine(NNTPConnection conn, final String commandName, byte[] raw)
1.59 - throws IOException, StorageBackendException
1.60 - {
1.61 + throws IOException, StorageBackendException {
1.62 final String[] command = commandName.split(" ");
1.63
1.64 - Channel group;
1.65 + Group group;
1.66 if (command.length >= 2) {
1.67 - group = Channel.getByName(command[1]);
1.68 + group = StorageManager.current().getGroup(command[1]);
1.69 } else {
1.70 group = conn.getCurrentChannel();
1.71 }
1.72 @@ -77,8 +71,8 @@
1.73
1.74 List<Long> ids = group.getArticleNumbers();
1.75 conn.println("211 " + ids.size() + " "
1.76 - + group.getFirstArticleNumber() + " "
1.77 - + group.getLastArticleNumber() + " list of article numbers follow");
1.78 + + group.getFirstArticleNumber() + " "
1.79 + + group.getLastArticleNumber() + " list of article numbers follow");
1.80 for (long id : ids) {
1.81 // One index number per line
1.82 conn.println(Long.toString(id));