Initial import.
2 * StarOffice News Server
3 * see AUTHORS for the list of contributors
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 package com.so.news.command;
21 import java.io.IOException;
22 import java.util.ArrayList;
23 import com.so.news.NNTPConnection;
24 import com.so.news.storage.Group;
27 * Class handling the LIST command.
28 * @author Christian Lins
29 * @author Dennis Schwerdel
31 public class ListCommand extends Command
33 public ListCommand(NNTPConnection conn)
38 public boolean process(String[] command)
41 if (command.length >= 2)
43 if (command[1].equalsIgnoreCase("OVERVIEW.FMT"))
45 printStatus(215, "information follows");
46 printText("Subject:\nFrom:\nDate:\nMessage-ID:\nReferences:\nBytes:\nLines:");
49 if (command[1].equalsIgnoreCase("NEWSGROUPS"))
51 printStatus(215, "information follows");
52 ArrayList<Group> list = Group.getAll();
55 printTextLine(g.getName() + "\t" + "-");
61 if (command[1].equalsIgnoreCase("SUBSCRIPTIONS"))
63 printStatus(215, "information follows");
68 if (command[1].equalsIgnoreCase("EXTENSIONS"))
70 printStatus(202, "Supported NNTP extensions.");
71 printTextLine("LISTGROUP");
78 printStatus(215, "list of newsgroups follows");
79 for (Group g : Group.getAll())
81 //if(g.getEstimatedArticleCount() <= 0)
84 printTextLine(g.getName() + " " + g.getLastArticle() + " "
85 + g.getFirstArticle() + " y");