private Article article(Query q, boolean head, boolean body) {
Mailbox.Iterator it = current.iterator(q);
if (!it.next()) return null;
- //Message m = body ? it.cur() : it.head();
- Message m = it.cur(); // FIXME
- return new Article(m.messageid, it.num(), m);
+ 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);
+ } catch (Exception e) { return null; }
}
public Group[] list() { return list(root, ""); }
private Group[] list(Mailbox who, String prefix) {
int end = Integer.parseInt(range.substring(range.indexOf('-') + 1));
Mailbox.Iterator it = api.current.iterator(Query.messagenum(start, end));
while(it.next()) {
- Message m = it.cur();
- println(it.num()+"\t"+m.subject+"\t"+m.from+"\t"+m.date+"\t"+m.messageid+"\t"+
- m.headers.gets("references") + "\t" + m.size() + "\t" + m.lines);
+ try {
+ Message m = Message.newMessage(new Stream(it.head() + "\r\n"));
+ println(it.num()+"\t"+m.subject+"\t"+m.from+"\t"+m.date+"\t"+m.messageid+"\t"+
+ m.headers.gets("references") + "\t" + m.size() + "\t" + m.lines);
+ } 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");
println("240 article posted ok");
//}
- } else if (command.equals("LIST")) {
- 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"));
+ } else if (command.equals("XROVER")) {
+ // equivalent to "XHDR References"
+ } else if (command.equals("XHDR")) {
+ // argument: header name
+ // argument: 1 | 1- | 1-2 | <mid> | nothing (use current article)
+ println("221 yep");
+ // print art#+header for all matching messages
println(".");
// 412 if no group selected and numeric form used
// 430 if <mid> and not found