public final Headers headers;
public final Part[] subparts;
public final String body;
+ public final int lines;
private final boolean last;
private Part[] parseParts(Stream stream) {
while(true) {
Part p = new Part(stream, (String)content.parameters.get("boundary"), true);
v.addElement(p);
+ //lines += p.lines;
if (p.last) break;
}
return (Part[])v.copyInto(new Part[v.size()]);
ctype = "application/octet-stream";
}
content = new Content(ctype, headers.get("content-description"), headers.get("content-id"), encoding);
- //if (content.composite) { subparts = parseParts(stream); body = null; last = false; return; }
+ //if (content.composite) { subparts = parseParts(stream); body = null; last = false; lines = 0; return; }
subparts = null;
boolean last = false;
+ int lines = 0;
StringBuffer body = new StringBuffer();
for(String s = stream.readln(); s != null; s = stream.readln()) {
if (boundary != null && (s.equals(boundary) || s.equals(boundary + "--"))) {
break;
}
body.append(s);
+ body.append("\r\n");
+ lines++;
}
if ("quoted-printable".equals(encoding)) this.body = MIME.QuotedPrintable.decode(body.toString(),false);
else if ("base64".equals(encoding)) this.body = new String(Base64.decode(body.toString()));
else this.body = body.toString();
this.last = last;
+ this.lines = lines + headers.lines;
}
}
public static class Headers extends org.ibex.js.JSReflection {
private Hashtable head = new Hashtable();
+ public final int lines;
public final String raw;
public String get(String s) { return (String)head.get(s.toLowerCase()); }
public static String uncomment(String val) {
public Headers(Stream stream, boolean assumeMime) throws MailException.Malformed {
StringBuffer all = new StringBuffer();
String key = null;
+ int lines = 0;
for(String s = stream.readln(); s != null && !s.equals(""); s = stream.readln()) {
all.append(s);
all.append("\r\n");
+ lines++;
if (Character.isSpace(s.charAt(0))) {
if (key == null) throw new MailException.Malformed("Message began with a blank line; no headers");
head.put(key, head.get(key) + " " + s.trim());
head.put(key, val);
}
this.raw = all.toString();
+ this.lines = lines;
Enumeration e = head.keys();
boolean mime = assumeMime | (get("mime-version") != null && get("mime-version").trim().equals("1.0"));