update Mail for new JS API
[org.ibex.mail.git] / src / org / ibex / mail / protocol / NNTP.java
index 7fa9409..f822ef5 100644 (file)
@@ -22,7 +22,7 @@ import java.text.*;
 /** NNTP send/recieve */
 public class NNTP {
 
-    public static final DateFormat dateFormat = new SimpleDateFormat("YYYYMMDDhhmmss");
+    public static final DateFormat dateFormat = new SimpleDateFormat("yyyyMMDDhhmmss");
 
     public static class No  extends RuntimeException { int code = 400; }    // 4xx response codes
     public static class Bad extends RuntimeException { int code = 500; public Bad(String s) { super(s); } }    // 5xx response codes
@@ -75,7 +75,7 @@ public class NNTP {
             try {
                 Message m = body ? it.cur() : Message.newMessage(new Stream(it.head() + "\r\n"));
                 //Message m = it.cur(); // FIXME
-                return new Article(m.messageid, it.num(), m);
+                return new Article(it.num(), m);
             } catch (Exception e) { return null; }
         }
         public Group[]  list() { return list(root, ""); }
@@ -181,7 +181,7 @@ public class NNTP {
                     if (st.hasMoreTokens()) {
                         String arg = st.nextToken();
                         if (arg.equalsIgnoreCase("STREAM"));
-                        streaming = true;
+                        //streaming = true;
                         println("203 Streaming permitted");
                     } else {
                         println("201 Hello, you can post.");
@@ -222,7 +222,7 @@ public class NNTP {
                     // FIXME deal with GMT
                     Date d = new Date();
                     try {
-                        d = new SimpleDateFormat("YYMMDD HHMMSS").parse(gmt);
+                        d = new SimpleDateFormat("yyMMDD HHMMSS").parse(gmt);
                     } catch (ParseException pe) {
                         Log.warn(this, pe);
                     }
@@ -294,7 +294,7 @@ public class NNTP {
                     println(".");
                 } else if (command.equals("LIST"))      { 
                     if (st.hasMoreTokens()) {
-                        String argument = st.nextToken().toUppercase();
+                        String argument = st.nextToken().toUpperCase();
                         if (argument.equalsIgnoreCase("EXTENSIONS")) {
                             println("202 Extensions supported:");
                             println("STREAMING");
@@ -304,6 +304,7 @@ public class NNTP {
                             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")) {
@@ -353,11 +354,13 @@ public class NNTP {
                     // 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.");
                     }
+                    */
 
                 } else if (command.equals("IHAVE"))     {
                     boolean want = api.ihave(st.nextToken());