org/sonews/daemon/command/XPatCommand.java
changeset 1 6fceb66e1ad7
child 3 2fdc9cc89502
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/org/sonews/daemon/command/XPatCommand.java	Fri Jun 26 16:48:50 2009 +0200
     1.3 @@ -0,0 +1,89 @@
     1.4 +/*
     1.5 + *   SONEWS News Server
     1.6 + *   see AUTHORS for the list of contributors
     1.7 + *
     1.8 + *   This program is free software: you can redistribute it and/or modify
     1.9 + *   it under the terms of the GNU General Public License as published by
    1.10 + *   the Free Software Foundation, either version 3 of the License, or
    1.11 + *   (at your option) any later version.
    1.12 + *
    1.13 + *   This program is distributed in the hope that it will be useful,
    1.14 + *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.16 + *   GNU General Public License for more details.
    1.17 + *
    1.18 + *   You should have received a copy of the GNU General Public License
    1.19 + *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1.20 + */
    1.21 +
    1.22 +package org.sonews.daemon.command;
    1.23 +
    1.24 +import java.io.IOException;
    1.25 +import java.sql.SQLException;
    1.26 +import org.sonews.daemon.NNTPConnection;
    1.27 +
    1.28 +/**
    1.29 + * <pre>
    1.30 + *   XPAT header range|<message-id> pat [pat...]
    1.31 + *
    1.32 + *   The XPAT command is used to retrieve specific headers from
    1.33 + *   specific articles, based on pattern matching on the contents of
    1.34 + *   the header. This command was first available in INN.
    1.35 + *
    1.36 + *   The required header parameter is the name of a header line (e.g.
    1.37 + *   "subject") in a news group article. See RFC-1036 for a list
    1.38 + *   of valid header lines. The required range argument may be
    1.39 + *   any of the following:
    1.40 + *               an article number
    1.41 + *               an article number followed by a dash to indicate
    1.42 + *                  all following
    1.43 + *               an article number followed by a dash followed by
    1.44 + *                  another article number
    1.45 + *
    1.46 + *   The required message-id argument indicates a specific
    1.47 + *   article. The range and message-id arguments are mutually
    1.48 + *   exclusive. At least one pattern in wildmat must be specified
    1.49 + *   as well. If there are additional arguments the are joined
    1.50 + *   together separated by a single space to form one complete
    1.51 + *   pattern. Successful responses start with a 221 response
    1.52 + *   followed by a the headers from all messages in which the
    1.53 + *   pattern matched the contents of the specified header line. This
    1.54 + *   includes an empty list. Once the output is complete, a period
    1.55 + *   is sent on a line by itself. If the optional argument is a
    1.56 + *   message-id and no such article exists, the 430 error response
    1.57 + *   is returned. A 502 response will be returned if the client only
    1.58 + *   has permission to transfer articles.
    1.59 + *
    1.60 + *   Responses
    1.61 + *
    1.62 + *       221 Header follows
    1.63 + *       430 no such article
    1.64 + *       502 no permission
    1.65 + * </pre>
    1.66 + * [Source:"draft-ietf-nntp-imp-02.txt"] [Copyright: 1998 S. Barber]
    1.67 + * 
    1.68 + * @author Christian Lins
    1.69 + * @since sonews/0.5.0
    1.70 + */
    1.71 +public class XPatCommand extends AbstractCommand
    1.72 +{
    1.73 +
    1.74 +  public XPatCommand(final NNTPConnection conn)
    1.75 +  {
    1.76 +    super(conn);
    1.77 +  }
    1.78 +  
    1.79 +  @Override
    1.80 +  public boolean hasFinished()
    1.81 +  {
    1.82 +    return true;
    1.83 +  }
    1.84 +
    1.85 +  @Override
    1.86 +  public void processLine(final String line) 
    1.87 +    throws IOException, SQLException
    1.88 +  {
    1.89 +    printStatus(500, "not (yet) supported");
    1.90 +  }
    1.91 +
    1.92 +}