public static final DateFormat dateFormat = new SimpleDateFormat("yyyyMMDDhhmmss");
- public static class No extends RuntimeException { int code = 400; } // 4xx response codes
+ 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
public static class Group {
}
public static class Article {
- public Article(int num, Message message) { this.message = message; this.num = num;}
+ public Article(int num, Message message) { this.message = message; this.num = num; }
public final int num;
public final Message message;
}
public MailboxWrapper(Mailbox root, boolean post) { this.root = root; this.post = post; }
public boolean postok() { return post; }
public void post(Message m) throws IOException { current.accept(m); }
- public Group group(String s) {
+
+ public Group group(String s) {
ptr = 0;
Group g = getgroup(s);
if (g==null) return null;
}
private Group getgroup(String s) {
Mailbox box = root;
- Log.error("", "getgroup " + s);
- Log.error("", "mailbox " + root);
for(StringTokenizer st = new StringTokenizer(s, "."); box!=null && st.hasMoreTokens(); box = box.slash(st.nextToken(), false));
if (box==null) return null;
return new Group(s, true, 1, box.count(Query.all()), box.count(Query.all()));
} catch (Exception e) { Log.error(this, e); }
}
println(".");
- } else if (command.equals("LAST")) { Article a = api.last(); println("223 "+a.num+" "+a.message.messageid+" ok");
- } else if (command.equals("NEXT")) { Article a = api.next(); println("223 "+a.num+" "+a.message.messageid+" ok");
+ } else if (command.equals("LAST")) {
+ Article a = api.last(); println("223 "+a.num+" "+a.message.messageid+" ok");
+ } else if (command.equals("NEXT")) {
+ Article a = api.next(); println("223 "+a.num+" "+a.message.messageid+" ok");
} else if (command.equals("QUIT")) { println("205 Bye."); conn.close(); return;
} else if (command.equals("GROUP")) {
Group g = api.group(st.nextToken().toLowerCase());
// add NNTP-Posting-Host header
// Path header: prepend <myname>, (any punctuation separates the list)
// Expires header: the date when expiration happens (??) should we ignore this?
- // Control header: body is the command. Inteprert posts to all.all.ctl as control messages, use Subject line if no Cntrol line
+ // Control header: body is the command. Inteprert posts to all.all.ctl as control messages,
+ // use Subject line if no Cntrol line
// "Approved" line is used for moderaion
// Xref: drop this header if you see it
String[] files = path.list();
for(int i=0; i<files.length; i++) {
try {
- if (files[i].indexOf('.') == -1) continue;
- if (files[i].charAt(0) == '.') continue;
- files[i] = files[i].substring(0, files[i].indexOf('.'));
+ if (files[i].indexOf('.') != -1) files[i] = files[i].substring(0, files[i].indexOf('.'));
int n = Integer.parseInt(files[i]);
if (n>=uidNext) uidNext = n;
} catch(Exception e) { Log.error(this, e); }