public final Address to;
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.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);
+ if (e != null && e.from != null && e.to != null) return e;
+ Address to = (e==null||e.to==null) ? Address.parse(h.gets("X-org.ibex.mail.headers.envelope.To")) : e.to;
+ Address from = (e==null||e.from==null) ? Address.parse(h.gets("X-org.ibex.mail.headers.envelope.From")) : e.from;
+ return new Envelope(from, to, e==null ? new Date() : e.arrival);
}
}
super(stream, null, false);
Vec resent = new Vec(), traces = new Vec();
this.envelope = Envelope.augment(envelope, headers);
- 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.to = headers.gets("To") == null ? this.envelope.to : Address.parse(headers.gets("To"));
+ this.from = headers.gets("From") == null ? this.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"));