first commit

This commit is contained in:
MaddoScientisto 2026-03-14 20:04:39 +01:00
commit 4d332ef662
27586 changed files with 3281783 additions and 0 deletions

View file

@ -0,0 +1,39 @@
package javax.mail;
public class MessageContext {
private Part part;
public MessageContext(Part part) {
this.part = part;
}
public Part getPart() {
return this.part;
}
public Message getMessage() {
try {
return getMessage(this.part);
} catch (MessagingException ex) {
return null;
}
}
private static Message getMessage(Part p) throws MessagingException {
while (p != null) {
if (p instanceof Message)
return (Message)p;
BodyPart bp = (BodyPart)p;
Multipart mp = bp.getParent();
if (mp == null)
return null;
p = mp.getParent();
}
return null;
}
public Session getSession() {
Message msg = getMessage();
return (msg != null) ? msg.getSession() : null;
}
}