src/org/sonews/daemon/command/NextPrevCommand.java
changeset 56 c713ca00a4a7
parent 37 74139325d305
     1.1 --- a/src/org/sonews/daemon/command/NextPrevCommand.java	Sun Aug 29 18:17:37 2010 +0200
     1.2 +++ b/src/org/sonews/daemon/command/NextPrevCommand.java	Tue Sep 13 19:08:15 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.daemon.NNTPConnection;
    1.12  import org.sonews.storage.Article;
    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,39 +29,33 @@
    1.19   * @author Dennis Schwerdel
    1.20   * @since n3tpd/0.1
    1.21   */
    1.22 -public class NextPrevCommand implements Command
    1.23 -{
    1.24 +public class NextPrevCommand implements Command {
    1.25  
    1.26  	@Override
    1.27 -	public String[] getSupportedCommandStrings()
    1.28 -	{
    1.29 -		return new String[] {"NEXT", "PREV"};
    1.30 +	public String[] getSupportedCommandStrings() {
    1.31 +		return new String[]{"NEXT", "PREV"};
    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  	@Override
    1.56  	public void processLine(NNTPConnection conn, final String line, byte[] raw)
    1.57 -		throws IOException, StorageBackendException
    1.58 -	{
    1.59 +			throws IOException, StorageBackendException {
    1.60  		final Article currA = conn.getCurrentArticle();
    1.61 -		final Channel currG = conn.getCurrentChannel();
    1.62 +		final Group currG = conn.getCurrentChannel();
    1.63  
    1.64  		if (currA == null) {
    1.65  			conn.println("420 no current article has been selected");
    1.66 @@ -85,10 +78,9 @@
    1.67  		}
    1.68  	}
    1.69  
    1.70 -	private void selectNewArticle(NNTPConnection conn, Article article, Channel grp,
    1.71 -		final int delta)
    1.72 -		throws IOException, StorageBackendException
    1.73 -	{
    1.74 +	private void selectNewArticle(NNTPConnection conn, Article article, Group grp,
    1.75 +			final int delta)
    1.76 +			throws IOException, StorageBackendException {
    1.77  		assert article != null;
    1.78  
    1.79  		article = grp.getArticle(grp.getIndexOf(article) + delta);
    1.80 @@ -98,8 +90,8 @@
    1.81  		} else {
    1.82  			conn.setCurrentArticle(article);
    1.83  			conn.println("223 " + conn.getCurrentChannel().getIndexOf(article)
    1.84 -				+ " " + article.getMessageID()
    1.85 -				+ " article retrieved - request text separately");
    1.86 +					+ " " + article.getMessageID()
    1.87 +					+ " article retrieved - request text separately");
    1.88  		}
    1.89  	}
    1.90  }