X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fmail%2Fprotocol%2FNNTP.java;fp=src%2Forg%2Fibex%2Fmail%2Fprotocol%2FNNTP.java;h=f822ef5841b9e0891c653b0641fb14d8da6f5112;hb=79d757b55fd4507718b35f584a02b449bea76603;hp=7fa9409cb579f7b2bc8711732da3a742e10703ef;hpb=97d7631c5b1fba754e06163fa14965ab1eab8e72;p=org.ibex.mail.git diff --git a/src/org/ibex/mail/protocol/NNTP.java b/src/org/ibex/mail/protocol/NNTP.java index 7fa9409..f822ef5 100644 --- a/src/org/ibex/mail/protocol/NNTP.java +++ b/src/org/ibex/mail/protocol/NNTP.java @@ -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());