improve logic for header-stripping in MIME.java
authoradam <adam@megacz.com>
Thu, 5 Jul 2007 21:47:51 +0000 (21:47 +0000)
committeradam <adam@megacz.com>
Thu, 5 Jul 2007 21:47:51 +0000 (21:47 +0000)
darcs-hash:20070705214751-5007d-e6e30f99559379fd4159e10142a5e9bde9d212d3.gz

src/org/ibex/mail/MIME.java

index 5b62faa..477ce63 100644 (file)
@@ -56,11 +56,10 @@ public class MIME {
                 ctype = "application/octet-stream";
             }
             this.contentType = new ContentType(ctype, headers.get("content-description"), headers.get("content-id"), encoding);
                 ctype = "application/octet-stream";
             }
             this.contentType = new ContentType(ctype, headers.get("content-description"), headers.get("content-id"), encoding);
-            final long bodylength = fount.getLength() - h.getLength() - 2; /*CRLF*/
             // FIXME: this is a horrible, tangled mess.
             this.body = new Fountain() {
             // FIXME: this is a horrible, tangled mess.
             this.body = new Fountain() {
-                    public int getNumLines()  { return Stream.countLines(getStream()); }
-                    public long getLength()   { return bodylength; }
+                    public int getNumLines()  { return Stream.countLines(this.getStream()); }
+                    public long getLength()   { return Stream.countBytes(this.getStream()); }
                     public Stream getStream() { return transformBodyStream(Headers.skip(fount.getStream())); }
                 };
             this.all =
                     public Stream getStream() { return transformBodyStream(Headers.skip(fount.getStream())); }
                 };
             this.all =