Fix for bug 54853. This is a patch submitted by bzbarsky@mit.edu. Even if the message compose window is initialized from a compose fields, we need to add info like reply-to or bcc from the current identity. R=ducarroz, SR=bienvenu,mscott

This commit is contained in:
ducarroz%netscape.com 2000-11-13 19:54:57 +00:00
parent 7342714270
commit 3c8fe4954c

View File

@ -994,26 +994,36 @@ nsresult nsMsgCompose::CreateMessage(const PRUnichar * originalMsgURI,
{ {
if (m_compFields) if (m_compFields)
rv = m_compFields->Copy(compFields); rv = m_compFields->Copy(compFields);
return rv;
} }
if (m_identity) if (m_identity)
{ {
/* Setup reply-to field */ /* Setup reply-to field */
nsString replyToStr;
nsXPIDLCString replyTo; nsXPIDLCString replyTo;
m_identity->GetReplyTo(getter_Copies(replyTo)); replyToStr.AssignWithConversion(m_compFields->GetReplyTo());
m_compFields->SetReplyTo(replyTo);
m_identity->GetReplyTo(getter_Copies(replyTo));
if ((replyToStr.Length() > 0) && replyTo && *replyTo) {
replyToStr.AppendWithConversion(',');
replyToStr.AppendWithConversion(replyTo);
}
m_compFields->SetReplyTo(replyToStr.GetUnicode());
/* Setup bcc field */ /* Setup bcc field */
PRBool aBool; PRBool aBool;
nsString bccStr; nsString bccStr;
bccStr.AssignWithConversion(m_compFields->GetBcc());
m_identity->GetBccSelf(&aBool); m_identity->GetBccSelf(&aBool);
if (aBool) if (aBool)
{ {
nsXPIDLCString email; nsXPIDLCString email;
m_identity->GetEmail(getter_Copies(email)); m_identity->GetEmail(getter_Copies(email));
bccStr.AssignWithConversion(email); if (bccStr.Length() > 0)
bccStr.AppendWithConversion(',');
bccStr.AppendWithConversion(email);
} }
m_identity->GetBccOthers(&aBool); m_identity->GetBccOthers(&aBool);
@ -1028,6 +1038,9 @@ nsresult nsMsgCompose::CreateMessage(const PRUnichar * originalMsgURI,
m_compFields->SetBcc(bccStr.GetUnicode()); m_compFields->SetBcc(bccStr.GetUnicode());
} }
// If we were passed in fields, we can return now, otherwise, more work to do
if (compFields) return rv;
/* In case of forwarding multiple messages, originalMsgURI will contains several URI separated by a comma. */ /* In case of forwarding multiple messages, originalMsgURI will contains several URI separated by a comma. */
/* we need to extract only the first URI*/ /* we need to extract only the first URI*/
nsAutoString firstURI(originalMsgURI); nsAutoString firstURI(originalMsgURI);