more efficient NNTP HEAD
[org.ibex.mail.git] / src / org / ibex / mail / protocol / NNTP.java
index 2be4c8c..6c2d29e 100644 (file)
@@ -65,9 +65,11 @@ public class NNTP {
         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) {