projects
/
org.ibex.mail.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
02e40c7
)
more efficient stream usage in NNTP
author
adam
<adam@megacz.com>
Sat, 17 Mar 2007 09:00:23 +0000
(09:00 +0000)
committer
adam
<adam@megacz.com>
Sat, 17 Mar 2007 09:00:23 +0000
(09:00 +0000)
darcs-hash:
20070317090023
-5007d-
19986e3162f58fcd3dc8f75c3e0431ba3a0cf200
.gz
src/org/ibex/mail/NNTP.java
patch
|
blob
|
history
diff --git
a/src/org/ibex/mail/NNTP.java
b/src/org/ibex/mail/NNTP.java
index
a0d8dd6
..
c91c902
100644
(file)
--- a/
src/org/ibex/mail/NNTP.java
+++ b/
src/org/ibex/mail/NNTP.java
@@
-13,6
+13,7
@@
package org.ibex.mail;
import org.ibex.util.*;
import org.ibex.io.*;
package org.ibex.mail;
import org.ibex.util.*;
import org.ibex.io.*;
+import org.ibex.net.*;
import org.ibex.mail.target.*;
import org.ibex.jinetd.*;
import java.io.*;
import org.ibex.mail.target.*;
import org.ibex.jinetd.*;
import java.io.*;
@@
-84,6
+85,7
@@
public class NNTP {
Mailbox.Iterator it = current.iterator(q);
if (!it.next()) return null;
try {
Mailbox.Iterator it = current.iterator(q);
if (!it.next()) return null;
try {
+ // FIXME: UGLY!
Message m = body ? it.cur() : Message.newMessage(new Fountain.StringFountain(it.head() + "\r\n"));
return new Article(it.nntpNumber(), m);
} catch (Exception e) { return null; }
Message m = body ? it.cur() : Message.newMessage(new Fountain.StringFountain(it.head() + "\r\n"));
return new Article(it.nntpNumber(), m);
} catch (Exception e) { return null; }
@@
-144,7
+146,7
@@
public class NNTP {
}
int code = (head && body) ? 220 : head ? 221 : body ? 222 : 223;
println(code + " " + a.num + " <" + a.message.messageid + "> get ready for some stuff...");
}
int code = (head && body) ? 220 : head ? 221 : body ? 222 : 223;
println(code + " " + a.num + " <" + a.message.messageid + "> get ready for some stuff...");
- if (head) println(a.message.headers.getString());
+ if (head) { a.message.headers.getStream().transcribe(conn); println(); }
if (head && body) println();
if (body) {
Stream stream = a.message.getBody().getStream();
if (head && body) println();
if (body) {
Stream stream = a.message.getBody().getStream();
@@
-295,6
+297,7
@@
public class NNTP {
} else {
println("340 send the article");
StringBuffer buf = new StringBuffer();
} else {
println("340 send the article");
StringBuffer buf = new StringBuffer();
+ // FIXME: streaming?
while(true) {
String s = conn.readln();
if (s == null) throw new RuntimeException("connection closed");
while(true) {
String s = conn.readln();
if (s == null) throw new RuntimeException("connection closed");