* This populates a new message which is a forwarding of the
* current message.
*/
public NewMessageInfo populateForward(boolean withAttachments, int method)
throws MessagingException, OperationCancelledException {
MimeMessage mMsg = (MimeMessage) getMessage();
MimeMessage newMsg = new MimeMessage(Pooka.getDefaultSession());
String parsedText = "";
if (method == FORWARD_QUOTED) {
String textPart = getTextPart(false, false, getMaxMessageDisplayLength(), getTruncationMessage());
UserProfile up = getDefaultProfile();
if (up == null) {
up = Pooka.getPookaManager().getUserProfileManager().getDefaultProfile();
}
String forwardPrefix;
String parsedIntro;
if (up != null && up.getMailProperties() != null) {
forwardPrefix = up.getMailProperties().getProperty("forwardPrefix", Pooka.getProperty("Pooka.forwardPrefix", "> "));
parsedIntro = parseMsgString(mMsg, up.getMailProperties().getProperty("forwardIntro", Pooka.getProperty("Pooka.forwardIntro", "Forwarded message from %n:")), true);
} else {
forwardPrefix = Pooka.getProperty("Pooka.forwardPrefix", "> ");
parsedIntro = parseMsgString(mMsg, Pooka.getProperty("Pooka.forwardIntro", "Forwarded message from %n:"), true);
}
parsedText = prefixMessage(textPart, forwardPrefix, parsedIntro);
} else if (method == FORWARD_AS_INLINE) {
String textPart = getTextPart(true, false, getMaxMessageDisplayLength(), getTruncationMessage());
parsedText = Pooka.getProperty("Pooka.forwardInlineIntro", "---------- Original Message ----------\n") + textPart;
}
newMsg.setText(parsedText);
newMsg.setSubject(parseMsgString(mMsg, Pooka.getProperty("Pooka.forwardSubject", "Fwd: %s"), false));
NewMessageInfo returnValue = new NewMessageInfo(newMsg);
// handle attachments.
if (method == FORWARD_AS_ATTACHMENT) {