mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
updates from scormengine port
This commit is contained in:
parent
5287e7b1f7
commit
24cd7e967d
@ -20,6 +20,9 @@
|
|||||||
|
|
||||||
package CS2JNet.System.Net.Mail;
|
package CS2JNet.System.Net.Mail;
|
||||||
|
|
||||||
|
import javax.mail.internet.AddressException;
|
||||||
|
import javax.mail.internet.InternetAddress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author keving
|
* @author keving
|
||||||
*
|
*
|
||||||
@ -28,27 +31,27 @@ public class MailAddress {
|
|||||||
|
|
||||||
private String address, displayName, host, user;
|
private String address, displayName, host, user;
|
||||||
|
|
||||||
private void parseAddress(String add) {
|
private void parseAddress(String add) throws AddressException {
|
||||||
// TODO: parse address into fields
|
// TODO: parse address into fields
|
||||||
address = add;
|
InternetAddress parsedMailaddress = new InternetAddress(add, false);
|
||||||
|
address = parsedMailaddress.getAddress();
|
||||||
|
displayName = parsedMailaddress.getPersonal();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MailAddress(String inAddress) {
|
public MailAddress(String inAddress) throws AddressException {
|
||||||
parseAddress(inAddress);
|
parseAddress(inAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MailAddress(String inAddress, String inDisplayName) {
|
public MailAddress(String inAddress, String inDisplayName) throws AddressException {
|
||||||
parseAddress(inAddress);
|
parseAddress(inAddress);
|
||||||
if (inDisplayName != null && inDisplayName.length() > 0)
|
if (inDisplayName != null && inDisplayName.length() > 0)
|
||||||
inAddress = inDisplayName;
|
displayName = inDisplayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:
|
public MailAddress(InternetAddress inInternetAddress) throws AddressException {
|
||||||
//public MailAddress(String inAddress, Encoding enc) {
|
address = inInternetAddress.getAddress();
|
||||||
// parseAddress(inAddress);
|
displayName = inInternetAddress.getPersonal();
|
||||||
// if (inDisplayName != null && inDisplayName.length() > 0)
|
}
|
||||||
// inAddress = inDisplayName;
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,5 +109,6 @@ public class MailAddress {
|
|||||||
public String getAddress() {
|
public String getAddress() {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,8 @@ import java.util.Collection;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.mail.internet.AddressException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author keving
|
* @author keving
|
||||||
*
|
*
|
||||||
@ -38,7 +40,7 @@ public class MailAddressCollection implements Collection<MailAddress> {
|
|||||||
return addresses.add(arg0);
|
return addresses.add(arg0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean add(String arg0) {
|
public boolean add(String arg0) throws AddressException {
|
||||||
return addresses.add(new MailAddress(arg0));
|
return addresses.add(new MailAddress(arg0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public class MailMessage
|
|||||||
private MailAddressCollection _to;
|
private MailAddressCollection _to;
|
||||||
private boolean _html;
|
private boolean _html;
|
||||||
private String _body;
|
private String _body;
|
||||||
private InternetAddress _from;
|
private MailAddress _from;
|
||||||
private String _subject;
|
private String _subject;
|
||||||
|
|
||||||
public MailAddressCollection getBcc() throws Exception
|
public MailAddressCollection getBcc() throws Exception
|
||||||
@ -55,12 +55,12 @@ public class MailMessage
|
|||||||
_body = value;
|
_body = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InternetAddress getFrom() throws Exception
|
public MailAddress getFrom() throws Exception
|
||||||
{
|
{
|
||||||
return _from;
|
return _from;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFrom(InternetAddress value) throws Exception
|
public void setFrom(MailAddress value) throws Exception
|
||||||
{
|
{
|
||||||
_from = value;
|
_from = value;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package RusticiSoftware.System.Web;
|
package CS2JNet.System.Web;
|
||||||
|
|
||||||
public class HttpException extends Exception {
|
public class HttpException extends Exception {
|
||||||
private int httpCode = -1;
|
private int httpCode = -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user