public final String user;
public final String host;
public final String description;
- public static Address parse(String s) { try { return new Address(s); } catch (Malformed _) { return null; } }
+ public static Address parse(String s) { try { return s==null?null:new Address(s); } catch (Malformed _) { return null; } }
public Address(String user, String host, String description) {this.user=user;this.host=host;this.description=description;}
public Address(String s0) throws Address.Malformed {
String s = s0.trim();
public Part(Stream stream, String boundary, boolean assumeMime) throws MailException.Malformed {
this.headers = new Headers(stream, assumeMime);
- this.mime = assumeMime | (headers.get("mime-version")!=null&&headers.get("mime-version").trim().equals("1.0"));
- String ctype = headers.get("content-type");
- String encoding = headers.get("content-transfer-encoding");
+ this.mime = assumeMime | (headers.gets("mime-version")!=null&&headers.gets("mime-version").trim().equals("1.0"));
+ String ctype = headers.gets("content-type");
+ String encoding = headers.gets("content-transfer-encoding");
if (!(encoding == null || encoding.equals("7bit") || encoding.equals("8bit") || encoding.equals("binary") ||
encoding.equals("quoted-printable") || encoding.equals("base64"))) {
Log.warn(MIME.class, "unknown TransferEncoding \"" + encoding + "\"");
ctype = "application/octet-stream";
}
- content = new Content(ctype, headers.get("content-description"), headers.get("content-id"), encoding);
+ content = new Content(ctype, headers.gets("content-description"), headers.gets("content-id"), encoding);
//if (content.composite) { subparts = parseParts(stream); body = null; last = false; lines = 0; return; }
subparts = null;
boolean last = false;
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 Object get(Object s) { return head.get(((String)s).toLowerCase()); }
+ public String gets(String s) { return (String)get(s); }
public static String uncomment(String val) {
boolean inquotes = false;
for(int i=0; i<val.length(); i++) {
this.lines = lines;
Enumeration e = head.keys();
- boolean mime = assumeMime | (get("mime-version") != null && get("mime-version").trim().equals("1.0"));
+ boolean mime = assumeMime | (gets("mime-version") != null && gets("mime-version").trim().equals("1.0"));
while(e.hasMoreElements()) {
String k = (String)e.nextElement();
String v = (String)head.get(k);
public final Address from;
public static Envelope augment(Envelope e, MIME.Headers h) {
if (e.from != null && e.to != null) return e;
- Address to = e.to == null ? Address.parse(h.get("X-org.ibex.mail.headers.envelope.To")) : e.to;
- Address from = e.from == null ? Address.parse(h.get("X-org.ibex.mail.headers.envelope.From")) : e.from;
+ Address to = e.to == null ? Address.parse(h.gets("X-org.ibex.mail.headers.envelope.To")) : e.to;
+ Address from = e.from == null ? Address.parse(h.gets("X-org.ibex.mail.headers.envelope.From")) : e.from;
return new Envelope(from, to, e.arrival);
}
}
super(stream, null, false);
Vec resent = new Vec(), traces = new Vec();
this.envelope = Envelope.augment(envelope, headers);
- this.to = headers.get("To") == null ? envelope.to : Address.parse(headers.get("To"));
- this.from = headers.get("From") == null ? envelope.from : Address.parse(headers.get("From"));
- this.replyto = headers.get("Reply-To") == null ? null : Address.parse(headers.get("Reply-To"));
- this.subject = headers.get("Subject");
- this.messageid = headers.get("Message-Id");
- this.cc = Address.list(headers.get("Cc"));
- this.bcc = Address.list(headers.get("BCc"));
- this.date = parseDate(headers.get("Date"));
+ this.to = headers.gets("To") == null ? envelope.to : Address.parse(headers.gets("To"));
+ this.from = headers.gets("From") == null ? envelope.from : Address.parse(headers.gets("From"));
+ this.replyto = headers.gets("Reply-To") == null ? null : Address.parse(headers.gets("Reply-To"));
+ this.subject = headers.gets("Subject");
+ this.messageid = headers.gets("Message-Id");
+ this.cc = Address.list(headers.gets("Cc"));
+ this.bcc = Address.list(headers.gets("BCc"));
+ this.date = parseDate(headers.gets("Date"));
resent.copyInto(this.resent = new Hashtable[resent.size()]);
traces.copyInto(this.traces = new Trace[traces.size()]);
}
if (!negate) {
if(e) for(int j=0; j<headers.length; j++) {
r.append(headers[j] + (j<headers.length-1?" ":""));
- if (m.headers.get(headers[j]) != null) payload += headers[j]+": "+m.headers.get(headers[j])+"\r\n";
+ if (m.headers.gets(headers[j]) != null) payload += headers[j]+": "+m.headers.gets(headers[j])+"\r\n";
}
} else {
throw new Server.No("HEADERS.NOT temporarily disaled");
if(e) { OUTER: for(Enumeration x=m.headers.keys(); x.hasMoreElements();) {
String key = (String)x.nextElement();
for(int j=0; j<headers.length; j++) if (key.equalsIgnoreCase(headers[j])) continue OUTER;
- payload += key + ": " + m.headers.get(key)+"\r\n";
+ payload += key + ": " + m.headers.gets(key)+"\r\n";
} }
*/
}
"(" + quotify(m.envelope.arrival.toString()) +
" " + quotify(m.subject) +
" " + addressList(m.from) +
- " " + addressList(m.headers.get("sender")) +
+ " " + addressList(m.headers.gets("sender")) +
" " + addressList(m.replyto) +
" " + addressList(m.to) +
" " + addressList(m.cc) +
" " + addressList(m.bcc) +
- " " + quotify((String)m.headers.get("in-reply-to")) +
+ " " + quotify((String)m.headers.gets("in-reply-to")) +
" " + quotify(m.messageid) +
")";
}