org/sonews/daemon/command/NewGroupsCommand.java
changeset 19 91dc9acb03ed
parent 1 6fceb66e1ad7
child 20 6ae5e4f8329b
     1.1 --- a/org/sonews/daemon/command/NewGroupsCommand.java	Fri Jun 26 16:48:50 2009 +0200
     1.2 +++ b/org/sonews/daemon/command/NewGroupsCommand.java	Fri Aug 21 17:40:54 2009 +0200
     1.3 @@ -19,8 +19,8 @@
     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.storage.StorageBackendException;
    1.10  
    1.11  /**
    1.12   * Class handling the NEWGROUPS command.
    1.13 @@ -28,12 +28,13 @@
    1.14   * @author Dennis Schwerdel
    1.15   * @since n3tpd/0.1
    1.16   */
    1.17 -public class NewGroupsCommand extends AbstractCommand
    1.18 +public class NewGroupsCommand implements Command
    1.19  {
    1.20  
    1.21 -  public NewGroupsCommand(final NNTPConnection conn)
    1.22 +  @Override
    1.23 +  public String[] getSupportedCommandStrings()
    1.24    {
    1.25 -    super(conn);
    1.26 +    return new String[]{"NEWGROUPS"};
    1.27    }
    1.28  
    1.29    @Override
    1.30 @@ -43,22 +44,28 @@
    1.31    }
    1.32  
    1.33    @Override
    1.34 -  public void processLine(final String line)
    1.35 -    throws IOException, SQLException
    1.36 +  public boolean isStateful()
    1.37 +  {
    1.38 +    return false;
    1.39 +  }
    1.40 +
    1.41 +  @Override
    1.42 +  public void processLine(NNTPConnection conn, final String line, byte[] raw)
    1.43 +    throws IOException, StorageBackendException
    1.44    {
    1.45      final String[] command = line.split(" ");
    1.46  
    1.47      if(command.length == 3)
    1.48      {
    1.49 -      printStatus(231, "list of new newsgroups follows");
    1.50 +      conn.println("231 list of new newsgroups follows");
    1.51  
    1.52        // Currently we do not store a group's creation date;
    1.53        // so we return an empty list which is a valid response
    1.54 -      println(".");
    1.55 +      conn.println(".");
    1.56      }
    1.57      else
    1.58      {
    1.59 -      printStatus(500, "invalid command usage");
    1.60 +      conn.println("500 invalid command usage");
    1.61      }
    1.62    }
    1.63