Bug #260482 --> custom mail headers (e.g. In-Reply-To) cannot be passed from command line

Patch by: kmccarty@princeton.edu

r=bienvenu
sr=mscott
a=sspitzer
This commit is contained in:
scott%scott-macgregor.org 2005-06-07 19:07:04 +00:00
Родитель a792684f0d
Коммит dc3aaf2ae0
2 изменённых файлов: 27 добавлений и 1 удалений

Просмотреть файл

@ -506,6 +506,7 @@ NS_IMETHODIMP nsMsgComposeService::GetParamsForMailto(nsIURI * aURI, nsIMsgCompo
nsXPIDLCString aSubjectPart;
nsXPIDLCString aBodyPart;
nsXPIDLCString aNewsgroup;
nsXPIDLCString aRefPart;
nsXPIDLCString aHTMLBodyPart;
// we are explictly not allowing attachments to be specified in mailto: urls
@ -516,7 +517,7 @@ NS_IMETHODIMP nsMsgComposeService::GetParamsForMailto(nsIURI * aURI, nsIMsgCompo
nsnull /* follow */, nsnull /* organization */,
nsnull /* reply to part */, getter_Copies(aSubjectPart),
getter_Copies(aBodyPart), getter_Copies(aHTMLBodyPart) /* html part */,
nsnull /* a ref part */, nsnull /* attachment part, must always null, see #99055 */,
getter_Copies(aRefPart), nsnull /* attachment part, must always null, see #99055 */,
nsnull /* priority */, getter_Copies(aNewsgroup), nsnull /* host */,
&requestedComposeFormat);
@ -585,6 +586,7 @@ NS_IMETHODIMP nsMsgComposeService::GetParamsForMailto(nsIURI * aURI, nsIMsgCompo
pMsgCompFields->SetCc(NS_ConvertUTF8toUTF16(aCcPart));
pMsgCompFields->SetBcc(NS_ConvertUTF8toUTF16(aBccPart));
pMsgCompFields->SetNewsgroups(aNewsgroup);
pMsgCompFields->SetReferences(aRefPart);
pMsgCompFields->SetSubject(NS_ConvertUTF8toUTF16(aSubjectPart));
pMsgCompFields->SetBody(composeHTMLFormat ? sanitizedBody : rawBody);
pMsgComposeParams->SetComposeFields(pMsgCompFields);

Просмотреть файл

@ -68,6 +68,7 @@ NS_IMPL_ISUPPORTS2(nsMailtoUrl, nsIMailtoUrl, nsIURI)
nsresult nsMailtoUrl::ParseMailtoUrl(char * searchPart)
{
char *rest = searchPart;
nsCAutoString inReplyToPart;
// okay, first, free up all of our old search part state.....
CleanupMailtoState();
@ -146,6 +147,11 @@ nsresult nsMailtoUrl::ParseMailtoUrl(char * searchPart)
mFormat = nsIMsgCompFormat::HTML;
}
break;
case 'I':
if (!nsCRT::strcasecmp (token, "in-reply-to"))
inReplyToPart = value;
break;
case 'N':
if (!nsCRT::strcasecmp (token, "newsgroups"))
m_newsgroupPart = value;
@ -192,6 +198,24 @@ nsresult nsMailtoUrl::ParseMailtoUrl(char * searchPart)
} // while we still have part of the url to parse...
} // if rest && *rest
// Ensure that References and In-Reply-To are consistent...
if (!inReplyToPart.IsEmpty())
{
if (m_referencePart.IsEmpty())
m_referencePart = inReplyToPart;
else
{
const char * lastRef = strrchr(m_referencePart.get(), '<');
nsCAutoString lastReference;
lastReference = lastRef ? lastRef : m_referencePart.get();
if (lastReference != inReplyToPart)
{
m_referencePart += " ";
m_referencePart += inReplyToPart;
}
}
}
nsCOMPtr<nsIMimeConverter> mimeConverter = do_GetService(NS_MIME_CONVERTER_CONTRACTID);
char *decodedString;