+ // 412 if no group selected and numeric form used
+ // 430 if <mid> and not found
+ // 420 if no messages in range
+ } else if (command.equals("XPAT")) {
+ // just like XHDR, but a pattern follows the last argument (may contain whitespace)
+ println("221 yep");
+ // print
+ println(".");
+ } else if (command.equals("LIST")) {
+ if (st.hasMoreTokens()) {
+ String argument = st.nextToken().toUpperCase();
+ if (argument.equalsIgnoreCase("EXTENSIONS")) {
+ println("202 Extensions supported:");
+ println("STREAMING");
+ println("");
+ println(".");
+ } else if (argument.equals("ACTIVE")) {
+ String wildmat = st.hasMoreTokens() ? st.nextToken() : null;
+ // FIXME: deal with wildmat
+ // just like list, but only show active groups
+ throw new Bad("not implemented yet");
+ } else if (argument.equals("SUBSCRIPTIONS")) {
+ // FIXME: show 215, default subscription list for new users, period
+ } else if (argument.equals("OVERVIEW.FMT")) {
+ println("215 Overview format:");
+ println("Subject:");
+ println("From:");
+ println("Date:");
+ println("Message-ID:");
+ println("References:");
+ println("Bytes:");
+ println("Lines:");
+ //println("Xref:full");
+ println(".");
+ } else if (argument.equals("NEWSGROUPS")) {
+ String wildmat = st.hasMoreTokens() ? st.nextToken() : null;
+ // respond 215, print each newsgroup, a space, and the description; end with lone period
+ } else {
+ // barf here
+ }
+ } else {
+ Group[] g = api.list();
+ println("215 list of groups follows");
+ for(int i=0; i<g.length; i++)
+ println(g[i].name + " " + g[i].last + " " + g[i].first + " " + (g[i].post ? "y" : "n"));
+ println(".");
+ }
+
+ } else if (command.equals("LISTGROUP")) {
+ String groupname = st.hasMoreTokens() ? st.nextToken() : null;
+ // 211, all article numbers in group, period. Set article ptr to first item in group
+
+ } else if (command.equals("XGTITLE")) {
+ String wildmat = st.hasMoreTokens() ? st.nextToken() : null;
+ // 282, then identical to LIST NEWSGROUP
+
+ } else if (command.equals("CHECK")) {
+ // FIXME: may be pipelined; must spawn threads
+ String mid = st.nextToken();
+ boolean want = api.ihave(mid);
+ if (!want) {
+ println("438 "+ mid+" No thanks");
+ } else {
+ println("238 "+mid+" Yes, I'd like that");
+ }
+
+ } else if (command.equals("TAKETHIS")) {
+ // FIXME: may be pipelined
+ String mid = st.nextToken();
+ // MUST read message here
+ /*
+ if (!want) {
+ println("439 "+ mid+" Transfer failed");
+ } else {
+ println("239 "+mid+" Rock on.");
+ }
+ */