1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-26 09:38:52 -05:00

Restored LocalMessage.setRecipients() and added checks for null and empty address list that allow to unset a recipient list

This commit is contained in:
Bao-Long Nguyen-Trong 2009-06-26 06:55:32 +00:00
parent 99562b8e01
commit 6f8c83e8e3

View File

@ -1658,6 +1658,37 @@ public class LocalStore extends Store implements Serializable {
}
}
@Override
public void setRecipients(RecipientType type, Address[] addresses) throws MessagingException {
if (type == RecipientType.TO) {
if (addresses == null || addresses.length == 0) {
removeHeader("To");
this.mTo = null;
} else {
addHeader("To", Address.toString(addresses));
this.mTo = addresses;
}
} else if (type == RecipientType.CC) {
if (addresses == null || addresses.length == 0) {
removeHeader("CC");
this.mCc = null;
} else {
addHeader("CC", Address.toString(addresses));
this.mCc = addresses;
}
} else if (type == RecipientType.BCC) {
if (addresses == null || addresses.length == 0) {
removeHeader("BCC");
this.mBcc = null;
} else {
addHeader("BCC", Address.toString(addresses));
this.mBcc = addresses;
}
} else {
throw new MessagingException("Unrecognized recipient type.");
}
}
public void setFlagInternal(Flag flag, boolean set) throws MessagingException {
super.setFlag(flag, set);
}