зеркало из https://github.com/mozilla/pjs.git
string cleanup for msg compose, sr=mscott, not part of firefox a5, 379070
This commit is contained in:
Родитель
c8f64e7dab
Коммит
d2ab1c6a5f
|
@ -207,7 +207,7 @@ NS_IMETHODIMP nsMsgAttachment::EqualsUrl(nsIMsgAttachment *attachment, PRBool *_
|
||||||
NS_ENSURE_ARG_POINTER(attachment);
|
NS_ENSURE_ARG_POINTER(attachment);
|
||||||
NS_ENSURE_ARG_POINTER(_retval);
|
NS_ENSURE_ARG_POINTER(_retval);
|
||||||
|
|
||||||
nsXPIDLCString url;
|
nsCString url;
|
||||||
attachment->GetUrl(getter_Copies(url));
|
attachment->GetUrl(getter_Copies(url));
|
||||||
|
|
||||||
*_retval = mUrl.Equals(url);
|
*_retval = mUrl.Equals(url);
|
||||||
|
|
|
@ -49,7 +49,6 @@
|
||||||
#include "nsIMsgStringService.h"
|
#include "nsIMsgStringService.h"
|
||||||
#include "nsMsgComposeStringBundle.h"
|
#include "nsMsgComposeStringBundle.h"
|
||||||
#include "nsMsgCompCID.h"
|
#include "nsMsgCompCID.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsIMsgMessageService.h"
|
#include "nsIMsgMessageService.h"
|
||||||
#include "nsMsgUtils.h"
|
#include "nsMsgUtils.h"
|
||||||
|
@ -397,37 +396,22 @@ nsMsgAttachmentHandler::PickEncoding(const char *charset, nsIMsgSend *mime_deliv
|
||||||
}
|
}
|
||||||
else if (!PL_strcasecmp(m_encoding, ENCODING_UUENCODE))
|
else if (!PL_strcasecmp(m_encoding, ENCODING_UUENCODE))
|
||||||
{
|
{
|
||||||
char *tailName = NULL;
|
nsCString tailName;
|
||||||
nsXPIDLCString turl;
|
nsCString turl;
|
||||||
|
|
||||||
if (mURL)
|
if (mURL)
|
||||||
{
|
{
|
||||||
mURL->GetSpec(turl);
|
mURL->GetSpec(turl);
|
||||||
|
|
||||||
tailName = PL_strrchr(turl, '/');
|
PRInt32 tailNamePos = turl.RFindChar('/');
|
||||||
if (tailName)
|
if (tailNamePos != kNotFound)
|
||||||
{
|
turl.Right(tailName, turl.Length() - tailNamePos -1);
|
||||||
char * tmp = tailName;
|
}
|
||||||
tailName = PL_strdup(tailName+1);
|
|
||||||
PR_FREEIF(tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mURL && !tailName)
|
|
||||||
{
|
|
||||||
tailName = PL_strrchr(turl, '/');
|
|
||||||
if (tailName)
|
|
||||||
{
|
|
||||||
char * tmp = tailName;
|
|
||||||
tailName = PL_strdup(tailName+1);
|
|
||||||
PR_FREEIF(tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_encoder_data = MIME_UUEncoderInit((char *)(tailName ? tailName : ""),
|
m_encoder_data = MIME_UUEncoderInit((char *)tailName.get(),
|
||||||
mime_encoder_output_fn,
|
mime_encoder_output_fn,
|
||||||
mime_delivery_state);
|
mime_delivery_state);
|
||||||
PR_FREEIF(tailName);
|
|
||||||
if (!m_encoder_data) return NS_ERROR_OUT_OF_MEMORY;
|
if (!m_encoder_data) return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
else if (!PL_strcasecmp(m_encoding, ENCODING_QUOTED_PRINTABLE))
|
else if (!PL_strcasecmp(m_encoding, ENCODING_QUOTED_PRINTABLE))
|
||||||
|
@ -659,7 +643,7 @@ nsresult
|
||||||
nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
|
nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
|
||||||
{
|
{
|
||||||
nsresult status = 0;
|
nsresult status = 0;
|
||||||
nsXPIDLCString url_string;
|
nsCString url_string;
|
||||||
|
|
||||||
NS_ASSERTION (! m_done, "Already done");
|
NS_ASSERTION (! m_done, "Already done");
|
||||||
|
|
||||||
|
@ -702,11 +686,11 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
|
||||||
mURL->GetSpec(url_string);
|
mURL->GetSpec(url_string);
|
||||||
|
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
if ( !m_bogus_attachment && nsMsgIsLocalFile(url_string))
|
if ( !m_bogus_attachment && nsMsgIsLocalFile(url_string.get()))
|
||||||
{
|
{
|
||||||
// convert the apple file to AppleDouble first, and then patch the
|
// convert the apple file to AppleDouble first, and then patch the
|
||||||
// address in the url.
|
// address in the url.
|
||||||
char *src_filename = nsMsgGetLocalFileFromURL (url_string);
|
char *src_filename = nsMsgGetLocalFileFromURL (url_string.get());
|
||||||
if (!src_filename)
|
if (!src_filename)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
@ -1089,8 +1073,8 @@ nsMsgAttachmentHandler::UrlExit(nsresult status, const PRUnichar* aMsg)
|
||||||
// if we should continue without this attachment.
|
// if we should continue without this attachment.
|
||||||
//
|
//
|
||||||
PRBool keepOnGoing = PR_TRUE;
|
PRBool keepOnGoing = PR_TRUE;
|
||||||
nsXPIDLCString turl;
|
nsCString turl;
|
||||||
nsXPIDLString msg;
|
nsString msg;
|
||||||
PRUnichar *printfString = nsnull;
|
PRUnichar *printfString = nsnull;
|
||||||
nsCOMPtr<nsIMsgStringService> composebundle (do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID));
|
nsCOMPtr<nsIMsgStringService> composebundle (do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID));
|
||||||
|
|
||||||
|
@ -1102,19 +1086,19 @@ nsMsgAttachmentHandler::UrlExit(nsresult status, const PRUnichar* aMsg)
|
||||||
composebundle->GetStringByID(NS_MSG_FAILURE_ON_OBJ_EMBED_WHILE_SENDING, getter_Copies(msg));
|
composebundle->GetStringByID(NS_MSG_FAILURE_ON_OBJ_EMBED_WHILE_SENDING, getter_Copies(msg));
|
||||||
|
|
||||||
if (m_real_name && *m_real_name)
|
if (m_real_name && *m_real_name)
|
||||||
printfString = nsTextFormatter::smprintf(msg, m_real_name);
|
printfString = nsTextFormatter::smprintf(msg.get(), m_real_name);
|
||||||
else
|
else
|
||||||
if (NS_SUCCEEDED(mURL->GetSpec(turl)) && (turl))
|
if (NS_SUCCEEDED(mURL->GetSpec(turl)) && !turl.IsEmpty())
|
||||||
{
|
{
|
||||||
nsCAutoString unescapeUrl(turl);
|
nsCAutoString unescapeUrl(turl);
|
||||||
nsUnescape(unescapeUrl.BeginWriting());
|
nsUnescape(unescapeUrl.BeginWriting());
|
||||||
if (unescapeUrl.IsEmpty())
|
if (unescapeUrl.IsEmpty())
|
||||||
printfString = nsTextFormatter::smprintf(msg, turl.get());
|
printfString = nsTextFormatter::smprintf(msg.get(), turl.get());
|
||||||
else
|
else
|
||||||
printfString = nsTextFormatter::smprintf(msg, unescapeUrl.get());
|
printfString = nsTextFormatter::smprintf(msg.get(), unescapeUrl.get());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printfString = nsTextFormatter::smprintf(msg, "?");
|
printfString = nsTextFormatter::smprintf(msg.get(), "?");
|
||||||
|
|
||||||
nsCOMPtr<nsIPrompt> aPrompt;
|
nsCOMPtr<nsIPrompt> aPrompt;
|
||||||
if (m_mime_delivery_state)
|
if (m_mime_delivery_state)
|
||||||
|
|
|
@ -73,7 +73,7 @@ nsMsgCompFields::nsMsgCompFields()
|
||||||
m_needToCheckCharset = PR_TRUE;
|
m_needToCheckCharset = PR_TRUE;
|
||||||
|
|
||||||
// Get the default charset from pref, use this as a mail charset.
|
// Get the default charset from pref, use this as a mail charset.
|
||||||
nsXPIDLString charset;
|
nsString charset;
|
||||||
NS_GetLocalizedUnicharPreferenceWithDefault(nsnull, "mailnews.send_default_charset",
|
NS_GetLocalizedUnicharPreferenceWithDefault(nsnull, "mailnews.send_default_charset",
|
||||||
NS_LITERAL_STRING("ISO-8859-1"), charset);
|
NS_LITERAL_STRING("ISO-8859-1"), charset);
|
||||||
|
|
||||||
|
@ -571,42 +571,42 @@ NS_IMETHODIMP nsMsgCompFields::RemoveAttachments()
|
||||||
NS_IMETHODIMP nsMsgCompFields::SplitRecipients(const PRUnichar *recipients, PRBool emailAddressOnly, nsIMsgRecipientArray **_retval)
|
NS_IMETHODIMP nsMsgCompFields::SplitRecipients(const PRUnichar *recipients, PRBool emailAddressOnly, nsIMsgRecipientArray **_retval)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(recipients, "The recipient list is not supposed to be null -Fix the caller!");
|
NS_ASSERTION(recipients, "The recipient list is not supposed to be null -Fix the caller!");
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
if (! _retval)
|
if (! _retval)
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
*_retval = nsnull;
|
*_retval = nsnull;
|
||||||
|
|
||||||
nsMsgRecipientArray* pAddrArray = new nsMsgRecipientArray;
|
nsMsgRecipientArray* pAddrArray = new nsMsgRecipientArray;
|
||||||
if (! pAddrArray)
|
if (! pAddrArray)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
rv = pAddrArray->QueryInterface(NS_GET_IID(nsIMsgRecipientArray), (void **)_retval);
|
rv = pAddrArray->QueryInterface(NS_GET_IID(nsIMsgRecipientArray), (void **)_retval);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIMsgHeaderParser> parser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID);
|
nsCOMPtr<nsIMsgHeaderParser> parser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID);
|
||||||
if (parser)
|
if (parser)
|
||||||
{
|
{
|
||||||
nsCAutoString recipientsStr;
|
nsCAutoString recipientsStr;
|
||||||
char * names;
|
char * names;
|
||||||
char * addresses;
|
char * addresses;
|
||||||
PRUint32 numAddresses;
|
PRUint32 numAddresses;
|
||||||
|
|
||||||
CopyUTF16toUTF8(recipients, recipientsStr);
|
CopyUTF16toUTF8(recipients, recipientsStr);
|
||||||
|
|
||||||
rv= parser->ParseHeaderAddresses("UTF-8", recipientsStr.get(), &names,
|
rv= parser->ParseHeaderAddresses("UTF-8", recipientsStr.get(), &names,
|
||||||
&addresses, &numAddresses);
|
&addresses, &numAddresses);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
PRUint32 i=0;
|
PRUint32 i=0;
|
||||||
char * pNames = names;
|
char * pNames = names;
|
||||||
char * pAddresses = addresses;
|
char * pAddresses = addresses;
|
||||||
PRBool aBool;
|
PRBool aBool;
|
||||||
|
|
||||||
for (i = 0; i < numAddresses; i ++)
|
for (i = 0; i < numAddresses; i ++)
|
||||||
{
|
{
|
||||||
nsXPIDLCString fullAddress;
|
nsCString fullAddress;
|
||||||
nsAutoString recipient;
|
nsAutoString recipient;
|
||||||
if (!emailAddressOnly)
|
if (!emailAddressOnly)
|
||||||
rv = parser->MakeFullAddress("UTF-8", pNames,
|
rv = parser->MakeFullAddress("UTF-8", pNames,
|
||||||
|
@ -619,24 +619,24 @@ NS_IMETHODIMP nsMsgCompFields::SplitRecipients(const PRUnichar *recipients, PRBo
|
||||||
rv = ConvertToUnicode("UTF-8", nsDependentCString(pAddresses), recipient);
|
rv = ConvertToUnicode("UTF-8", nsDependentCString(pAddresses), recipient);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
rv = pAddrArray->AppendString(recipient.get(), &aBool);
|
rv = pAddrArray->AppendString(recipient.get(), &aBool);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
pNames += PL_strlen(pNames) + 1;
|
pNames += PL_strlen(pNames) + 1;
|
||||||
pAddresses += PL_strlen(pAddresses) + 1;
|
pAddresses += PL_strlen(pAddresses) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
PR_FREEIF(names);
|
PR_FREEIF(names);
|
||||||
PR_FREEIF(addresses);
|
PR_FREEIF(addresses);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rv = NS_ERROR_FAILURE;
|
rv = NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -644,9 +644,9 @@ NS_IMETHODIMP nsMsgCompFields::SplitRecipients(const PRUnichar *recipients, PRBo
|
||||||
nsresult nsMsgCompFields::SplitRecipientsEx(const PRUnichar *recipients, nsIMsgRecipientArray ** fullAddrsArray, nsIMsgRecipientArray ** emailsArray)
|
nsresult nsMsgCompFields::SplitRecipientsEx(const PRUnichar *recipients, nsIMsgRecipientArray ** fullAddrsArray, nsIMsgRecipientArray ** emailsArray)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(recipients, "The recipient list is not supposed to be null -Fix the caller!");
|
NS_ASSERTION(recipients, "The recipient list is not supposed to be null -Fix the caller!");
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
nsMsgRecipientArray* pAddrsArray = nsnull;
|
nsMsgRecipientArray* pAddrsArray = nsnull;
|
||||||
if (fullAddrsArray)
|
if (fullAddrsArray)
|
||||||
{
|
{
|
||||||
|
@ -670,49 +670,44 @@ nsresult nsMsgCompFields::SplitRecipientsEx(const PRUnichar *recipients, nsIMsgR
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pAddrsArray || pEmailsArray)
|
if (pAddrsArray || pEmailsArray)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIMsgHeaderParser> parser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID);
|
nsCOMPtr<nsIMsgHeaderParser> parser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID);
|
||||||
if (parser)
|
if (parser)
|
||||||
{
|
{
|
||||||
nsCAutoString recipientsStr;
|
nsCAutoString recipientsStr;
|
||||||
char * names;
|
char * names;
|
||||||
char *addresses;
|
char *addresses;
|
||||||
PRUint32 numAddresses;
|
PRUint32 numAddresses;
|
||||||
|
|
||||||
CopyUTF16toUTF8(recipients, recipientsStr);
|
CopyUTF16toUTF8(recipients, recipientsStr);
|
||||||
rv= parser->ParseHeaderAddresses("UTF-8", recipientsStr.get(), &names,
|
rv= parser->ParseHeaderAddresses("UTF-8", recipientsStr.get(), &names,
|
||||||
&addresses, &numAddresses);
|
&addresses, &numAddresses);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
PRUint32 i=0;
|
PRUint32 i=0;
|
||||||
char * pNames = names;
|
char * pNames = names;
|
||||||
char * pAddresses = addresses;
|
char * pAddresses = addresses;
|
||||||
nsAutoString recipient;
|
nsAutoString recipient;
|
||||||
PRBool aBool;
|
PRBool aBool;
|
||||||
|
|
||||||
for (i = 0; i < numAddresses; i ++)
|
for (i = 0; i < numAddresses; i ++)
|
||||||
{
|
{
|
||||||
nsXPIDLCString fullAddress;
|
nsCString fullAddress;
|
||||||
if (pAddrsArray)
|
if (pAddrsArray)
|
||||||
{
|
{
|
||||||
rv = parser->MakeFullAddress("UTF-8", pNames, pAddresses,
|
rv = parser->MakeFullAddress("UTF-8", pNames, pAddresses,
|
||||||
getter_Copies(fullAddress));
|
getter_Copies(fullAddress));
|
||||||
if (NS_SUCCEEDED(rv))
|
rv = ConvertToUnicode("UTF-8", NS_SUCCEEDED(rv) ? fullAddress.get() : pAddresses, recipient);
|
||||||
{
|
|
||||||
rv = ConvertToUnicode("UTF-8", fullAddress, recipient);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
rv = ConvertToUnicode("UTF-8", pAddresses, recipient);
|
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
rv = pAddrsArray->AppendString(recipient.get(), &aBool);
|
rv = pAddrsArray->AppendString(recipient.get(), &aBool);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pEmailsArray)
|
if (pEmailsArray)
|
||||||
{
|
{
|
||||||
rv = ConvertToUnicode("UTF-8", pAddresses, recipient);
|
rv = ConvertToUnicode("UTF-8", pAddresses, recipient);
|
||||||
|
@ -722,19 +717,19 @@ nsresult nsMsgCompFields::SplitRecipientsEx(const PRUnichar *recipients, nsIMsgR
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
pNames += PL_strlen(pNames) + 1;
|
pNames += PL_strlen(pNames) + 1;
|
||||||
pAddresses += PL_strlen(pAddresses) + 1;
|
pAddresses += PL_strlen(pAddresses) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
PR_FREEIF(names);
|
PR_FREEIF(names);
|
||||||
PR_FREEIF(addresses);
|
PR_FREEIF(addresses);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rv = NS_ERROR_FAILURE;
|
rv = NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
#include "nsINntpService.h"
|
#include "nsINntpService.h"
|
||||||
#include "nsMimeTypes.h"
|
#include "nsMimeTypes.h"
|
||||||
#include "nsMsgComposeStringBundle.h"
|
#include "nsMsgComposeStringBundle.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsDirectoryServiceDefs.h"
|
#include "nsDirectoryServiceDefs.h"
|
||||||
#include "nsIDocumentEncoder.h" // for editor output flags
|
#include "nsIDocumentEncoder.h" // for editor output flags
|
||||||
|
@ -154,12 +153,12 @@ nsMsgCreateTempFileName(const char *tFileName)
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
|
||||||
nsXPIDLCString tempString;
|
nsCString tempString;
|
||||||
rv = tmpFile->GetNativePath(tempString);
|
rv = tmpFile->GetNativePath(tempString);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
|
||||||
char *tString = (char *)PL_strdup(tempString.get());
|
char *tString = ToNewCString(tempString);
|
||||||
if (!tString)
|
if (!tString)
|
||||||
return PL_strdup("mozmail.tmp"); // No need to I18N
|
return PL_strdup("mozmail.tmp"); // No need to I18N
|
||||||
|
|
||||||
|
@ -486,11 +485,11 @@ mime_generate_headers (nsMsgCompFields *fields,
|
||||||
nsCAutoString userAgentString;
|
nsCAutoString userAgentString;
|
||||||
#ifdef MOZ_THUNDERBIRD
|
#ifdef MOZ_THUNDERBIRD
|
||||||
|
|
||||||
nsXPIDLCString userAgentOverride;
|
nsCString userAgentOverride;
|
||||||
prefs->GetCharPref("general.useragent.override", getter_Copies(userAgentOverride));
|
prefs->GetCharPref("general.useragent.override", getter_Copies(userAgentOverride));
|
||||||
|
|
||||||
// allow a user to override the default UA
|
// allow a user to override the default UA
|
||||||
if (!userAgentOverride)
|
if (userAgentOverride.IsEmpty())
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIXULAppInfo> xulAppInfo (do_GetService(XULAPPINFO_SERVICE_CONTRACTID, &rv));
|
nsCOMPtr<nsIXULAppInfo> xulAppInfo (do_GetService(XULAPPINFO_SERVICE_CONTRACTID, &rv));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
|
@ -573,10 +572,11 @@ mime_generate_headers (nsMsgCompFields *fields,
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsXPIDLCString newsgroupsHeaderVal;
|
nsCString newsgroupsHeaderVal;
|
||||||
nsXPIDLCString newshostHeaderVal;
|
nsCString newshostHeaderVal;
|
||||||
rv = nntpService->GenerateNewsHeaderValsForPosting(n2, getter_Copies(newsgroupsHeaderVal), getter_Copies(newshostHeaderVal));
|
rv = nntpService->GenerateNewsHeaderValsForPosting(n2, getter_Copies(newsgroupsHeaderVal), getter_Copies(newshostHeaderVal));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv))
|
||||||
|
{
|
||||||
*status = rv;
|
*status = rv;
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
@ -657,20 +657,26 @@ mime_generate_headers (nsMsgCompFields *fields,
|
||||||
|
|
||||||
// If we are saving the message as a draft, don't bother inserting the undisclosed recipients field. We'll take care of that when we
|
// If we are saving the message as a draft, don't bother inserting the undisclosed recipients field. We'll take care of that when we
|
||||||
// really send the message.
|
// really send the message.
|
||||||
if (!hasDisclosedRecipient && !isDraft) {
|
if (!hasDisclosedRecipient && !isDraft)
|
||||||
|
{
|
||||||
PRBool bAddUndisclosedRecipients = PR_TRUE;
|
PRBool bAddUndisclosedRecipients = PR_TRUE;
|
||||||
prefs->GetBoolPref("mail.compose.add_undisclosed_recipients", &bAddUndisclosedRecipients);
|
prefs->GetBoolPref("mail.compose.add_undisclosed_recipients", &bAddUndisclosedRecipients);
|
||||||
if (bAddUndisclosedRecipients) {
|
if (bAddUndisclosedRecipients)
|
||||||
|
{
|
||||||
const char* pBcc = fields->GetBcc(); //Do not free me!
|
const char* pBcc = fields->GetBcc(); //Do not free me!
|
||||||
if (pBcc && *pBcc) {
|
if (pBcc && *pBcc)
|
||||||
|
{
|
||||||
nsCOMPtr<nsIStringBundleService> stringService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
nsCOMPtr<nsIStringBundleService> stringService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv))
|
||||||
|
{
|
||||||
nsCOMPtr<nsIStringBundle> composeStringBundle;
|
nsCOMPtr<nsIStringBundle> composeStringBundle;
|
||||||
rv = stringService->CreateBundle("chrome://messenger/locale/messengercompose/composeMsgs.properties", getter_AddRefs(composeStringBundle));
|
rv = stringService->CreateBundle("chrome://messenger/locale/messengercompose/composeMsgs.properties", getter_AddRefs(composeStringBundle));
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv))
|
||||||
nsXPIDLString undisclosedRecipients;
|
{
|
||||||
|
nsString undisclosedRecipients;
|
||||||
rv = composeStringBundle->GetStringFromID(NS_MSG_UNDISCLOSED_RECIPIENTS, getter_Copies(undisclosedRecipients));
|
rv = composeStringBundle->GetStringFromID(NS_MSG_UNDISCLOSED_RECIPIENTS, getter_Copies(undisclosedRecipients));
|
||||||
if (NS_SUCCEEDED(rv) && !undisclosedRecipients.IsEmpty()){
|
if (NS_SUCCEEDED(rv) && !undisclosedRecipients.IsEmpty())
|
||||||
|
{
|
||||||
char * cstr = ToNewCString(undisclosedRecipients);
|
char * cstr = ToNewCString(undisclosedRecipients);
|
||||||
if (cstr) {
|
if (cstr) {
|
||||||
PUSH_STRING("To: ");
|
PUSH_STRING("To: ");
|
||||||
|
@ -686,12 +692,12 @@ mime_generate_headers (nsMsgCompFields *fields,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSubject && *pSubject) {
|
if (pSubject && *pSubject)
|
||||||
ENCODE_AND_PUSH("Subject: ", PR_FALSE, pSubject, charset, usemime);
|
ENCODE_AND_PUSH("Subject: ", PR_FALSE, pSubject, charset, usemime);
|
||||||
}
|
|
||||||
|
|
||||||
// Skip no or empty priority.
|
// Skip no or empty priority.
|
||||||
if (pPriority && *pPriority) {
|
if (pPriority && *pPriority)
|
||||||
|
{
|
||||||
nsMsgPriorityValue priorityValue;
|
nsMsgPriorityValue priorityValue;
|
||||||
|
|
||||||
NS_MsgGetPriorityFromString(pPriority, priorityValue);
|
NS_MsgGetPriorityFromString(pPriority, priorityValue);
|
||||||
|
@ -835,7 +841,7 @@ mime_generate_attachment_headers (const char *type,
|
||||||
|
|
||||||
/* Let's encode the real name */
|
/* Let's encode the real name */
|
||||||
char *encodedRealName = nsnull;
|
char *encodedRealName = nsnull;
|
||||||
nsXPIDLCString charset; // actual charset used for MIME encode
|
nsCString charset; // actual charset used for MIME encode
|
||||||
nsAutoString realName;
|
nsAutoString realName;
|
||||||
if (real_name)
|
if (real_name)
|
||||||
{
|
{
|
||||||
|
@ -1669,18 +1675,18 @@ msg_pick_real_name (nsMsgAttachmentHandler *attachment, const PRUnichar *propose
|
||||||
}
|
}
|
||||||
else //Let's extract the name from the URL
|
else //Let's extract the name from the URL
|
||||||
{
|
{
|
||||||
nsXPIDLCString url;
|
nsCString url;
|
||||||
attachment->mURL->GetSpec(url);
|
attachment->mURL->GetSpec(url);
|
||||||
|
|
||||||
s = url;
|
s = url.get();
|
||||||
s2 = PL_strchr (s, ':');
|
s2 = PL_strchr (s, ':');
|
||||||
if (s2) s = s2 + 1;
|
if (s2) s = s2 + 1;
|
||||||
/* If we know the URL doesn't have a sensible file name in it,
|
/* If we know the URL doesn't have a sensible file name in it,
|
||||||
don't bother emitting a content-disposition. */
|
don't bother emitting a content-disposition. */
|
||||||
if (!PL_strncasecmp (url, "news:", 5) ||
|
if (StringBeginsWith (url, NS_LITERAL_CSTRING("news:"), nsCaseInsensitiveCStringComparator()) ||
|
||||||
!PL_strncasecmp (url, "snews:", 6) ||
|
StringBeginsWith (url, NS_LITERAL_CSTRING("snews:"), nsCaseInsensitiveCStringComparator()) ||
|
||||||
!PL_strncasecmp (url, "IMAP:", 5) ||
|
StringBeginsWith (url, NS_LITERAL_CSTRING("IMAP:"), nsCaseInsensitiveCStringComparator()) ||
|
||||||
!PL_strncasecmp (url, "mailbox:", 8))
|
StringBeginsWith (url, NS_LITERAL_CSTRING("mailbox:"), nsCaseInsensitiveCStringComparator()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Take the part of the file name after the last / or \ */
|
/* Take the part of the file name after the last / or \ */
|
||||||
|
@ -1836,16 +1842,16 @@ char *
|
||||||
GenerateFileNameFromURI(nsIURI *aURL)
|
GenerateFileNameFromURI(nsIURI *aURL)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsXPIDLCString file;
|
nsCString file;
|
||||||
nsXPIDLCString spec;
|
nsCString spec;
|
||||||
char *returnString;
|
char *returnString;
|
||||||
char *cp = nsnull;
|
char *cp = nsnull;
|
||||||
char *cp1 = nsnull;
|
char *cp1 = nsnull;
|
||||||
|
|
||||||
rv = aURL->GetPath(file);
|
rv = aURL->GetPath(file);
|
||||||
if ( NS_SUCCEEDED(rv) && file)
|
if ( NS_SUCCEEDED(rv) && !file.IsEmpty())
|
||||||
{
|
{
|
||||||
char *newFile = PL_strdup(file);
|
char *newFile = ToNewCString(file);
|
||||||
if (!newFile)
|
if (!newFile)
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
|
||||||
|
@ -1877,9 +1883,9 @@ GenerateFileNameFromURI(nsIURI *aURL)
|
||||||
|
|
||||||
|
|
||||||
rv = aURL->GetSpec(spec);
|
rv = aURL->GetSpec(spec);
|
||||||
if ( NS_SUCCEEDED(rv) && spec)
|
if ( NS_SUCCEEDED(rv) && !spec.IsEmpty())
|
||||||
{
|
{
|
||||||
char *newSpec = PL_strdup(spec);
|
char *newSpec = ToNewCString(spec);
|
||||||
if (!newSpec)
|
if (!newSpec)
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@
|
||||||
#include "nsIPrefService.h"
|
#include "nsIPrefService.h"
|
||||||
#include "nsIPrefBranch.h"
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsIDocumentEncoder.h" // for editor output flags
|
#include "nsIDocumentEncoder.h" // for editor output flags
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsIMsgHeaderParser.h"
|
#include "nsIMsgHeaderParser.h"
|
||||||
#include "nsMsgCompUtils.h"
|
#include "nsMsgCompUtils.h"
|
||||||
#include "nsIMsgStringService.h"
|
#include "nsIMsgStringService.h"
|
||||||
|
@ -126,11 +125,11 @@
|
||||||
|
|
||||||
static void GetReplyHeaderInfo(PRInt32* reply_header_type,
|
static void GetReplyHeaderInfo(PRInt32* reply_header_type,
|
||||||
nsString& reply_header_locale,
|
nsString& reply_header_locale,
|
||||||
nsXPIDLString& reply_header_authorwrote,
|
nsString& reply_header_authorwrote,
|
||||||
nsXPIDLString& reply_header_ondate,
|
nsString& reply_header_ondate,
|
||||||
nsString& reply_header_separator,
|
nsString& reply_header_separator,
|
||||||
nsString& reply_header_colon,
|
nsString& reply_header_colon,
|
||||||
nsXPIDLString& reply_header_originalmessage)
|
nsString& reply_header_originalmessage)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
|
@ -399,10 +398,10 @@ nsresult nsMsgCompose::ResetUrisForEmbeddedObjects()
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> node;
|
nsCOMPtr<nsIDOMNode> node;
|
||||||
nsXPIDLCString curDraftIdURL;
|
nsCString curDraftIdURL;
|
||||||
|
|
||||||
rv = m_compFields->GetDraftId(getter_Copies(curDraftIdURL));
|
rv = m_compFields->GetDraftId(getter_Copies(curDraftIdURL));
|
||||||
NS_ASSERTION((NS_SUCCEEDED(rv) && (curDraftIdURL)), "RemoveCurrentDraftMessage can't get draft id");
|
NS_ASSERTION((NS_SUCCEEDED(rv) && (!curDraftIdURL.IsEmpty())), "RemoveCurrentDraftMessage can't get draft id");
|
||||||
|
|
||||||
// Skip if no draft id (probably a new draft msg).
|
// Skip if no draft id (probably a new draft msg).
|
||||||
if (NS_SUCCEEDED(rv) && mMsgSend && !curDraftIdURL.IsEmpty())
|
if (NS_SUCCEEDED(rv) && mMsgSend && !curDraftIdURL.IsEmpty())
|
||||||
|
@ -412,7 +411,7 @@ nsresult nsMsgCompose::ResetUrisForEmbeddedObjects()
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
nsCOMPtr <nsIMsgDBHdr> msgDBHdr;
|
nsCOMPtr <nsIMsgDBHdr> msgDBHdr;
|
||||||
rv = GetMsgDBHdrFromURI(curDraftIdURL, getter_AddRefs(msgDBHdr));
|
rv = GetMsgDBHdrFromURI(curDraftIdURL.get(), getter_AddRefs(msgDBHdr));
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv), "RemoveCurrentDraftMessage can't get msg header DB interface pointer.");
|
NS_ASSERTION(NS_SUCCEEDED(rv), "RemoveCurrentDraftMessage can't get msg header DB interface pointer.");
|
||||||
if (NS_SUCCEEDED(rv) && msgDBHdr)
|
if (NS_SUCCEEDED(rv) && msgDBHdr)
|
||||||
{
|
{
|
||||||
|
@ -492,9 +491,9 @@ nsresult nsMsgCompose::TagEmbeddedObjects(nsIEditorMailSupport *aEditor)
|
||||||
nsCOMPtr<nsIDOMNode> node;
|
nsCOMPtr<nsIDOMNode> node;
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> originalUrl;
|
nsCOMPtr<nsIURI> originalUrl;
|
||||||
nsXPIDLCString originalScheme;
|
nsCString originalScheme;
|
||||||
nsXPIDLCString originalHost;
|
nsCString originalHost;
|
||||||
nsXPIDLCString originalPath;
|
nsCString originalPath;
|
||||||
|
|
||||||
// first, convert the rdf original msg uri into a url that represents the message...
|
// first, convert the rdf original msg uri into a url that represents the message...
|
||||||
nsCOMPtr <nsIMsgMessageService> msgService;
|
nsCOMPtr <nsIMsgMessageService> msgService;
|
||||||
|
@ -800,7 +799,7 @@ nsMsgCompose::Initialize(nsIDOMWindowInternal *aWindow, nsIMsgComposeParams *par
|
||||||
MSG_ComposeType type;
|
MSG_ComposeType type;
|
||||||
params->GetType(&type);
|
params->GetType(&type);
|
||||||
|
|
||||||
nsXPIDLCString originalMsgURI;
|
nsCString originalMsgURI;
|
||||||
params->GetOriginalMsgURI(getter_Copies(originalMsgURI));
|
params->GetOriginalMsgURI(getter_Copies(originalMsgURI));
|
||||||
params->GetOrigMsgHdr(getter_AddRefs(mOrigMsgHdr));
|
params->GetOrigMsgHdr(getter_AddRefs(mOrigMsgHdr));
|
||||||
|
|
||||||
|
@ -840,9 +839,9 @@ nsMsgCompose::Initialize(nsIDOMWindowInternal *aWindow, nsIMsgComposeParams *par
|
||||||
if(externalSendListener)
|
if(externalSendListener)
|
||||||
AddMsgSendListener( externalSendListener );
|
AddMsgSendListener( externalSendListener );
|
||||||
|
|
||||||
nsXPIDLCString smtpPassword;
|
nsCString smtpPassword;
|
||||||
params->GetSmtpPassword(getter_Copies(smtpPassword));
|
params->GetSmtpPassword(getter_Copies(smtpPassword));
|
||||||
mSmtpPassword = (const char *)smtpPassword;
|
mSmtpPassword = smtpPassword;
|
||||||
|
|
||||||
if (aWindow)
|
if (aWindow)
|
||||||
{
|
{
|
||||||
|
@ -850,7 +849,7 @@ nsMsgCompose::Initialize(nsIDOMWindowInternal *aWindow, nsIMsgComposeParams *par
|
||||||
rv = composeService->RegisterComposeWindow(aWindow, this);
|
rv = composeService->RegisterComposeWindow(aWindow, this);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
return CreateMessage(originalMsgURI, type, composeFields);
|
return CreateMessage(originalMsgURI.get(), type, composeFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsMsgCompose::SetDocumentCharset(const char *charset)
|
nsresult nsMsgCompose::SetDocumentCharset(const char *charset)
|
||||||
|
@ -1085,8 +1084,8 @@ NS_IMETHODIMP nsMsgCompose::SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity
|
||||||
if (NS_SUCCEEDED(rv) && !msgBody.IsEmpty())
|
if (NS_SUCCEEDED(rv) && !msgBody.IsEmpty())
|
||||||
{
|
{
|
||||||
// Convert body to mail charset
|
// Convert body to mail charset
|
||||||
nsXPIDLCString outCString;
|
nsCString outCString;
|
||||||
nsXPIDLCString fallbackCharset;
|
nsCString fallbackCharset;
|
||||||
PRBool isAsciiOnly;
|
PRBool isAsciiOnly;
|
||||||
// check if the body text is covered by the current charset.
|
// check if the body text is covered by the current charset.
|
||||||
rv = nsMsgI18NSaveAsCharset(contentType, m_compFields->GetCharacterSet(),
|
rv = nsMsgI18NSaveAsCharset(contentType, m_compFields->GetCharacterSet(),
|
||||||
|
@ -1118,7 +1117,7 @@ NS_IMETHODIMP nsMsgCompose::SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// re-label to the fallback charset
|
// re-label to the fallback charset
|
||||||
else if (fallbackCharset)
|
else if (!fallbackCharset.IsEmpty())
|
||||||
m_compFields->SetCharacterSet(fallbackCharset.get());
|
m_compFields->SetCharacterSet(fallbackCharset.get());
|
||||||
m_compFields->SetBodyIsAsciiOnly(isAsciiOnly);
|
m_compFields->SetBodyIsAsciiOnly(isAsciiOnly);
|
||||||
m_compFields->SetBody(outCString.get());
|
m_compFields->SetBody(outCString.get());
|
||||||
|
@ -1587,14 +1586,14 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
||||||
|
|
||||||
if (m_identity)
|
if (m_identity)
|
||||||
{
|
{
|
||||||
nsXPIDLCString::const_iterator start, end;
|
nsCString::const_iterator start, end;
|
||||||
|
|
||||||
/* Setup reply-to field */
|
/* Setup reply-to field */
|
||||||
nsCString replyTo;
|
nsCString replyTo;
|
||||||
m_identity->GetReplyTo(replyTo);
|
m_identity->GetReplyTo(replyTo);
|
||||||
if (!replyTo.IsEmpty())
|
if (!replyTo.IsEmpty())
|
||||||
{
|
{
|
||||||
nsXPIDLCString replyToStr;
|
nsCString replyToStr;
|
||||||
replyToStr.Assign(m_compFields->GetReplyTo());
|
replyToStr.Assign(m_compFields->GetReplyTo());
|
||||||
|
|
||||||
replyToStr.BeginReading(start);
|
replyToStr.BeginReading(start);
|
||||||
|
@ -1613,7 +1612,7 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
||||||
m_identity->GetDoBcc(&doBcc);
|
m_identity->GetDoBcc(&doBcc);
|
||||||
if (doBcc)
|
if (doBcc)
|
||||||
{
|
{
|
||||||
nsXPIDLCString bccStr;
|
nsCString bccStr;
|
||||||
bccStr.Assign(m_compFields->GetBcc());
|
bccStr.Assign(m_compFields->GetBcc());
|
||||||
|
|
||||||
bccStr.BeginReading(start);
|
bccStr.BeginReading(start);
|
||||||
|
@ -1646,9 +1645,9 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv), "RemoveCurrentDraftMessage can't get msg header DB interface pointer.");
|
NS_ASSERTION(NS_SUCCEEDED(rv), "RemoveCurrentDraftMessage can't get msg header DB interface pointer.");
|
||||||
if (msgDBHdr)
|
if (msgDBHdr)
|
||||||
{
|
{
|
||||||
nsXPIDLCString queuedDisposition;
|
nsCString queuedDisposition;
|
||||||
msgDBHdr->GetStringProperty(QUEUED_DISPOSITION_PROPERTY, getter_Copies(queuedDisposition));
|
msgDBHdr->GetStringProperty(QUEUED_DISPOSITION_PROPERTY, getter_Copies(queuedDisposition));
|
||||||
nsXPIDLCString originalMsgURIs;
|
nsCString originalMsgURIs;
|
||||||
msgDBHdr->GetStringProperty(ORIG_URI_PROPERTY, getter_Copies(originalMsgURIs));
|
msgDBHdr->GetStringProperty(ORIG_URI_PROPERTY, getter_Copies(originalMsgURIs));
|
||||||
mOriginalMsgURI = originalMsgURIs;
|
mOriginalMsgURI = originalMsgURIs;
|
||||||
if (!queuedDisposition.IsEmpty())
|
if (!queuedDisposition.IsEmpty())
|
||||||
|
@ -1731,8 +1730,8 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
||||||
}
|
}
|
||||||
if (msgHdr)
|
if (msgHdr)
|
||||||
{
|
{
|
||||||
nsXPIDLString subject;
|
nsString subject;
|
||||||
nsXPIDLCString decodedCString;
|
nsCString decodedCString;
|
||||||
|
|
||||||
if (!charsetOverride && charset.IsEmpty())
|
if (!charsetOverride && charset.IsEmpty())
|
||||||
{
|
{
|
||||||
|
@ -1753,7 +1752,7 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
||||||
prefs->GetBoolPref("mailnews.reply_in_default_charset",
|
prefs->GetBoolPref("mailnews.reply_in_default_charset",
|
||||||
&replyInDefault);
|
&replyInDefault);
|
||||||
if (replyInDefault) {
|
if (replyInDefault) {
|
||||||
nsXPIDLString str;
|
nsString str;
|
||||||
NS_GetLocalizedUnicharPreferenceWithDefault(prefs, "mailnews.send_default_charset",
|
NS_GetLocalizedUnicharPreferenceWithDefault(prefs, "mailnews.send_default_charset",
|
||||||
EmptyString(), str);
|
EmptyString(), str);
|
||||||
if (!str.IsEmpty())
|
if (!str.IsEmpty())
|
||||||
|
@ -1771,9 +1770,9 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
||||||
if (isFirstPass && !charset.IsEmpty())
|
if (isFirstPass && !charset.IsEmpty())
|
||||||
m_compFields->SetCharacterSet(charset.get());
|
m_compFields->SetCharacterSet(charset.get());
|
||||||
|
|
||||||
nsXPIDLCString subjectCStr;
|
nsCString subjectCStr;
|
||||||
(void) msgHdr->GetSubject(getter_Copies(subjectCStr));
|
(void) msgHdr->GetSubject(getter_Copies(subjectCStr));
|
||||||
rv = mimeConverter->DecodeMimeHeader(subjectCStr,
|
rv = mimeConverter->DecodeMimeHeader(subjectCStr.get(),
|
||||||
getter_Copies(decodedCString),
|
getter_Copies(decodedCString),
|
||||||
originCharset.get(), charsetOverride);
|
originCharset.get(), charsetOverride);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
@ -1810,7 +1809,7 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
||||||
db->GetMsgHdrForMessageID(reference.get(), getter_AddRefs(refHdr));
|
db->GetMsgHdrForMessageID(reference.get(), getter_AddRefs(refHdr));
|
||||||
|
|
||||||
if (refHdr) {
|
if (refHdr) {
|
||||||
nsXPIDLCString refSubject;
|
nsCString refSubject;
|
||||||
rv = refHdr->GetSubject(getter_Copies(refSubject));
|
rv = refHdr->GetSubject(getter_Copies(refSubject));
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
nsACString::const_iterator start, end;
|
nsACString::const_iterator start, end;
|
||||||
|
@ -1854,7 +1853,7 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
||||||
subject.Insert(NS_LITERAL_STRING("Re: "), 0);
|
subject.Insert(NS_LITERAL_STRING("Re: "), 0);
|
||||||
m_compFields->SetSubject(subject);
|
m_compFields->SetSubject(subject);
|
||||||
|
|
||||||
nsXPIDLCString author, authorEmailAddress;
|
nsCString author, authorEmailAddress;
|
||||||
msgHdr->GetAuthor(getter_Copies(author));
|
msgHdr->GetAuthor(getter_Copies(author));
|
||||||
nsCOMPtr<nsIMsgHeaderParser> parser (do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID));
|
nsCOMPtr<nsIMsgHeaderParser> parser (do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID));
|
||||||
if (parser) {
|
if (parser) {
|
||||||
|
@ -1872,7 +1871,7 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
nsCOMPtr<nsISupportsArray> identities;
|
nsCOMPtr<nsISupportsArray> identities;
|
||||||
nsXPIDLCString accountKey;
|
nsCString accountKey;
|
||||||
msgHdr->GetAccountKey(getter_Copies(accountKey));
|
msgHdr->GetAccountKey(getter_Copies(accountKey));
|
||||||
if(replyToSelfCheckAll)
|
if(replyToSelfCheckAll)
|
||||||
{
|
{
|
||||||
|
@ -1929,19 +1928,19 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsXPIDLCString toField;
|
nsCString toField;
|
||||||
if (isReplyToOwnMsg)
|
if (isReplyToOwnMsg)
|
||||||
msgHdr->GetRecipients(getter_Copies(toField));
|
msgHdr->GetRecipients(getter_Copies(toField));
|
||||||
else
|
else
|
||||||
toField.Assign(author);
|
toField.Assign(author);
|
||||||
|
|
||||||
rv = mimeConverter->DecodeMimeHeader(toField,
|
rv = mimeConverter->DecodeMimeHeader(toField.get(),
|
||||||
getter_Copies(decodedCString),
|
getter_Copies(decodedCString),
|
||||||
originCharset.get(), charsetOverride);
|
originCharset.get(), charsetOverride);
|
||||||
if (NS_SUCCEEDED(rv) && decodedCString)
|
if (NS_SUCCEEDED(rv) && !decodedCString.IsEmpty())
|
||||||
m_compFields->SetTo(decodedCString);
|
m_compFields->SetTo(decodedCString.get());
|
||||||
else
|
else
|
||||||
m_compFields->SetTo(toField);
|
m_compFields->SetTo(toField.get());
|
||||||
|
|
||||||
// Setup quoting callbacks for later...
|
// Setup quoting callbacks for later...
|
||||||
mWhatHolder = 1;
|
mWhatHolder = 1;
|
||||||
|
@ -2054,12 +2053,12 @@ QuotingOutputStreamListener::QuotingOutputStreamListener(const char * originalMs
|
||||||
|
|
||||||
if (! mHeadersOnly)
|
if (! mHeadersOnly)
|
||||||
{
|
{
|
||||||
nsXPIDLString replyHeaderOriginalmessage;
|
nsString replyHeaderOriginalmessage;
|
||||||
// For the built message body...
|
// For the built message body...
|
||||||
if (originalMsgHdr && !quoteHeaders)
|
if (originalMsgHdr && !quoteHeaders)
|
||||||
{
|
{
|
||||||
// Setup the cite information....
|
// Setup the cite information....
|
||||||
nsXPIDLCString myGetter;
|
nsCString myGetter;
|
||||||
if (NS_SUCCEEDED(originalMsgHdr->GetMessageId(getter_Copies(myGetter))))
|
if (NS_SUCCEEDED(originalMsgHdr->GetMessageId(getter_Copies(myGetter))))
|
||||||
{
|
{
|
||||||
if (!myGetter.IsEmpty())
|
if (!myGetter.IsEmpty())
|
||||||
|
@ -2080,8 +2079,8 @@ QuotingOutputStreamListener::QuotingOutputStreamListener(const char * originalMs
|
||||||
PRBool header, headerDate;
|
PRBool header, headerDate;
|
||||||
PRInt32 replyHeaderType;
|
PRInt32 replyHeaderType;
|
||||||
nsAutoString replyHeaderLocale;
|
nsAutoString replyHeaderLocale;
|
||||||
nsXPIDLString replyHeaderAuthorwrote;
|
nsString replyHeaderAuthorwrote;
|
||||||
nsXPIDLString replyHeaderOndate;
|
nsString replyHeaderOndate;
|
||||||
nsAutoString replyHeaderSeparator;
|
nsAutoString replyHeaderSeparator;
|
||||||
nsAutoString replyHeaderColon;
|
nsAutoString replyHeaderColon;
|
||||||
|
|
||||||
|
@ -2165,12 +2164,12 @@ QuotingOutputStreamListener::QuotingOutputStreamListener(const char * originalMs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsXPIDLCString author;
|
nsCString author;
|
||||||
rv = originalMsgHdr->GetAuthor(getter_Copies(author));
|
rv = originalMsgHdr->GetAuthor(getter_Copies(author));
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsXPIDLCString decodedString;
|
nsCString decodedString;
|
||||||
mMimeConverter = do_GetService(NS_MIME_CONVERTER_CONTRACTID);
|
mMimeConverter = do_GetService(NS_MIME_CONVERTER_CONTRACTID);
|
||||||
// Decode header, the result string is null if the input is non MIME encoded ASCII.
|
// Decode header, the result string is null if the input is non MIME encoded ASCII.
|
||||||
if (mMimeConverter)
|
if (mMimeConverter)
|
||||||
|
@ -2180,12 +2179,12 @@ QuotingOutputStreamListener::QuotingOutputStreamListener(const char * originalMs
|
||||||
|
|
||||||
if (parser)
|
if (parser)
|
||||||
{
|
{
|
||||||
nsXPIDLCString authorName;
|
nsCString authorName;
|
||||||
rv = parser->ExtractHeaderAddressName("UTF-8", decodedString ? decodedString.get() : author.get(),
|
rv = parser->ExtractHeaderAddressName("UTF-8", !decodedString.IsEmpty() ? decodedString.get() : author.get(),
|
||||||
getter_Copies(authorName));
|
getter_Copies(authorName));
|
||||||
// take care "%s wrote"
|
// take care "%s wrote"
|
||||||
PRUnichar *formatedString = nsnull;
|
PRUnichar *formatedString = nsnull;
|
||||||
if (NS_SUCCEEDED(rv) && authorName)
|
if (NS_SUCCEEDED(rv) && !authorName.IsEmpty())
|
||||||
formatedString = nsTextFormatter::smprintf(replyHeaderAuthorwrote.get(), authorName.get());
|
formatedString = nsTextFormatter::smprintf(replyHeaderAuthorwrote.get(), authorName.get());
|
||||||
else
|
else
|
||||||
formatedString = nsTextFormatter::smprintf(replyHeaderAuthorwrote.get(), author.get());
|
formatedString = nsTextFormatter::smprintf(replyHeaderAuthorwrote.get(), author.get());
|
||||||
|
@ -2223,8 +2222,8 @@ QuotingOutputStreamListener::QuotingOutputStreamListener(const char * originalMs
|
||||||
// This is not likely to happen but load the string if it's not done already.
|
// This is not likely to happen but load the string if it's not done already.
|
||||||
PRInt32 replyHeaderType;
|
PRInt32 replyHeaderType;
|
||||||
nsAutoString replyHeaderLocale;
|
nsAutoString replyHeaderLocale;
|
||||||
nsXPIDLString replyHeaderAuthorwrote;
|
nsString replyHeaderAuthorwrote;
|
||||||
nsXPIDLString replyHeaderOndate;
|
nsString replyHeaderOndate;
|
||||||
nsAutoString replyHeaderSeparator;
|
nsAutoString replyHeaderSeparator;
|
||||||
nsAutoString replyHeaderColon;
|
nsAutoString replyHeaderColon;
|
||||||
GetReplyHeaderInfo(&replyHeaderType,
|
GetReplyHeaderInfo(&replyHeaderType,
|
||||||
|
@ -2300,44 +2299,38 @@ NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, ns
|
||||||
nsAutoString messageId;
|
nsAutoString messageId;
|
||||||
nsAutoString references;
|
nsAutoString references;
|
||||||
nsAutoString listPost;
|
nsAutoString listPost;
|
||||||
nsXPIDLCString outCString;
|
nsCString outCString;
|
||||||
PRBool needToRemoveDup = PR_FALSE;
|
PRBool needToRemoveDup = PR_FALSE;
|
||||||
if (!mMimeConverter)
|
if (!mMimeConverter)
|
||||||
{
|
{
|
||||||
mMimeConverter = do_GetService(NS_MIME_CONVERTER_CONTRACTID, &rv);
|
mMimeConverter = do_GetService(NS_MIME_CONVERTER_CONTRACTID, &rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
nsXPIDLCString charset;
|
nsCString charset;
|
||||||
compFields->GetCharacterSet(getter_Copies(charset));
|
compFields->GetCharacterSet(getter_Copies(charset));
|
||||||
|
|
||||||
if (type == nsIMsgCompType::ReplyAll)
|
if (type == nsIMsgCompType::ReplyAll)
|
||||||
{
|
{
|
||||||
mHeaders->ExtractHeader(HEADER_TO, PR_TRUE, getter_Copies(outCString));
|
mHeaders->ExtractHeader(HEADER_TO, PR_TRUE, getter_Copies(outCString));
|
||||||
if (outCString)
|
if (!outCString.IsEmpty())
|
||||||
{
|
mMimeConverter->DecodeMimeHeader(outCString.get(), recipient, charset.get());
|
||||||
mMimeConverter->DecodeMimeHeader(outCString, recipient, charset);
|
|
||||||
}
|
|
||||||
|
|
||||||
mHeaders->ExtractHeader(HEADER_CC, PR_TRUE, getter_Copies(outCString));
|
mHeaders->ExtractHeader(HEADER_CC, PR_TRUE, getter_Copies(outCString));
|
||||||
if (outCString)
|
if (!outCString.IsEmpty())
|
||||||
{
|
mMimeConverter->DecodeMimeHeader(outCString.get(), cc, charset.get());
|
||||||
mMimeConverter->DecodeMimeHeader(outCString, cc, charset);
|
|
||||||
}
|
|
||||||
|
|
||||||
// preserve BCC for the reply-to-self case
|
// preserve BCC for the reply-to-self case
|
||||||
mHeaders->ExtractHeader(HEADER_BCC, PR_TRUE, getter_Copies(outCString));
|
mHeaders->ExtractHeader(HEADER_BCC, PR_TRUE, getter_Copies(outCString));
|
||||||
if (outCString)
|
if (!outCString.IsEmpty())
|
||||||
{
|
{
|
||||||
mMimeConverter->DecodeMimeHeader(outCString, bcc, charset);
|
mMimeConverter->DecodeMimeHeader(outCString.get(), bcc, charset.get());
|
||||||
if (bcc.Length() > 0)
|
if (bcc.Length() > 0)
|
||||||
compFields->SetBcc(bcc);
|
compFields->SetBcc(bcc);
|
||||||
}
|
}
|
||||||
|
|
||||||
mHeaders->ExtractHeader(HEADER_MAIL_FOLLOWUP_TO, PR_TRUE, getter_Copies(outCString));
|
mHeaders->ExtractHeader(HEADER_MAIL_FOLLOWUP_TO, PR_TRUE, getter_Copies(outCString));
|
||||||
if (outCString)
|
if (!outCString.IsEmpty())
|
||||||
{
|
mMimeConverter->DecodeMimeHeader(outCString.get(), mailFollowupTo, charset.get());
|
||||||
mMimeConverter->DecodeMimeHeader(outCString, mailFollowupTo, charset);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! mailFollowupTo.IsEmpty())
|
if (! mailFollowupTo.IsEmpty())
|
||||||
{ // handle Mail-Followup-To (http://cr.yp.to/proto/replyto.html)
|
{ // handle Mail-Followup-To (http://cr.yp.to/proto/replyto.html)
|
||||||
|
@ -2356,7 +2349,7 @@ NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, ns
|
||||||
|
|
||||||
mHeaders->ExtractHeader(HEADER_LIST_POST, PR_TRUE, getter_Copies(outCString));
|
mHeaders->ExtractHeader(HEADER_LIST_POST, PR_TRUE, getter_Copies(outCString));
|
||||||
if (!outCString.IsEmpty())
|
if (!outCString.IsEmpty())
|
||||||
mMimeConverter->DecodeMimeHeader(outCString, listPost, charset);
|
mMimeConverter->DecodeMimeHeader(outCString.get(), listPost, charset.get());
|
||||||
|
|
||||||
if (type == nsIMsgCompType::ReplyToList && ! listPost.IsEmpty())
|
if (type == nsIMsgCompType::ReplyToList && ! listPost.IsEmpty())
|
||||||
{
|
{
|
||||||
|
@ -2378,40 +2371,28 @@ NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, ns
|
||||||
}
|
}
|
||||||
|
|
||||||
mHeaders->ExtractHeader(HEADER_REPLY_TO, PR_FALSE, getter_Copies(outCString));
|
mHeaders->ExtractHeader(HEADER_REPLY_TO, PR_FALSE, getter_Copies(outCString));
|
||||||
if (outCString)
|
if (!outCString.IsEmpty())
|
||||||
{
|
mMimeConverter->DecodeMimeHeader(outCString.get(), replyTo, charset.get());
|
||||||
mMimeConverter->DecodeMimeHeader(outCString, replyTo, charset);
|
|
||||||
}
|
|
||||||
|
|
||||||
mHeaders->ExtractHeader(HEADER_MAIL_REPLY_TO, PR_TRUE, getter_Copies(outCString));
|
mHeaders->ExtractHeader(HEADER_MAIL_REPLY_TO, PR_TRUE, getter_Copies(outCString));
|
||||||
if (outCString)
|
if (!outCString.IsEmpty())
|
||||||
{
|
mMimeConverter->DecodeMimeHeader(outCString.get(), mailReplyTo, charset.get());
|
||||||
mMimeConverter->DecodeMimeHeader(outCString, mailReplyTo, charset);
|
|
||||||
}
|
|
||||||
|
|
||||||
mHeaders->ExtractHeader(HEADER_NEWSGROUPS, PR_FALSE, getter_Copies(outCString));
|
mHeaders->ExtractHeader(HEADER_NEWSGROUPS, PR_FALSE, getter_Copies(outCString));
|
||||||
if (outCString)
|
if (!outCString.IsEmpty())
|
||||||
{
|
mMimeConverter->DecodeMimeHeader(outCString.get(), newgroups, charset.get());
|
||||||
mMimeConverter->DecodeMimeHeader(outCString, newgroups, charset);
|
|
||||||
}
|
|
||||||
|
|
||||||
mHeaders->ExtractHeader(HEADER_FOLLOWUP_TO, PR_FALSE, getter_Copies(outCString));
|
mHeaders->ExtractHeader(HEADER_FOLLOWUP_TO, PR_FALSE, getter_Copies(outCString));
|
||||||
if (outCString)
|
if (!outCString.IsEmpty())
|
||||||
{
|
mMimeConverter->DecodeMimeHeader(outCString.get(), followUpTo, charset.get());
|
||||||
mMimeConverter->DecodeMimeHeader(outCString, followUpTo, charset);
|
|
||||||
}
|
|
||||||
|
|
||||||
mHeaders->ExtractHeader(HEADER_MESSAGE_ID, PR_FALSE, getter_Copies(outCString));
|
mHeaders->ExtractHeader(HEADER_MESSAGE_ID, PR_FALSE, getter_Copies(outCString));
|
||||||
if (outCString)
|
if (!outCString.IsEmpty())
|
||||||
{
|
mMimeConverter->DecodeMimeHeader(outCString.get(), messageId, charset.get());
|
||||||
mMimeConverter->DecodeMimeHeader(outCString, messageId, charset);
|
|
||||||
}
|
|
||||||
|
|
||||||
mHeaders->ExtractHeader(HEADER_REFERENCES, PR_FALSE, getter_Copies(outCString));
|
mHeaders->ExtractHeader(HEADER_REFERENCES, PR_FALSE, getter_Copies(outCString));
|
||||||
if (outCString)
|
if (!outCString.IsEmpty())
|
||||||
{
|
mMimeConverter->DecodeMimeHeader(outCString.get(), references, charset.get());
|
||||||
mMimeConverter->DecodeMimeHeader(outCString, references, charset);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! ((type == nsIMsgCompType::ReplyAll) && ! mailFollowupTo.IsEmpty()) &&
|
if (! ((type == nsIMsgCompType::ReplyAll) && ! mailFollowupTo.IsEmpty()) &&
|
||||||
! ((type == nsIMsgCompType::ReplyToList) && ! listPost.IsEmpty()))
|
! ((type == nsIMsgCompType::ReplyToList) && ! listPost.IsEmpty()))
|
||||||
|
@ -2455,10 +2436,10 @@ NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, ns
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mHeaders->ExtractHeader(HEADER_FROM, PR_FALSE, getter_Copies(outCString));
|
mHeaders->ExtractHeader(HEADER_FROM, PR_FALSE, getter_Copies(outCString));
|
||||||
if (outCString)
|
if (!outCString.IsEmpty())
|
||||||
{
|
{
|
||||||
nsAutoString from;
|
nsAutoString from;
|
||||||
mMimeConverter->DecodeMimeHeader(outCString, from, charset);
|
mMimeConverter->DecodeMimeHeader(outCString.get(), from, charset.get());
|
||||||
compFields->SetTo(from);
|
compFields->SetTo(from);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3328,7 +3309,7 @@ nsMsgComposeSendListener::GetMsgFolder(nsIMsgCompose *compObj, nsIMsgFolder **ms
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIMsgFolder> aMsgFolder;
|
nsCOMPtr<nsIMsgFolder> aMsgFolder;
|
||||||
nsXPIDLCString folderUri;
|
nsCString folderUri;
|
||||||
|
|
||||||
rv = compObj->GetSavedFolderURI(getter_Copies(folderUri));
|
rv = compObj->GetSavedFolderURI(getter_Copies(folderUri));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -3342,8 +3323,7 @@ nsMsgComposeSendListener::GetMsgFolder(nsIMsgCompose *compObj, nsIMsgFolder **ms
|
||||||
|
|
||||||
aMsgFolder = do_QueryInterface(resource, &rv);
|
aMsgFolder = do_QueryInterface(resource, &rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
*msgFolder = aMsgFolder;
|
NS_IF_ADDREF(*msgFolder = aMsgFolder);
|
||||||
NS_IF_ADDREF(*msgFolder);
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3514,10 +3494,10 @@ NS_IMETHODIMP nsMsgComposeSendListener::OnStateChange(nsIWebProgress *aWebProgre
|
||||||
progress->GetProcessCanceledByUser(&bCanceled);
|
progress->GetProcessCanceledByUser(&bCanceled);
|
||||||
if (bCanceled)
|
if (bCanceled)
|
||||||
{
|
{
|
||||||
nsXPIDLString msg;
|
nsString msg;
|
||||||
nsCOMPtr<nsIMsgStringService> strBundle = do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID);
|
nsCOMPtr<nsIMsgStringService> strBundle = do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID);
|
||||||
strBundle->GetStringByID(NS_MSG_CANCELLING, getter_Copies(msg));
|
strBundle->GetStringByID(NS_MSG_CANCELLING, getter_Copies(msg));
|
||||||
progress->OnStatusChange(nsnull, nsnull, 0, msg);
|
progress->OnStatusChange(nsnull, nsnull, 0, msg.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4119,20 +4099,20 @@ nsresult nsMsgCompose::GetABDirectories(const nsACString& dirUri, nsISupportsArr
|
||||||
|
|
||||||
nsCOMPtr<nsIRDFResource> source(do_QueryInterface(directory));
|
nsCOMPtr<nsIRDFResource> source(do_QueryInterface(directory));
|
||||||
|
|
||||||
nsXPIDLCString uri;
|
nsCString uri;
|
||||||
// rv = directory->GetDirUri(getter_Copies(uri));
|
// rv = directory->GetDirUri(getter_Copies(uri));
|
||||||
rv = source->GetValue(getter_Copies(uri));
|
rv = source->GetValue(getter_Copies(uri));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
PRInt32 pos;
|
PRInt32 pos;
|
||||||
if (nsCRT::strcmp((const char *)uri, kPersonalAddressbookUri) == 0)
|
if (uri.EqualsLiteral(kPersonalAddressbookUri))
|
||||||
pos = 0;
|
pos = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PRUint32 count = 0;
|
PRUint32 count = 0;
|
||||||
directoriesArray->Count(&count);
|
directoriesArray->Count(&count);
|
||||||
|
|
||||||
if (PL_strcmp((const char *)uri, kCollectedAddressbookUri) == 0)
|
if (uri.EqualsLiteral(kCollectedAddressbookUri))
|
||||||
{
|
{
|
||||||
collectedAddressbookFound = PR_TRUE;
|
collectedAddressbookFound = PR_TRUE;
|
||||||
pos = count;
|
pos = count;
|
||||||
|
@ -4177,14 +4157,14 @@ nsresult nsMsgCompose::BuildMailListArray(nsIAddrDatabase* database, nsIAbDirect
|
||||||
|
|
||||||
if (NS_SUCCEEDED(directory->GetIsMailList(&bIsMailList)) && bIsMailList)
|
if (NS_SUCCEEDED(directory->GetIsMailList(&bIsMailList)) && bIsMailList)
|
||||||
{
|
{
|
||||||
nsXPIDLString listName;
|
nsString listName;
|
||||||
nsXPIDLString listDescription;
|
nsString listDescription;
|
||||||
|
|
||||||
directory->GetDirName(getter_Copies(listName));
|
directory->GetDirName(getter_Copies(listName));
|
||||||
directory->GetDescription(getter_Copies(listDescription));
|
directory->GetDescription(getter_Copies(listDescription));
|
||||||
|
|
||||||
nsMsgMailList* mailList = new nsMsgMailList(nsAutoString((const PRUnichar*)listName),
|
nsMsgMailList* mailList = new nsMsgMailList(listName,
|
||||||
nsAutoString((const PRUnichar*)listDescription), directory);
|
listDescription, directory);
|
||||||
if (!mailList)
|
if (!mailList)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
NS_ADDREF(mailList);
|
NS_ADDREF(mailList);
|
||||||
|
@ -4272,8 +4252,8 @@ NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients(PRBool populateMailList,
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
PRInt32 nbrRecipients;
|
PRInt32 nbrRecipients;
|
||||||
nsXPIDLString emailAddr;
|
nsString emailAddr;
|
||||||
nsXPIDLString addr;
|
nsString addr;
|
||||||
addressArray->GetCount(&nbrRecipients);
|
addressArray->GetCount(&nbrRecipients);
|
||||||
|
|
||||||
for (j = 0; j < nbrRecipients; j ++)
|
for (j = 0; j < nbrRecipients; j ++)
|
||||||
|
@ -4286,7 +4266,7 @@ NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients(PRBool populateMailList,
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
nsMsgRecipient* recipient = new nsMsgRecipient(nsAutoString(addr), nsAutoString(emailAddr));
|
nsMsgRecipient* recipient = new nsMsgRecipient(addr, emailAddr);
|
||||||
if (!recipient)
|
if (!recipient)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
NS_ADDREF(recipient);
|
NS_ADDREF(recipient);
|
||||||
|
@ -4340,7 +4320,7 @@ NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients(PRBool populateMailList,
|
||||||
|
|
||||||
nsCOMPtr<nsIRDFResource> source(do_QueryInterface(abDirectory));
|
nsCOMPtr<nsIRDFResource> source(do_QueryInterface(abDirectory));
|
||||||
|
|
||||||
nsXPIDLCString uri;
|
nsCString uri;
|
||||||
rv = source->GetValue(getter_Copies(uri));
|
rv = source->GetValue(getter_Copies(uri));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
@ -4405,7 +4385,7 @@ NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients(PRBool populateMailList,
|
||||||
|
|
||||||
if (parser)
|
if (parser)
|
||||||
{
|
{
|
||||||
nsXPIDLCString fullAddress;
|
nsCString fullAddress;
|
||||||
|
|
||||||
parser->MakeFullAddress(nsnull, NS_ConvertUTF16toUTF8(pDisplayName).get(),
|
parser->MakeFullAddress(nsnull, NS_ConvertUTF16toUTF8(pDisplayName).get(),
|
||||||
NS_ConvertUTF16toUTF8(pEmail).get(), getter_Copies(fullAddress));
|
NS_ConvertUTF16toUTF8(pEmail).get(), getter_Copies(fullAddress));
|
||||||
|
@ -4502,8 +4482,8 @@ NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients(PRBool populateMailList,
|
||||||
*/
|
*/
|
||||||
nsAutoString recipientsStr;
|
nsAutoString recipientsStr;
|
||||||
nsAutoString nonHtmlRecipientsStr;
|
nsAutoString nonHtmlRecipientsStr;
|
||||||
nsXPIDLString plaintextDomains;
|
nsString plaintextDomains;
|
||||||
nsXPIDLString htmlDomains;
|
nsString htmlDomains;
|
||||||
nsAutoString domain;
|
nsAutoString domain;
|
||||||
|
|
||||||
nsCOMPtr<nsIPrefBranch> prefBranch (do_GetService(NS_PREFSERVICE_CONTRACTID));
|
nsCOMPtr<nsIPrefBranch> prefBranch (do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||||
|
@ -5165,15 +5145,15 @@ nsMsgMailList::nsMsgMailList(nsString listName, nsString listDescription, nsIAbD
|
||||||
|
|
||||||
if (parser)
|
if (parser)
|
||||||
{
|
{
|
||||||
nsXPIDLCString utf8Email;
|
nsCString utf8Email;
|
||||||
if (listDescription.IsEmpty())
|
if (listDescription.IsEmpty())
|
||||||
CopyUTF16toUTF8(listName, utf8Email);
|
CopyUTF16toUTF8(listName, utf8Email);
|
||||||
else
|
else
|
||||||
CopyUTF16toUTF8(listDescription, utf8Email);
|
CopyUTF16toUTF8(listDescription, utf8Email);
|
||||||
|
|
||||||
nsXPIDLCString fullAddress;
|
nsCString fullAddress;
|
||||||
parser->MakeFullAddress(nsnull, NS_ConvertUTF16toUTF8(listName).get(),
|
parser->MakeFullAddress(nsnull, NS_ConvertUTF16toUTF8(listName).get(),
|
||||||
utf8Email, getter_Copies(fullAddress));
|
utf8Email.get(), getter_Copies(fullAddress));
|
||||||
if (!fullAddress.IsEmpty())
|
if (!fullAddress.IsEmpty())
|
||||||
{
|
{
|
||||||
/* We need to convert back the result from UTF-8 to Unicode */
|
/* We need to convert back the result from UTF-8 to Unicode */
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
#include "nsISupportsArray.h"
|
#include "nsISupportsArray.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsIMsgIdentity.h"
|
#include "nsIMsgIdentity.h"
|
||||||
#include "nsISmtpUrl.h"
|
#include "nsISmtpUrl.h"
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
|
@ -528,14 +527,14 @@ NS_IMETHODIMP nsMsgComposeService::GetParamsForMailto(nsIURI * aURI, nsIMsgCompo
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
MSG_ComposeFormat requestedComposeFormat = nsIMsgCompFormat::Default;
|
MSG_ComposeFormat requestedComposeFormat = nsIMsgCompFormat::Default;
|
||||||
nsXPIDLCString aToPart;
|
nsCString aToPart;
|
||||||
nsXPIDLCString aCcPart;
|
nsCString aCcPart;
|
||||||
nsXPIDLCString aBccPart;
|
nsCString aBccPart;
|
||||||
nsXPIDLCString aSubjectPart;
|
nsCString aSubjectPart;
|
||||||
nsXPIDLCString aBodyPart;
|
nsCString aBodyPart;
|
||||||
nsXPIDLCString aNewsgroup;
|
nsCString aNewsgroup;
|
||||||
nsXPIDLCString aRefPart;
|
nsCString aRefPart;
|
||||||
nsXPIDLCString aHTMLBodyPart;
|
nsCString aHTMLBodyPart;
|
||||||
|
|
||||||
// we are explictly not allowing attachments to be specified in mailto: urls
|
// we are explictly not allowing attachments to be specified in mailto: urls
|
||||||
// as it's a potential security problem.
|
// as it's a potential security problem.
|
||||||
|
@ -570,7 +569,7 @@ NS_IMETHODIMP nsMsgComposeService::GetParamsForMailto(nsIURI * aURI, nsIMsgCompo
|
||||||
// Create the appropriate output sink
|
// Create the appropriate output sink
|
||||||
nsCOMPtr<nsIContentSink> sink = do_CreateInstance(MOZ_SANITIZINGHTMLSERIALIZER_CONTRACTID);
|
nsCOMPtr<nsIContentSink> sink = do_CreateInstance(MOZ_SANITIZINGHTMLSERIALIZER_CONTRACTID);
|
||||||
|
|
||||||
nsXPIDLCString allowedTags;
|
nsCString allowedTags;
|
||||||
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||||
if (prefs)
|
if (prefs)
|
||||||
prefs->GetCharPref(MAILNEWS_ROOT_PREF "display.html_sanitizer.allowed_tags", getter_Copies(allowedTags));
|
prefs->GetCharPref(MAILNEWS_ROOT_PREF "display.html_sanitizer.allowed_tags", getter_Copies(allowedTags));
|
||||||
|
@ -610,7 +609,7 @@ NS_IMETHODIMP nsMsgComposeService::GetParamsForMailto(nsIURI * aURI, nsIMsgCompo
|
||||||
pMsgCompFields->SetCc(NS_ConvertUTF8toUTF16(aCcPart));
|
pMsgCompFields->SetCc(NS_ConvertUTF8toUTF16(aCcPart));
|
||||||
pMsgCompFields->SetBcc(NS_ConvertUTF8toUTF16(aBccPart));
|
pMsgCompFields->SetBcc(NS_ConvertUTF8toUTF16(aBccPart));
|
||||||
pMsgCompFields->SetNewsgroups(NS_ConvertUTF8toUTF16(aNewsgroup));
|
pMsgCompFields->SetNewsgroups(NS_ConvertUTF8toUTF16(aNewsgroup));
|
||||||
pMsgCompFields->SetReferences(aRefPart);
|
pMsgCompFields->SetReferences(aRefPart.get());
|
||||||
pMsgCompFields->SetSubject(NS_ConvertUTF8toUTF16(aSubjectPart));
|
pMsgCompFields->SetSubject(NS_ConvertUTF8toUTF16(aSubjectPart));
|
||||||
pMsgCompFields->SetBody(composeHTMLFormat ? sanitizedBody : rawBody);
|
pMsgCompFields->SetBody(composeHTMLFormat ? sanitizedBody : rawBody);
|
||||||
pMsgComposeParams->SetComposeFields(pMsgCompFields);
|
pMsgComposeParams->SetComposeFields(pMsgCompFields);
|
||||||
|
@ -921,14 +920,14 @@ NS_IMETHODIMP nsMsgTemplateReplyHelper::OnStopRunningUrl(nsIURI *aUrl, nsresult
|
||||||
if (NS_FAILED(rv) || (!pMsgComposeParams) ) return rv ;
|
if (NS_FAILED(rv) || (!pMsgComposeParams) ) return rv ;
|
||||||
nsCOMPtr<nsIMsgCompFields> compFields = do_CreateInstance(NS_MSGCOMPFIELDS_CONTRACTID, &rv) ;
|
nsCOMPtr<nsIMsgCompFields> compFields = do_CreateInstance(NS_MSGCOMPFIELDS_CONTRACTID, &rv) ;
|
||||||
|
|
||||||
nsXPIDLCString replyTo;
|
nsCString replyTo;
|
||||||
mHdrToReplyTo->GetStringProperty("replyTo", getter_Copies(replyTo));
|
mHdrToReplyTo->GetStringProperty("replyTo", getter_Copies(replyTo));
|
||||||
if (replyTo.IsEmpty())
|
if (replyTo.IsEmpty())
|
||||||
mHdrToReplyTo->GetAuthor(getter_Copies(replyTo));
|
mHdrToReplyTo->GetAuthor(getter_Copies(replyTo));
|
||||||
compFields->SetTo(NS_ConvertUTF8toUTF16(replyTo));
|
compFields->SetTo(NS_ConvertUTF8toUTF16(replyTo));
|
||||||
|
|
||||||
nsAutoString body;
|
nsString body;
|
||||||
nsXPIDLString templateSubject, replySubject;
|
nsString templateSubject, replySubject;
|
||||||
|
|
||||||
mTemplateHdr->GetMime2DecodedSubject(getter_Copies(templateSubject));
|
mTemplateHdr->GetMime2DecodedSubject(getter_Copies(templateSubject));
|
||||||
mHdrToReplyTo->GetMime2DecodedSubject(getter_Copies(replySubject));
|
mHdrToReplyTo->GetMime2DecodedSubject(getter_Copies(replySubject));
|
||||||
|
@ -939,7 +938,7 @@ NS_IMETHODIMP nsMsgTemplateReplyHelper::OnStopRunningUrl(nsIURI *aUrl, nsresult
|
||||||
templateSubject.Append(NS_LITERAL_STRING(")"));
|
templateSubject.Append(NS_LITERAL_STRING(")"));
|
||||||
}
|
}
|
||||||
compFields->SetSubject(templateSubject);
|
compFields->SetSubject(templateSubject);
|
||||||
body.AssignWithConversion(mTemplateBody);
|
CopyASCIItoUTF16(mTemplateBody, body);
|
||||||
compFields->SetBody(body);
|
compFields->SetBody(body);
|
||||||
|
|
||||||
nsCString msgUri;
|
nsCString msgUri;
|
||||||
|
@ -1293,13 +1292,13 @@ nsresult nsMsgComposeService::AddGlobalHtmlDomains()
|
||||||
// Update the list as needed
|
// Update the list as needed
|
||||||
if (htmlDomainListCurrentVersion <= htmlDomainListDefaultVersion) {
|
if (htmlDomainListCurrentVersion <= htmlDomainListDefaultVersion) {
|
||||||
// Get list of global domains need to be added
|
// Get list of global domains need to be added
|
||||||
nsXPIDLCString globalHtmlDomainList;
|
nsCString globalHtmlDomainList;
|
||||||
rv = prefBranch->GetCharPref(HTMLDOMAINUPDATE_DOMAINLIST_PREF_NAME, getter_Copies(globalHtmlDomainList));
|
rv = prefBranch->GetCharPref(HTMLDOMAINUPDATE_DOMAINLIST_PREF_NAME, getter_Copies(globalHtmlDomainList));
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && !globalHtmlDomainList.IsEmpty()) {
|
if (NS_SUCCEEDED(rv) && !globalHtmlDomainList.IsEmpty()) {
|
||||||
|
|
||||||
// Get user's current HTML domain set for send format
|
// Get user's current HTML domain set for send format
|
||||||
nsXPIDLCString currentHtmlDomainList;
|
nsCString currentHtmlDomainList;
|
||||||
rv = prefBranch->GetCharPref(USER_CURRENT_HTMLDOMAINLIST_PREF_NAME, getter_Copies(currentHtmlDomainList));
|
rv = prefBranch->GetCharPref(USER_CURRENT_HTMLDOMAINLIST_PREF_NAME, getter_Copies(currentHtmlDomainList));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
|
@ -1310,7 +1309,7 @@ nsresult nsMsgComposeService::AddGlobalHtmlDomains()
|
||||||
htmlDomainArray.ParseString(currentHtmlDomainList.get(), DOMAIN_DELIMITER);
|
htmlDomainArray.ParseString(currentHtmlDomainList.get(), DOMAIN_DELIMITER);
|
||||||
|
|
||||||
// Get user's current Plaintext domain set for send format
|
// Get user's current Plaintext domain set for send format
|
||||||
nsXPIDLCString currentPlaintextDomainList;
|
nsCString currentPlaintextDomainList;
|
||||||
rv = prefBranch->GetCharPref(USER_CURRENT_PLAINTEXTDOMAINLIST_PREF_NAME, getter_Copies(currentPlaintextDomainList));
|
rv = prefBranch->GetCharPref(USER_CURRENT_PLAINTEXTDOMAINLIST_PREF_NAME, getter_Copies(currentPlaintextDomainList));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
#include "nsMsgCopy.h"
|
#include "nsMsgCopy.h"
|
||||||
|
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsMsgBaseCID.h"
|
#include "nsMsgBaseCID.h"
|
||||||
#include "nsMsgFolderFlags.h"
|
#include "nsMsgFolderFlags.h"
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
#include "nsIPrompt.h"
|
#include "nsIPrompt.h"
|
||||||
#include "nsIWindowWatcher.h"
|
#include "nsIWindowWatcher.h"
|
||||||
#include "nsMsgComposeStringBundle.h"
|
#include "nsMsgComposeStringBundle.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsMsgCompCID.h"
|
#include "nsMsgCompCID.h"
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -50,12 +49,10 @@ nsMsgBuildErrorMessageByID(PRInt32 msgID, nsString& retval, nsString* param0, ns
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgStringService> composebundle (do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID, &rv));
|
nsCOMPtr<nsIMsgStringService> composebundle (do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID, &rv));
|
||||||
nsXPIDLString msg;
|
|
||||||
|
|
||||||
if (composebundle)
|
if (composebundle)
|
||||||
{
|
{
|
||||||
composebundle->GetStringByID(msgID, getter_Copies(msg));
|
composebundle->GetStringByID(msgID, getter_Copies(retval));
|
||||||
retval = msg;
|
|
||||||
|
|
||||||
nsString target;
|
nsString target;
|
||||||
if (param0)
|
if (param0)
|
||||||
|
@ -78,12 +75,12 @@ nsMsgDisplayMessageByID(nsIPrompt * aPrompt, PRInt32 msgID, const PRUnichar * wi
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgStringService> composebundle (do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID, &rv));
|
nsCOMPtr<nsIMsgStringService> composebundle (do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID, &rv));
|
||||||
nsXPIDLString msg;
|
nsString msg;
|
||||||
|
|
||||||
if (composebundle)
|
if (composebundle)
|
||||||
{
|
{
|
||||||
composebundle->GetStringByID(msgID, getter_Copies(msg));
|
composebundle->GetStringByID(msgID, getter_Copies(msg));
|
||||||
rv = nsMsgDisplayMessageByString(aPrompt, msg, windowTitle);
|
rv = nsMsgDisplayMessageByString(aPrompt, msg.get(), windowTitle);
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -113,12 +110,12 @@ nsresult
|
||||||
nsMsgAskBooleanQuestionByID(nsIPrompt * aPrompt, PRInt32 msgID, PRBool *answer, const PRUnichar * windowTitle)
|
nsMsgAskBooleanQuestionByID(nsIPrompt * aPrompt, PRInt32 msgID, PRBool *answer, const PRUnichar * windowTitle)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIMsgStringService> composebundle (do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID));
|
nsCOMPtr<nsIMsgStringService> composebundle (do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID));
|
||||||
nsXPIDLString msg;
|
nsString msg;
|
||||||
|
|
||||||
if (composebundle)
|
if (composebundle)
|
||||||
{
|
{
|
||||||
composebundle->GetStringByID(msgID, getter_Copies(msg));
|
composebundle->GetStringByID(msgID, getter_Copies(msg));
|
||||||
nsMsgAskBooleanQuestionByString(aPrompt, msg, answer, windowTitle);
|
nsMsgAskBooleanQuestionByString(aPrompt, msg.get(), answer, windowTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -179,10 +176,10 @@ nsMsgAskAboutUncoveredCharacters(nsIPrompt * aPrompt)
|
||||||
getter_AddRefs(composeBundle));
|
getter_AddRefs(composeBundle));
|
||||||
NS_ENSURE_TRUE(composeBundle, 0);
|
NS_ENSURE_TRUE(composeBundle, 0);
|
||||||
|
|
||||||
nsXPIDLString title;
|
nsString title;
|
||||||
nsXPIDLString msg;
|
nsString msg;
|
||||||
nsXPIDLString sendInUTF8;
|
nsString sendInUTF8;
|
||||||
nsXPIDLString sendAnyway;
|
nsString sendAnyway;
|
||||||
|
|
||||||
composeBundle->
|
composeBundle->
|
||||||
GetStringFromName(NS_LITERAL_STRING("initErrorDlogTitle").get(),
|
GetStringFromName(NS_LITERAL_STRING("initErrorDlogTitle").get(),
|
||||||
|
@ -198,12 +195,12 @@ nsMsgAskAboutUncoveredCharacters(nsIPrompt * aPrompt)
|
||||||
getter_Copies(sendAnyway));
|
getter_Copies(sendAnyway));
|
||||||
|
|
||||||
nsresult rv = dialog->
|
nsresult rv = dialog->
|
||||||
ConfirmEx(title, msg,
|
ConfirmEx(title.get(), msg.get(),
|
||||||
nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_0 +
|
nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_0 +
|
||||||
nsIPrompt::BUTTON_TITLE_CANCEL * nsIPrompt::BUTTON_POS_1 +
|
nsIPrompt::BUTTON_TITLE_CANCEL * nsIPrompt::BUTTON_POS_1 +
|
||||||
nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_2 +
|
nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_2 +
|
||||||
nsIPrompt::BUTTON_POS_0_DEFAULT,
|
nsIPrompt::BUTTON_POS_0_DEFAULT,
|
||||||
sendInUTF8, nsnull, sendAnyway, nsnull, 0, &result);
|
sendInUTF8.get(), nsnull, sendAnyway.get(), nsnull, 0, &result);
|
||||||
|
|
||||||
NS_ENSURE_SUCCESS(rv, 0);
|
NS_ENSURE_SUCCESS(rv, 0);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -58,7 +58,6 @@
|
||||||
#include "nsMsgCompCID.h"
|
#include "nsMsgCompCID.h"
|
||||||
#include "nsMsgCompose.h"
|
#include "nsMsgCompose.h"
|
||||||
#include "nsMsgMailNewsUrl.h"
|
#include "nsMsgMailNewsUrl.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
|
|
||||||
NS_IMPL_THREADSAFE_ADDREF(nsMsgQuoteListener)
|
NS_IMPL_THREADSAFE_ADDREF(nsMsgQuoteListener)
|
||||||
NS_IMPL_THREADSAFE_RELEASE(nsMsgQuoteListener)
|
NS_IMPL_THREADSAFE_RELEASE(nsMsgQuoteListener)
|
||||||
|
|
|
@ -65,7 +65,6 @@
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "nsIFileURL.h"
|
#include "nsIFileURL.h"
|
||||||
#include "nsMsgCopy.h"
|
#include "nsMsgCopy.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsUnicharUtils.h"
|
#include "nsUnicharUtils.h"
|
||||||
#include "nsMsgPrompts.h"
|
#include "nsMsgPrompts.h"
|
||||||
|
@ -528,7 +527,7 @@ nsMsgComposeAndSend::GatherMimeAttachments()
|
||||||
PRBool plaintext_is_mainbody_p = PR_FALSE; // only using text converted from HTML?
|
PRBool plaintext_is_mainbody_p = PR_FALSE; // only using text converted from HTML?
|
||||||
char *buffer = 0;
|
char *buffer = 0;
|
||||||
char *buffer_tail = 0;
|
char *buffer_tail = 0;
|
||||||
nsXPIDLString msg;
|
nsString msg;
|
||||||
PRBool tonews;
|
PRBool tonews;
|
||||||
PRBool body_is_us_ascii = PR_TRUE;
|
PRBool body_is_us_ascii = PR_TRUE;
|
||||||
|
|
||||||
|
@ -749,7 +748,7 @@ nsMsgComposeAndSend::GatherMimeAttachments()
|
||||||
NS_ASSERTION (m_attachment_pending_count == 0, "m_attachment_pending_count != 0");
|
NS_ASSERTION (m_attachment_pending_count == 0, "m_attachment_pending_count != 0");
|
||||||
|
|
||||||
mComposeBundle->GetStringByID(NS_MSG_ASSEMBLING_MSG, getter_Copies(msg));
|
mComposeBundle->GetStringByID(NS_MSG_ASSEMBLING_MSG, getter_Copies(msg));
|
||||||
SetStatusMessage( msg );
|
SetStatusMessage(msg);
|
||||||
|
|
||||||
/* First, open the message file.
|
/* First, open the message file.
|
||||||
*/
|
*/
|
||||||
|
@ -1107,7 +1106,7 @@ nsMsgComposeAndSend::GatherMimeAttachments()
|
||||||
|
|
||||||
// Tell the user we are creating the message...
|
// Tell the user we are creating the message...
|
||||||
mComposeBundle->GetStringByID(NS_MSG_CREATING_MESSAGE, getter_Copies(msg));
|
mComposeBundle->GetStringByID(NS_MSG_CREATING_MESSAGE, getter_Copies(msg));
|
||||||
SetStatusMessage( msg );
|
SetStatusMessage(msg);
|
||||||
|
|
||||||
// OK, now actually write the structure we've carefully built up.
|
// OK, now actually write the structure we've carefully built up.
|
||||||
status = toppart->Write();
|
status = toppart->Write();
|
||||||
|
@ -1149,7 +1148,7 @@ nsMsgComposeAndSend::GatherMimeAttachments()
|
||||||
}
|
}
|
||||||
|
|
||||||
mComposeBundle->GetStringByID(NS_MSG_ASSEMB_DONE_MSG, getter_Copies(msg));
|
mComposeBundle->GetStringByID(NS_MSG_ASSEMB_DONE_MSG, getter_Copies(msg));
|
||||||
SetStatusMessage( msg );
|
SetStatusMessage(msg);
|
||||||
|
|
||||||
if (m_dont_deliver_p && mListener)
|
if (m_dont_deliver_p && mListener)
|
||||||
{
|
{
|
||||||
|
@ -1239,7 +1238,7 @@ nsMsgComposeAndSend::PreProcessPart(nsMsgAttachmentHandler *ma,
|
||||||
if (NS_FAILED(status))
|
if (NS_FAILED(status))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
nsXPIDLCString turl;
|
nsCString turl;
|
||||||
if (!ma->mURL)
|
if (!ma->mURL)
|
||||||
{
|
{
|
||||||
if (ma->m_uri)
|
if (ma->m_uri)
|
||||||
|
@ -1254,7 +1253,7 @@ nsMsgComposeAndSend::PreProcessPart(nsMsgAttachmentHandler *ma,
|
||||||
ma->m_x_mac_type,
|
ma->m_x_mac_type,
|
||||||
ma->m_x_mac_creator,
|
ma->m_x_mac_creator,
|
||||||
ma->m_real_name,
|
ma->m_real_name,
|
||||||
turl,
|
turl.get(),
|
||||||
m_digest_p,
|
m_digest_p,
|
||||||
ma,
|
ma,
|
||||||
ma->m_charset, // rhp - this needs
|
ma->m_charset, // rhp - this needs
|
||||||
|
@ -1742,7 +1741,7 @@ nsMsgComposeAndSend::GetBodyFromEditor()
|
||||||
const char *attachment1_type = TEXT_HTML;
|
const char *attachment1_type = TEXT_HTML;
|
||||||
|
|
||||||
// Convert body to mail charset
|
// Convert body to mail charset
|
||||||
nsXPIDLCString outCString;
|
nsCString outCString;
|
||||||
const char *aCharset = mCompFields->GetCharacterSet();
|
const char *aCharset = mCompFields->GetCharacterSet();
|
||||||
|
|
||||||
if (aCharset && *aCharset)
|
if (aCharset && *aCharset)
|
||||||
|
@ -1769,7 +1768,7 @@ nsMsgComposeAndSend::GetBodyFromEditor()
|
||||||
bodyTextPtr++;
|
bodyTextPtr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsXPIDLCString fallbackCharset;
|
nsCString fallbackCharset;
|
||||||
rv = nsMsgI18NSaveAsCharset(TEXT_PLAIN, aCharset, bodyText,
|
rv = nsMsgI18NSaveAsCharset(TEXT_PLAIN, aCharset, bodyText,
|
||||||
getter_Copies(outCString), getter_Copies(fallbackCharset));
|
getter_Copies(outCString), getter_Copies(fallbackCharset));
|
||||||
|
|
||||||
|
@ -1794,7 +1793,7 @@ nsMsgComposeAndSend::GetBodyFromEditor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// re-label to the fallback charset
|
// re-label to the fallback charset
|
||||||
else if (fallbackCharset)
|
else if (!fallbackCharset.IsEmpty())
|
||||||
mCompFields->SetCharacterSet(fallbackCharset.get());
|
mCompFields->SetCharacterSet(fallbackCharset.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2193,7 +2192,7 @@ nsMsgComposeAndSend::CountCompFieldAttachments()
|
||||||
|
|
||||||
//Parse the attachments array
|
//Parse the attachments array
|
||||||
nsCOMPtr<nsIMsgAttachment> element;
|
nsCOMPtr<nsIMsgAttachment> element;
|
||||||
nsXPIDLCString url;
|
nsCString url;
|
||||||
for (i = 0; i < attachmentCount; i ++)
|
for (i = 0; i < attachmentCount; i ++)
|
||||||
{
|
{
|
||||||
attachmentsArray->QueryElementAt(i, NS_GET_IID(nsIMsgAttachment), getter_AddRefs(element));
|
attachmentsArray->QueryElementAt(i, NS_GET_IID(nsIMsgAttachment), getter_AddRefs(element));
|
||||||
|
@ -2248,7 +2247,7 @@ nsMsgComposeAndSend::AddCompFieldLocalAttachments()
|
||||||
|
|
||||||
//Parse the attachments array
|
//Parse the attachments array
|
||||||
nsCOMPtr<nsIMsgAttachment> element;
|
nsCOMPtr<nsIMsgAttachment> element;
|
||||||
nsXPIDLCString url;
|
nsCString url;
|
||||||
for (i = 0; i < attachmentCount; i ++)
|
for (i = 0; i < attachmentCount; i ++)
|
||||||
{
|
{
|
||||||
attachmentsArray->QueryElementAt(i, NS_GET_IID(nsIMsgAttachment), getter_AddRefs(element));
|
attachmentsArray->QueryElementAt(i, NS_GET_IID(nsIMsgAttachment), getter_AddRefs(element));
|
||||||
|
@ -2257,162 +2256,162 @@ nsMsgComposeAndSend::AddCompFieldLocalAttachments()
|
||||||
element->GetUrl(getter_Copies(url));
|
element->GetUrl(getter_Copies(url));
|
||||||
if (!url.IsEmpty())
|
if (!url.IsEmpty())
|
||||||
{
|
{
|
||||||
// Just look for local file:// attachments and do the right thing.
|
// Just look for local file:// attachments and do the right thing.
|
||||||
if (nsMsgIsLocalFile(url.get()))
|
if (nsMsgIsLocalFile(url.get()))
|
||||||
{
|
{
|
||||||
#if defined(DEBUG_ducarroz)
|
#if defined(DEBUG_ducarroz)
|
||||||
printf("Adding LOCAL attachment %d: %s\n", newLoc, url.get());
|
printf("Adding LOCAL attachment %d: %s\n", newLoc, url.get());
|
||||||
#endif
|
#endif
|
||||||
//
|
//
|
||||||
// Now we have to setup the m_attachments entry for the file://
|
// Now we have to setup the m_attachments entry for the file://
|
||||||
// URL that is passed in...
|
// URL that is passed in...
|
||||||
//
|
//
|
||||||
m_attachments[newLoc].mDeleteFile = PR_FALSE;
|
m_attachments[newLoc].mDeleteFile = PR_FALSE;
|
||||||
|
|
||||||
nsMsgNewURL(getter_AddRefs(m_attachments[newLoc].mURL), url.get());
|
nsMsgNewURL(getter_AddRefs(m_attachments[newLoc].mURL), url.get());
|
||||||
|
|
||||||
if (m_attachments[newLoc].mTmpFile)
|
if (m_attachments[newLoc].mTmpFile)
|
||||||
{
|
|
||||||
if (m_attachments[newLoc].mDeleteFile)
|
|
||||||
m_attachments[newLoc].mTmpFile->Remove(PR_FALSE);
|
|
||||||
m_attachments[newLoc].mTmpFile =nsnull;
|
|
||||||
}
|
|
||||||
if (!NS_IsNativeUTF8())
|
|
||||||
{
|
|
||||||
// XXX : this is really hackish.
|
|
||||||
// File URL is now in UTF-8 (bug 278161), but nsFileSpec still uses
|
|
||||||
// the native encoding.
|
|
||||||
NS_UnescapeURL(url);
|
|
||||||
NS_ASSERTION(IsUTF8(url), "unescaped url must be in UTF-8");
|
|
||||||
nsCAutoString nativeUrl;
|
|
||||||
NS_CopyUnicodeToNative(NS_ConvertUTF8toUTF16(url), nativeUrl);
|
|
||||||
url.Truncate(); // NS_EscapeURL will append to |url|
|
|
||||||
NS_EscapeURL(nativeUrl.get(), -1, esc_FilePath | esc_AlwaysCopy,
|
|
||||||
url);
|
|
||||||
}
|
|
||||||
nsresult rv;
|
|
||||||
nsCOMPtr<nsIIOService> ioService = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
nsCOMPtr <nsIURI> uri;
|
|
||||||
rv = ioService->NewURI(url, nsnull, nsnull, getter_AddRefs(uri));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
nsCOMPtr <nsIFileURL> fileURL = do_QueryInterface(uri);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
nsCOMPtr <nsIFile> fileURLFile;
|
|
||||||
fileURL->GetFile(getter_AddRefs(fileURLFile));
|
|
||||||
m_attachments[newLoc].mTmpFile = do_QueryInterface(fileURLFile);
|
|
||||||
m_attachments[newLoc].mDeleteFile = PR_FALSE;
|
|
||||||
if (m_attachments[newLoc].mURL)
|
|
||||||
{
|
|
||||||
nsAutoString proposedName;
|
|
||||||
element->GetName(proposedName);
|
|
||||||
msg_pick_real_name(&m_attachments[newLoc], proposedName.get(), mCompFields->GetCharacterSet());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now, most importantly, we need to figure out what the content type is for
|
|
||||||
// this attachment...If we can't, then just make it application/octet-stream
|
|
||||||
|
|
||||||
#ifdef MAC_OSX
|
|
||||||
//Mac always need to snarf the file to figure out how to send it, maybe we need to use apple double...
|
|
||||||
// unless caller has already set the content type, in which case, trust them.
|
|
||||||
PRBool mustSnarfAttachment = PR_TRUE;
|
|
||||||
#else
|
|
||||||
PRBool mustSnarfAttachment = PR_FALSE;
|
|
||||||
#endif
|
|
||||||
PR_FREEIF(m_attachments[newLoc].m_type);
|
|
||||||
element->GetContentType(&m_attachments[newLoc].m_type);
|
|
||||||
if (!m_attachments[newLoc].m_type || !(*m_attachments[newLoc].m_type))
|
|
||||||
{
|
|
||||||
nsresult rv = NS_OK;
|
|
||||||
nsCOMPtr<nsIMIMEService> mimeFinder (do_GetService(NS_MIMESERVICE_CONTRACTID, &rv));
|
|
||||||
if (NS_SUCCEEDED(rv) && mimeFinder)
|
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIURL> fileUrl(do_CreateInstance(NS_STANDARDURL_CONTRACTID));
|
if (m_attachments[newLoc].mDeleteFile)
|
||||||
if (fileUrl)
|
m_attachments[newLoc].mTmpFile->Remove(PR_FALSE);
|
||||||
{
|
m_attachments[newLoc].mTmpFile =nsnull;
|
||||||
nsCAutoString fileExt;
|
}
|
||||||
//First try using the real file name
|
if (!NS_IsNativeUTF8())
|
||||||
rv = fileUrl->SetFileName(nsDependentCString(m_attachments[newLoc].m_real_name));
|
{
|
||||||
if (NS_SUCCEEDED(rv))
|
// XXX : this is really hackish.
|
||||||
{
|
// File URL is now in UTF-8 (bug 278161), but nsFileSpec still uses
|
||||||
rv = fileUrl->GetFileExtension(fileExt);
|
// the native encoding.
|
||||||
if (NS_SUCCEEDED(rv) && !fileExt.IsEmpty()) {
|
NS_UnescapeURL(url);
|
||||||
nsCAutoString type;
|
NS_ASSERTION(IsUTF8(url), "unescaped url must be in UTF-8");
|
||||||
mimeFinder->GetTypeFromExtension(fileExt, type);
|
nsCAutoString nativeUrl;
|
||||||
#ifndef XP_MACOSX
|
NS_CopyUnicodeToNative(NS_ConvertUTF8toUTF16(url), nativeUrl);
|
||||||
if (!type.Equals("multipart/appledouble")) // can't do apple double on non-macs
|
url.Truncate(); // NS_EscapeURL will append to |url|
|
||||||
#endif
|
NS_EscapeURL(nativeUrl.get(), -1, esc_FilePath | esc_AlwaysCopy,
|
||||||
m_attachments[newLoc].m_type = ToNewCString(type);
|
url);
|
||||||
}
|
}
|
||||||
}
|
nsresult rv;
|
||||||
|
nsCOMPtr<nsIIOService> ioService = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
nsCOMPtr <nsIURI> uri;
|
||||||
|
rv = ioService->NewURI(url, nsnull, nsnull, getter_AddRefs(uri));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
nsCOMPtr <nsIFileURL> fileURL = do_QueryInterface(uri);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
nsCOMPtr <nsIFile> fileURLFile;
|
||||||
|
fileURL->GetFile(getter_AddRefs(fileURLFile));
|
||||||
|
m_attachments[newLoc].mTmpFile = do_QueryInterface(fileURLFile);
|
||||||
|
m_attachments[newLoc].mDeleteFile = PR_FALSE;
|
||||||
|
if (m_attachments[newLoc].mURL)
|
||||||
|
{
|
||||||
|
nsAutoString proposedName;
|
||||||
|
element->GetName(proposedName);
|
||||||
|
msg_pick_real_name(&m_attachments[newLoc], proposedName.get(), mCompFields->GetCharacterSet());
|
||||||
|
}
|
||||||
|
|
||||||
//Then try using the url if we still haven't figured out the content type
|
// Now, most importantly, we need to figure out what the content type is for
|
||||||
if ((!m_attachments[newLoc].m_type) || (!*m_attachments[newLoc].m_type))
|
// this attachment...If we can't, then just make it application/octet-stream
|
||||||
|
|
||||||
|
#ifdef MAC_OSX
|
||||||
|
//Mac always need to snarf the file to figure out how to send it, maybe we need to use apple double...
|
||||||
|
// unless caller has already set the content type, in which case, trust them.
|
||||||
|
PRBool mustSnarfAttachment = PR_TRUE;
|
||||||
|
#else
|
||||||
|
PRBool mustSnarfAttachment = PR_FALSE;
|
||||||
|
#endif
|
||||||
|
PR_FREEIF(m_attachments[newLoc].m_type);
|
||||||
|
element->GetContentType(&m_attachments[newLoc].m_type);
|
||||||
|
if (!m_attachments[newLoc].m_type || !(*m_attachments[newLoc].m_type))
|
||||||
|
{
|
||||||
|
nsresult rv = NS_OK;
|
||||||
|
nsCOMPtr<nsIMIMEService> mimeFinder (do_GetService(NS_MIMESERVICE_CONTRACTID, &rv));
|
||||||
|
if (NS_SUCCEEDED(rv) && mimeFinder)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIURL> fileUrl(do_CreateInstance(NS_STANDARDURL_CONTRACTID));
|
||||||
|
if (fileUrl)
|
||||||
{
|
{
|
||||||
rv = fileUrl->SetSpec(url);
|
nsCAutoString fileExt;
|
||||||
|
//First try using the real file name
|
||||||
|
rv = fileUrl->SetFileName(nsDependentCString(m_attachments[newLoc].m_real_name));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
rv = fileUrl->GetFileExtension(fileExt);
|
rv = fileUrl->GetFileExtension(fileExt);
|
||||||
if (NS_SUCCEEDED(rv) && !fileExt.IsEmpty()) {
|
if (NS_SUCCEEDED(rv) && !fileExt.IsEmpty()) {
|
||||||
nsCAutoString type;
|
nsCAutoString type;
|
||||||
mimeFinder->GetTypeFromExtension(fileExt, type);
|
mimeFinder->GetTypeFromExtension(fileExt, type);
|
||||||
#ifndef XP_MACOSX
|
#ifndef XP_MACOSX
|
||||||
if (!type.Equals("multipart/appledouble")) // can't do apple double on non-macs
|
if (!type.Equals("multipart/appledouble")) // can't do apple double on non-macs
|
||||||
#endif
|
#endif
|
||||||
m_attachments[newLoc].m_type = ToNewCString(type);
|
m_attachments[newLoc].m_type = ToNewCString(type);
|
||||||
// rtf and vcs files may look like text to sniffers,
|
}
|
||||||
// but they're not human readable.
|
}
|
||||||
if (type.IsEmpty() && !fileExt.IsEmpty() &&
|
|
||||||
(fileExt.LowerCaseEqualsLiteral("rtf") || fileExt.LowerCaseEqualsLiteral("vcs")))
|
//Then try using the url if we still haven't figured out the content type
|
||||||
m_attachments[newLoc].m_type = PL_strdup(APPLICATION_OCTET_STREAM);
|
if ((!m_attachments[newLoc].m_type) || (!*m_attachments[newLoc].m_type))
|
||||||
|
{
|
||||||
|
rv = fileUrl->SetSpec(url);
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
{
|
||||||
|
rv = fileUrl->GetFileExtension(fileExt);
|
||||||
|
if (NS_SUCCEEDED(rv) && !fileExt.IsEmpty()) {
|
||||||
|
nsCAutoString type;
|
||||||
|
mimeFinder->GetTypeFromExtension(fileExt, type);
|
||||||
|
#ifndef XP_MACOSX
|
||||||
|
if (!type.Equals("multipart/appledouble")) // can't do apple double on non-macs
|
||||||
|
#endif
|
||||||
|
m_attachments[newLoc].m_type = ToNewCString(type);
|
||||||
|
// rtf and vcs files may look like text to sniffers,
|
||||||
|
// but they're not human readable.
|
||||||
|
if (type.IsEmpty() && !fileExt.IsEmpty() &&
|
||||||
|
(fileExt.LowerCaseEqualsLiteral("rtf") || fileExt.LowerCaseEqualsLiteral("vcs")))
|
||||||
|
m_attachments[newLoc].m_type = PL_strdup(APPLICATION_OCTET_STREAM);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
element->GetContentTypeParam(&m_attachments[newLoc].m_type_param);
|
|
||||||
mustSnarfAttachment = PR_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
//We need to snarf the file to figure out how to send it only if we don't have a content type...
|
|
||||||
if (mustSnarfAttachment || (!m_attachments[newLoc].m_type) || (!*m_attachments[newLoc].m_type))
|
|
||||||
{
|
|
||||||
m_attachments[newLoc].m_done = PR_FALSE;
|
|
||||||
m_attachments[newLoc].SetMimeDeliveryState(this);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_attachments[newLoc].m_done = PR_TRUE;
|
|
||||||
m_attachments[newLoc].SetMimeDeliveryState(nsnull);
|
|
||||||
}
|
|
||||||
// For local files, if they are HTML docs and we don't have a charset, we should
|
|
||||||
// sniff the file and see if we can figure it out.
|
|
||||||
if ( (m_attachments[newLoc].m_type) && (*m_attachments[newLoc].m_type) )
|
|
||||||
{
|
|
||||||
if (PL_strcasecmp(m_attachments[newLoc].m_type, TEXT_HTML) == 0)
|
|
||||||
{
|
{
|
||||||
char *tmpCharset = (char *)nsMsgI18NParseMetaCharset(m_attachments[newLoc].mTmpFile);
|
element->GetContentTypeParam(&m_attachments[newLoc].m_type_param);
|
||||||
if (tmpCharset[0] != '\0')
|
mustSnarfAttachment = PR_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//We need to snarf the file to figure out how to send it only if we don't have a content type...
|
||||||
|
if (mustSnarfAttachment || (!m_attachments[newLoc].m_type) || (!*m_attachments[newLoc].m_type))
|
||||||
|
{
|
||||||
|
m_attachments[newLoc].m_done = PR_FALSE;
|
||||||
|
m_attachments[newLoc].SetMimeDeliveryState(this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_attachments[newLoc].m_done = PR_TRUE;
|
||||||
|
m_attachments[newLoc].SetMimeDeliveryState(nsnull);
|
||||||
|
}
|
||||||
|
// For local files, if they are HTML docs and we don't have a charset, we should
|
||||||
|
// sniff the file and see if we can figure it out.
|
||||||
|
if ( (m_attachments[newLoc].m_type) && (*m_attachments[newLoc].m_type) )
|
||||||
|
{
|
||||||
|
if (PL_strcasecmp(m_attachments[newLoc].m_type, TEXT_HTML) == 0)
|
||||||
{
|
{
|
||||||
PR_FREEIF(m_attachments[newLoc].m_charset);
|
char *tmpCharset = (char *)nsMsgI18NParseMetaCharset(m_attachments[newLoc].mTmpFile);
|
||||||
m_attachments[newLoc].m_charset = PL_strdup(tmpCharset);
|
if (tmpCharset[0] != '\0')
|
||||||
|
{
|
||||||
|
PR_FREEIF(m_attachments[newLoc].m_charset);
|
||||||
|
m_attachments[newLoc].m_charset = PL_strdup(tmpCharset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PR_FREEIF(m_attachments[newLoc].m_x_mac_type);
|
||||||
|
element->GetMacType(&m_attachments[newLoc].m_x_mac_type);
|
||||||
|
PR_FREEIF(m_attachments[newLoc].m_x_mac_creator);
|
||||||
|
element->GetMacCreator(&m_attachments[newLoc].m_x_mac_creator);
|
||||||
|
|
||||||
|
++newLoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
PR_FREEIF(m_attachments[newLoc].m_x_mac_type);
|
|
||||||
element->GetMacType(&m_attachments[newLoc].m_x_mac_type);
|
|
||||||
PR_FREEIF(m_attachments[newLoc].m_x_mac_creator);
|
|
||||||
element->GetMacCreator(&m_attachments[newLoc].m_x_mac_creator);
|
|
||||||
|
|
||||||
++newLoc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2438,7 +2437,7 @@ nsMsgComposeAndSend::AddCompFieldRemoteAttachments(PRUint32 aStartLocation,
|
||||||
|
|
||||||
//Parse the attachments array
|
//Parse the attachments array
|
||||||
nsCOMPtr<nsIMsgAttachment> element;
|
nsCOMPtr<nsIMsgAttachment> element;
|
||||||
nsXPIDLCString url;
|
nsCString url;
|
||||||
for (i = 0; i < attachmentCount; i ++)
|
for (i = 0; i < attachmentCount; i ++)
|
||||||
{
|
{
|
||||||
attachmentsArray->QueryElementAt(i, NS_GET_IID(nsIMsgAttachment), getter_AddRefs(element));
|
attachmentsArray->QueryElementAt(i, NS_GET_IID(nsIMsgAttachment), getter_AddRefs(element));
|
||||||
|
@ -2770,17 +2769,17 @@ nsMsgComposeAndSend::HackAttachments(const nsMsgAttachmentData *attachments,
|
||||||
// Display some feedback to user...
|
// Display some feedback to user...
|
||||||
PRUnichar *printfString = nsnull;
|
PRUnichar *printfString = nsnull;
|
||||||
|
|
||||||
nsXPIDLString msg;
|
nsString msg;
|
||||||
mComposeBundle->GetStringByID(NS_MSG_GATHERING_ATTACHMENT, getter_Copies(msg));
|
mComposeBundle->GetStringByID(NS_MSG_GATHERING_ATTACHMENT, getter_Copies(msg));
|
||||||
|
|
||||||
if (m_attachments[i].m_real_name)
|
if (m_attachments[i].m_real_name)
|
||||||
printfString = nsTextFormatter::smprintf(msg, m_attachments[i].m_real_name);
|
printfString = nsTextFormatter::smprintf(msg.get(), m_attachments[i].m_real_name);
|
||||||
else
|
else
|
||||||
printfString = nsTextFormatter::smprintf(msg, "");
|
printfString = nsTextFormatter::smprintf(msg.get(), "");
|
||||||
|
|
||||||
if (printfString)
|
if (printfString)
|
||||||
{
|
{
|
||||||
SetStatusMessage(printfString);
|
SetStatusMessage(nsDependentString(printfString));
|
||||||
PR_Free(printfString);
|
PR_Free(printfString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2792,7 +2791,7 @@ nsMsgComposeAndSend::HackAttachments(const nsMsgAttachmentData *attachments,
|
||||||
nsresult status = m_attachments[i].SnarfAttachment(mCompFields);
|
nsresult status = m_attachments[i].SnarfAttachment(mCompFields);
|
||||||
if (NS_FAILED(status))
|
if (NS_FAILED(status))
|
||||||
{
|
{
|
||||||
nsXPIDLString errorMsg;
|
nsString errorMsg;
|
||||||
nsAutoString attachmentFileName;
|
nsAutoString attachmentFileName;
|
||||||
nsresult rv = ConvertToUnicode(nsMsgI18NFileSystemCharset(), m_attachments[i].m_real_name, attachmentFileName);
|
nsresult rv = ConvertToUnicode(nsMsgI18NFileSystemCharset(), m_attachments[i].m_real_name, attachmentFileName);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
|
@ -2803,7 +2802,7 @@ nsMsgComposeAndSend::HackAttachments(const nsMsgAttachmentData *attachments,
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
bundle->FormatStringFromID(NS_ERROR_GET_CODE(NS_MSG_ERROR_ATTACHING_FILE), params, 1, getter_Copies(errorMsg));
|
bundle->FormatStringFromID(NS_ERROR_GET_CODE(NS_MSG_ERROR_ATTACHING_FILE), params, 1, getter_Copies(errorMsg));
|
||||||
mSendReport->SetMessage(nsIMsgSendReport::process_Current, errorMsg, PR_FALSE);
|
mSendReport->SetMessage(nsIMsgSendReport::process_Current, errorMsg.get(), PR_FALSE);
|
||||||
}
|
}
|
||||||
mSendReport->SetError(nsIMsgSendReport::process_Current, NS_MSG_ERROR_ATTACHING_FILE /* status */, PR_FALSE);
|
mSendReport->SetError(nsIMsgSendReport::process_Current, NS_MSG_ERROR_ATTACHING_FILE /* status */, PR_FALSE);
|
||||||
}
|
}
|
||||||
|
@ -3230,13 +3229,13 @@ nsMsgComposeAndSend::Init(
|
||||||
//Let make sure we retreive the correct number of related parts. It may have changed since last time
|
//Let make sure we retreive the correct number of related parts. It may have changed since last time
|
||||||
GetMultipartRelatedCount(PR_TRUE);
|
GetMultipartRelatedCount(PR_TRUE);
|
||||||
|
|
||||||
nsXPIDLString msg;
|
nsString msg;
|
||||||
if (!mComposeBundle)
|
if (!mComposeBundle)
|
||||||
mComposeBundle = do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID);
|
mComposeBundle = do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID);
|
||||||
|
|
||||||
// Tell the user we are assembling the message...
|
// Tell the user we are assembling the message...
|
||||||
mComposeBundle->GetStringByID(NS_MSG_ASSEMBLING_MESSAGE, getter_Copies(msg));
|
mComposeBundle->GetStringByID(NS_MSG_ASSEMBLING_MESSAGE, getter_Copies(msg));
|
||||||
SetStatusMessage( msg );
|
SetStatusMessage(msg);
|
||||||
if (mSendReport)
|
if (mSendReport)
|
||||||
mSendReport->SetCurrentProcess(nsIMsgSendReport::process_BuildMessage);
|
mSendReport->SetCurrentProcess(nsIMsgSendReport::process_BuildMessage);
|
||||||
|
|
||||||
|
@ -3414,12 +3413,12 @@ nsMsgComposeAndSend::DeliverMessage()
|
||||||
{
|
{
|
||||||
PRBool abortTheSend = PR_FALSE;
|
PRBool abortTheSend = PR_FALSE;
|
||||||
|
|
||||||
nsXPIDLString msg;
|
nsString msg;
|
||||||
mComposeBundle->GetStringByID(NS_MSG_LARGE_MESSAGE_WARNING, getter_Copies(msg));
|
mComposeBundle->GetStringByID(NS_MSG_LARGE_MESSAGE_WARNING, getter_Copies(msg));
|
||||||
|
|
||||||
if (msg)
|
if (!msg.IsEmpty())
|
||||||
{
|
{
|
||||||
PRUnichar *printfString = nsTextFormatter::smprintf(msg, fileSize);
|
PRUnichar *printfString = nsTextFormatter::smprintf(msg.get(), fileSize);
|
||||||
|
|
||||||
if (printfString)
|
if (printfString)
|
||||||
{
|
{
|
||||||
|
@ -3501,11 +3500,11 @@ nsMsgComposeAndSend::DeliverFileAsMail()
|
||||||
|
|
||||||
if (!buf)
|
if (!buf)
|
||||||
{
|
{
|
||||||
nsXPIDLString eMsg;
|
nsString eMsg;
|
||||||
mComposeBundle->GetStringByID(NS_ERROR_OUT_OF_MEMORY, getter_Copies(eMsg));
|
mComposeBundle->GetStringByID(NS_ERROR_OUT_OF_MEMORY, getter_Copies(eMsg));
|
||||||
|
|
||||||
nsresult ignoreMe;
|
nsresult ignoreMe;
|
||||||
Fail(NS_ERROR_OUT_OF_MEMORY, eMsg, &ignoreMe);
|
Fail(NS_ERROR_OUT_OF_MEMORY, eMsg.get(), &ignoreMe);
|
||||||
NotifyListenerOnStopSending(nsnull, NS_ERROR_OUT_OF_MEMORY, nsnull, nsnull);
|
NotifyListenerOnStopSending(nsnull, NS_ERROR_OUT_OF_MEMORY, nsnull, nsnull);
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -3614,9 +3613,9 @@ nsMsgComposeAndSend::DeliverFileAsMail()
|
||||||
GetNotificationCallbacks(getter_AddRefs(callbacks));
|
GetNotificationCallbacks(getter_AddRefs(callbacks));
|
||||||
|
|
||||||
// Tell the user we are sending the message!
|
// Tell the user we are sending the message!
|
||||||
nsXPIDLString msg;
|
nsString msg;
|
||||||
mComposeBundle->GetStringByID(NS_MSG_SENDING_MESSAGE, getter_Copies(msg));
|
mComposeBundle->GetStringByID(NS_MSG_SENDING_MESSAGE, getter_Copies(msg));
|
||||||
SetStatusMessage( msg );
|
SetStatusMessage(msg);
|
||||||
nsCOMPtr<nsIMsgStatusFeedback> msgStatus (do_QueryInterface(mSendProgress));
|
nsCOMPtr<nsIMsgStatusFeedback> msgStatus (do_QueryInterface(mSendProgress));
|
||||||
// if the sendProgress isn't set, let's use the member variable.
|
// if the sendProgress isn't set, let's use the member variable.
|
||||||
if (!msgStatus)
|
if (!msgStatus)
|
||||||
|
@ -3657,9 +3656,9 @@ nsMsgComposeAndSend::DeliverFileAsNews()
|
||||||
// using callbacks for notification
|
// using callbacks for notification
|
||||||
|
|
||||||
// Tell the user we are posting the message!
|
// Tell the user we are posting the message!
|
||||||
nsXPIDLString msg;
|
nsString msg;
|
||||||
mComposeBundle->GetStringByID(NS_MSG_POSTING_MESSAGE, getter_Copies(msg));
|
mComposeBundle->GetStringByID(NS_MSG_POSTING_MESSAGE, getter_Copies(msg));
|
||||||
SetStatusMessage( msg );
|
SetStatusMessage(msg);
|
||||||
|
|
||||||
nsCOMPtr <nsIMsgMailSession> mailSession = do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
|
nsCOMPtr <nsIMsgMailSession> mailSession = do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
@ -3733,14 +3732,14 @@ nsMsgComposeAndSend::FormatStringWithSMTPHostNameByID(PRInt32 aMsgId, PRUnichar
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
// Get the smtp hostname and format the string.
|
// Get the smtp hostname and format the string.
|
||||||
nsXPIDLCString smtpHostName;
|
nsCString smtpHostName;
|
||||||
nsCOMPtr<nsISmtpServer> smtpServer;
|
nsCOMPtr<nsISmtpServer> smtpServer;
|
||||||
rv = smtpService->GetSmtpServerByIdentity(mUserIdentity, getter_AddRefs(smtpServer));
|
rv = smtpService->GetSmtpServerByIdentity(mUserIdentity, getter_AddRefs(smtpServer));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
smtpServer->GetHostname(getter_Copies(smtpHostName));
|
smtpServer->GetHostname(getter_Copies(smtpHostName));
|
||||||
|
|
||||||
nsAutoString hostStr;
|
nsAutoString hostStr;
|
||||||
hostStr.AssignWithConversion(smtpHostName.get());
|
CopyASCIItoUTF16(smtpHostName, hostStr);
|
||||||
const PRUnichar *params[] = { hostStr.get() };
|
const PRUnichar *params[] = { hostStr.get() };
|
||||||
nsCOMPtr<nsIStringBundle> bundle;
|
nsCOMPtr<nsIStringBundle> bundle;
|
||||||
rv = mComposeBundle->GetBundle(getter_AddRefs(bundle));
|
rv = mComposeBundle->GetBundle(getter_AddRefs(bundle));
|
||||||
|
@ -3760,7 +3759,7 @@ nsMsgComposeAndSend::DoDeliveryExitProcessing(nsIURI * aUri, nsresult aExitCode,
|
||||||
printf("\nMessage Delivery Failed!\n");
|
printf("\nMessage Delivery Failed!\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsXPIDLString eMsg;
|
nsString eMsg;
|
||||||
if (aExitCode == NS_ERROR_SMTP_SEND_FAILED ||
|
if (aExitCode == NS_ERROR_SMTP_SEND_FAILED ||
|
||||||
aExitCode == NS_ERROR_COULD_NOT_LOGIN_TO_SMTP_SERVER ||
|
aExitCode == NS_ERROR_COULD_NOT_LOGIN_TO_SMTP_SERVER ||
|
||||||
aExitCode == NS_ERROR_COULD_NOT_LOGIN_TO_SMTP_SERVER_WITH_STARTTLS1 ||
|
aExitCode == NS_ERROR_COULD_NOT_LOGIN_TO_SMTP_SERVER_WITH_STARTTLS1 ||
|
||||||
|
@ -3769,7 +3768,7 @@ nsMsgComposeAndSend::DoDeliveryExitProcessing(nsIURI * aUri, nsresult aExitCode,
|
||||||
else
|
else
|
||||||
mComposeBundle->GetStringByID(aExitCode, getter_Copies(eMsg));
|
mComposeBundle->GetStringByID(aExitCode, getter_Copies(eMsg));
|
||||||
|
|
||||||
Fail(aExitCode, eMsg, &aExitCode);
|
Fail(aExitCode, eMsg.get(), &aExitCode);
|
||||||
NotifyListenerOnStopSending(nsnull, aExitCode, nsnull, nsnull);
|
NotifyListenerOnStopSending(nsnull, aExitCode, nsnull, nsnull);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4022,14 +4021,14 @@ nsMsgComposeAndSend::NotifyListenerOnStopCopy(nsresult aStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set a status message...
|
// Set a status message...
|
||||||
nsXPIDLString msg;
|
nsString msg;
|
||||||
|
|
||||||
if (NS_SUCCEEDED(aStatus))
|
if (NS_SUCCEEDED(aStatus))
|
||||||
mComposeBundle->GetStringByID(NS_MSG_START_COPY_MESSAGE_COMPLETE, getter_Copies(msg));
|
mComposeBundle->GetStringByID(NS_MSG_START_COPY_MESSAGE_COMPLETE, getter_Copies(msg));
|
||||||
else
|
else
|
||||||
mComposeBundle->GetStringByID(NS_MSG_START_COPY_MESSAGE_FAILED, getter_Copies(msg));
|
mComposeBundle->GetStringByID(NS_MSG_START_COPY_MESSAGE_FAILED, getter_Copies(msg));
|
||||||
|
|
||||||
SetStatusMessage( msg );
|
SetStatusMessage(msg);
|
||||||
nsCOMPtr<nsIPrompt> prompt;
|
nsCOMPtr<nsIPrompt> prompt;
|
||||||
GetDefaultPrompt(getter_AddRefs(prompt));
|
GetDefaultPrompt(getter_AddRefs(prompt));
|
||||||
|
|
||||||
|
@ -4499,7 +4498,7 @@ nsMsgComposeAndSend::MimeDoFCC(nsIFile *input_file,
|
||||||
printfString = nsTextFormatter::smprintf(msg.get(), "?");
|
printfString = nsTextFormatter::smprintf(msg.get(), "?");
|
||||||
if (printfString)
|
if (printfString)
|
||||||
{
|
{
|
||||||
SetStatusMessage(printfString);
|
SetStatusMessage(nsDependentString(printfString));
|
||||||
PR_Free(printfString);
|
PR_Free(printfString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4876,10 +4875,10 @@ nsMsgComposeAndSend::StartMessageCopyOperation(nsIFile *aFile,
|
||||||
//I'm getting this each time without holding onto the feedback so that 3 pane windows can be closed
|
//I'm getting this each time without holding onto the feedback so that 3 pane windows can be closed
|
||||||
//without any chance of crashing due to holding onto a deleted feedback.
|
//without any chance of crashing due to holding onto a deleted feedback.
|
||||||
nsresult
|
nsresult
|
||||||
nsMsgComposeAndSend::SetStatusMessage(const PRUnichar *aMsgString)
|
nsMsgComposeAndSend::SetStatusMessage(const nsString &aMsgString)
|
||||||
{
|
{
|
||||||
if (mSendProgress)
|
if (mSendProgress)
|
||||||
mSendProgress->OnStatusChange(nsnull, nsnull, 0, aMsgString);
|
mSendProgress->OnStatusChange(nsnull, nsnull, 0, aMsgString.get());
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ public:
|
||||||
// For part processing
|
// For part processing
|
||||||
|
|
||||||
NS_DECL_NSIMSGSEND
|
NS_DECL_NSIMSGSEND
|
||||||
nsresult SetStatusMessage(const PRUnichar *aMsgString); // Status message method
|
nsresult SetStatusMessage(const nsString &aMsgString); // Status message method
|
||||||
|
|
||||||
//
|
//
|
||||||
// All vars necessary for this implementation
|
// All vars necessary for this implementation
|
||||||
|
|
|
@ -62,7 +62,6 @@
|
||||||
#include "nsIMsgSendLaterListener.h"
|
#include "nsIMsgSendLaterListener.h"
|
||||||
#include "nsMsgCopy.h"
|
#include "nsMsgCopy.h"
|
||||||
#include "nsMsgComposeStringBundle.h"
|
#include "nsMsgComposeStringBundle.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsIPrompt.h"
|
#include "nsIPrompt.h"
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
#include "nsISmtpUrl.h"
|
#include "nsISmtpUrl.h"
|
||||||
|
@ -475,8 +474,8 @@ nsMsgSendLater::CompleteMailFileSend()
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
// Get the recipients...
|
// Get the recipients...
|
||||||
nsXPIDLCString recips;
|
nsCString recips;
|
||||||
nsXPIDLCString ccList;
|
nsCString ccList;
|
||||||
if (NS_FAILED(mMessage->GetRecipients(getter_Copies(recips))))
|
if (NS_FAILED(mMessage->GetRecipients(getter_Copies(recips))))
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
else
|
else
|
||||||
|
@ -494,12 +493,12 @@ nsMsgSendLater::CompleteMailFileSend()
|
||||||
// Since we have already parsed all of the headers, we are simply going to
|
// Since we have already parsed all of the headers, we are simply going to
|
||||||
// set the composition fields and move on.
|
// set the composition fields and move on.
|
||||||
//
|
//
|
||||||
nsXPIDLCString author;
|
nsCString author;
|
||||||
mMessage->GetAuthor(getter_Copies(author));
|
mMessage->GetAuthor(getter_Copies(author));
|
||||||
|
|
||||||
nsMsgCompFields * fields = (nsMsgCompFields *)compFields.get();
|
nsMsgCompFields * fields = (nsMsgCompFields *)compFields.get();
|
||||||
|
|
||||||
nsXPIDLCString decodedString;
|
nsCString decodedString;
|
||||||
// decoded string is null if the input is not MIME encoded
|
// decoded string is null if the input is not MIME encoded
|
||||||
mimeConverter->DecodeMimeHeader(author.get(), getter_Copies(decodedString));
|
mimeConverter->DecodeMimeHeader(author.get(), getter_Copies(decodedString));
|
||||||
|
|
||||||
|
@ -706,21 +705,18 @@ nsresult nsMsgSendLater::SetOrigMsgDisposition()
|
||||||
// and see if we need to set replied/forwarded
|
// and see if we need to set replied/forwarded
|
||||||
// flags for the original message that this message might be a reply to
|
// flags for the original message that this message might be a reply to
|
||||||
// or forward of.
|
// or forward of.
|
||||||
nsXPIDLCString originalMsgURIs;
|
nsCString originalMsgURIs;
|
||||||
nsXPIDLCString queuedDisposition;
|
nsCString queuedDisposition;
|
||||||
mMessage->GetStringProperty(ORIG_URI_PROPERTY, getter_Copies(originalMsgURIs));
|
mMessage->GetStringProperty(ORIG_URI_PROPERTY, getter_Copies(originalMsgURIs));
|
||||||
mMessage->GetStringProperty(QUEUED_DISPOSITION_PROPERTY, getter_Copies(queuedDisposition));
|
mMessage->GetStringProperty(QUEUED_DISPOSITION_PROPERTY, getter_Copies(queuedDisposition));
|
||||||
if (!queuedDisposition.IsEmpty())
|
if (!queuedDisposition.IsEmpty())
|
||||||
{
|
{
|
||||||
char *uriList = PL_strdup(originalMsgURIs.get());
|
nsCStringArray uriArray;
|
||||||
if (!uriList)
|
uriArray.ParseString(originalMsgURIs.get(), ",");
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
for (PRInt32 i = 0; i < uriArray.Count(); i++)
|
||||||
char *newStr = uriList;
|
|
||||||
char *uri;
|
|
||||||
while (nsnull != (uri = nsCRT::strtok(newStr, ",", &newStr)))
|
|
||||||
{
|
{
|
||||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||||
nsresult rv = GetMsgDBHdrFromURI(uri, getter_AddRefs(msgHdr));
|
nsresult rv = GetMsgDBHdrFromURI(uriArray[i]->get(), getter_AddRefs(msgHdr));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
if (msgHdr)
|
if (msgHdr)
|
||||||
{
|
{
|
||||||
|
@ -737,7 +733,6 @@ nsresult nsMsgSendLater::SetOrigMsgDisposition()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PR_Free(uriList);
|
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,9 +219,9 @@ NS_IMETHODIMP nsMsgSendReport::SetMessage(PRInt32 process, const PRUnichar *mess
|
||||||
if (!mProcessReport[process])
|
if (!mProcessReport[process])
|
||||||
return NS_ERROR_NOT_INITIALIZED;
|
return NS_ERROR_NOT_INITIALIZED;
|
||||||
|
|
||||||
nsXPIDLString currMessage;
|
nsString currMessage;
|
||||||
mProcessReport[process]->GetMessage(getter_Copies(currMessage));
|
mProcessReport[process]->GetMessage(getter_Copies(currMessage));
|
||||||
if (overwriteMessage || (!currMessage) || (const char *)currMessage[0] == 0)
|
if (overwriteMessage || currMessage.IsEmpty())
|
||||||
return mProcessReport[process]->SetMessage(message);
|
return mProcessReport[process]->SetMessage(message);
|
||||||
else
|
else
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -237,8 +237,7 @@ NS_IMETHODIMP nsMsgSendReport::GetProcessReport(PRInt32 process, nsIMsgProcessRe
|
||||||
if (process == process_Current)
|
if (process == process_Current)
|
||||||
process = mCurrentProcess;
|
process = mCurrentProcess;
|
||||||
|
|
||||||
*_retval = mProcessReport[process];
|
NS_IF_ADDREF(*_retval = mProcessReport[process]);
|
||||||
NS_IF_ADDREF(*_retval);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +256,7 @@ NS_IMETHODIMP nsMsgSendReport::DisplayReport(nsIPrompt *prompt, PRBool showError
|
||||||
if (showErrorOnly && NS_SUCCEEDED(currError))
|
if (showErrorOnly && NS_SUCCEEDED(currError))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
nsXPIDLString currMessage;
|
nsString currMessage;
|
||||||
mProcessReport[mCurrentProcess]->GetMessage(getter_Copies(currMessage));
|
mProcessReport[mCurrentProcess]->GetMessage(getter_Copies(currMessage));
|
||||||
|
|
||||||
|
|
||||||
|
@ -269,8 +268,8 @@ NS_IMETHODIMP nsMsgSendReport::DisplayReport(nsIPrompt *prompt, PRBool showError
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsXPIDLString dialogTitle;
|
nsString dialogTitle;
|
||||||
nsXPIDLString dialogMessage;
|
nsString dialogMessage;
|
||||||
|
|
||||||
if (NS_SUCCEEDED(currError))
|
if (NS_SUCCEEDED(currError))
|
||||||
{
|
{
|
||||||
|
@ -360,34 +359,29 @@ NS_IMETHODIMP nsMsgSendReport::DisplayReport(nsIPrompt *prompt, PRBool showError
|
||||||
|
|
||||||
if (!currMessage.IsEmpty())
|
if (!currMessage.IsEmpty())
|
||||||
{
|
{
|
||||||
nsAutoString temp((const PRUnichar *)dialogMessage); // Because of bug 74726, we cannot use directly an XPIDLString
|
|
||||||
|
|
||||||
//Don't need to repeat ourself!
|
//Don't need to repeat ourself!
|
||||||
if (! currMessage.Equals(temp))
|
if (!currMessage.Equals(dialogMessage))
|
||||||
{
|
{
|
||||||
if (! dialogMessage.IsEmpty())
|
if (!dialogMessage.IsEmpty())
|
||||||
temp.AppendLiteral("\n");
|
dialogMessage.Append(PRUnichar('\n'));
|
||||||
temp.Append(currMessage);
|
dialogMessage.Append(currMessage);
|
||||||
dialogMessage.Assign(temp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (askToGoBackToCompose)
|
if (askToGoBackToCompose)
|
||||||
{
|
{
|
||||||
PRBool oopsGiveMeBackTheComposeWindow = PR_TRUE;
|
PRBool oopsGiveMeBackTheComposeWindow = PR_TRUE;
|
||||||
nsXPIDLString text1;
|
nsString text1;
|
||||||
composebundle->GetStringByID(NS_MSG_ASK_TO_COMEBACK_TO_COMPOSE, getter_Copies(text1));
|
composebundle->GetStringByID(NS_MSG_ASK_TO_COMEBACK_TO_COMPOSE, getter_Copies(text1));
|
||||||
nsAutoString temp((const PRUnichar *)dialogMessage); // Because of bug 74726, we cannot use directly an XPIDLString
|
|
||||||
if (! dialogMessage.IsEmpty())
|
if (! dialogMessage.IsEmpty())
|
||||||
temp.AppendLiteral("\n");
|
dialogMessage.AppendLiteral("\n");
|
||||||
temp.Append(text1);
|
dialogMessage.Append(text1);
|
||||||
dialogMessage.Assign(temp);
|
nsMsgAskBooleanQuestionByString(prompt, dialogMessage.get(), &oopsGiveMeBackTheComposeWindow, dialogTitle.get());
|
||||||
nsMsgAskBooleanQuestionByString(prompt, dialogMessage, &oopsGiveMeBackTheComposeWindow, dialogTitle);
|
|
||||||
if (!oopsGiveMeBackTheComposeWindow)
|
if (!oopsGiveMeBackTheComposeWindow)
|
||||||
*_retval = NS_OK;
|
*_retval = NS_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nsMsgDisplayMessageByString(prompt, dialogMessage, dialogTitle);
|
nsMsgDisplayMessageByString(prompt, dialogMessage.get(), dialogTitle.get());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -431,14 +425,12 @@ NS_IMETHODIMP nsMsgSendReport::DisplayReport(nsIPrompt *prompt, PRBool showError
|
||||||
|
|
||||||
if (!currMessage.IsEmpty())
|
if (!currMessage.IsEmpty())
|
||||||
{
|
{
|
||||||
nsAutoString temp((const PRUnichar *)dialogMessage); // Because of bug 74726, we cannot use directly an XPIDLString
|
|
||||||
if (! dialogMessage.IsEmpty())
|
if (! dialogMessage.IsEmpty())
|
||||||
temp.AppendLiteral("\n");
|
dialogMessage.AppendLiteral("\n");
|
||||||
temp.Append(currMessage);
|
dialogMessage.Append(currMessage);
|
||||||
dialogMessage.Assign(temp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsMsgDisplayMessageByString(prompt, dialogMessage, dialogTitle);
|
nsMsgDisplayMessageByString(prompt, dialogMessage.get(), dialogTitle.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
mAlreadyDisplayReport = PR_TRUE;
|
mAlreadyDisplayReport = PR_TRUE;
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsEnumeratorUtils.h"
|
#include "nsEnumeratorUtils.h"
|
||||||
#include "nsRDFCID.h"
|
#include "nsRDFCID.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
|
@ -118,7 +117,7 @@ nsSmtpDataSource::initGlobalObjects()
|
||||||
/* readonly attribute string URI; */
|
/* readonly attribute string URI; */
|
||||||
NS_IMETHODIMP nsSmtpDataSource::GetURI(char * *aURI)
|
NS_IMETHODIMP nsSmtpDataSource::GetURI(char * *aURI)
|
||||||
{
|
{
|
||||||
*aURI = nsCRT::strdup("NC:smtpservers");
|
*aURI = strdup("NC:smtpservers");
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +140,7 @@ nsSmtpDataSource::GetTarget(nsIRDFResource *aSource,
|
||||||
PRBool aTruthValue, nsIRDFNode **aResult)
|
PRBool aTruthValue, nsIRDFNode **aResult)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsXPIDLCString str;
|
nsCString str;
|
||||||
|
|
||||||
*aResult = nsnull;
|
*aResult = nsnull;
|
||||||
|
|
||||||
|
@ -166,7 +165,7 @@ nsSmtpDataSource::GetTarget(nsIRDFResource *aSource,
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsAutoString unicodeString;
|
nsAutoString unicodeString;
|
||||||
unicodeString.AssignWithConversion((const char*)str);
|
CopyASCIItoUTF16(str, unicodeString);
|
||||||
|
|
||||||
nsCOMPtr<nsIRDFLiteral> literalResult;
|
nsCOMPtr<nsIRDFLiteral> literalResult;
|
||||||
rv = rdf->GetLiteral(unicodeString.get(), getter_AddRefs(literalResult));
|
rv = rdf->GetLiteral(unicodeString.get(), getter_AddRefs(literalResult));
|
||||||
|
@ -265,7 +264,7 @@ nsSmtpDataSource::GetSmtpServerTargets(nsISupportsArray **aResultArray)
|
||||||
(void **)getter_AddRefs(smtpServer));
|
(void **)getter_AddRefs(smtpServer));
|
||||||
if (NS_FAILED(rv)) continue;
|
if (NS_FAILED(rv)) continue;
|
||||||
|
|
||||||
nsXPIDLCString smtpServerUri;
|
nsCString smtpServerUri;
|
||||||
rv = smtpServer->GetServerURI(getter_Copies(smtpServerUri));
|
rv = smtpServer->GetServerURI(getter_Copies(smtpServerUri));
|
||||||
if (NS_FAILED(rv)) continue;
|
if (NS_FAILED(rv)) continue;
|
||||||
|
|
||||||
|
@ -276,8 +275,7 @@ nsSmtpDataSource::GetSmtpServerTargets(nsISupportsArray **aResultArray)
|
||||||
rv = smtpServerResources->AppendElement(smtpServerResource);
|
rv = smtpServerResources->AppendElement(smtpServerResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
*aResultArray = smtpServerResources;
|
smtpServerResources.swap(*aResultArray);
|
||||||
NS_ADDREF(*aResultArray);
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,109 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
|
||||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
||||||
* for the specific language governing rights and limitations under the
|
|
||||||
* License.
|
|
||||||
*
|
|
||||||
* The Original Code is mozilla.org code.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Netscape Communications Corporation.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Alec Flett <alecf@netscape.com>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
||||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#include "nsSmtpDelegateFactory.h"
|
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsString.h"
|
|
||||||
#include "nsIServiceManager.h"
|
|
||||||
|
|
||||||
#include "nsIURL.h"
|
|
||||||
#include "nsNetCID.h"
|
|
||||||
|
|
||||||
#include "nsIRDFResource.h"
|
|
||||||
|
|
||||||
#include "nsISmtpServer.h"
|
|
||||||
#include "nsISmtpService.h"
|
|
||||||
#include "nsMsgCompCID.h"
|
|
||||||
#include "nsReadableUtils.h"
|
|
||||||
#include "nsEscape.h"
|
|
||||||
#include "prmem.h"
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(nsSmtpDelegateFactory, nsIRDFDelegateFactory)
|
|
||||||
|
|
||||||
nsSmtpDelegateFactory::nsSmtpDelegateFactory()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
nsSmtpDelegateFactory::~nsSmtpDelegateFactory()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSmtpDelegateFactory::CreateDelegate(nsIRDFResource *aOuter,
|
|
||||||
const char *aKey,
|
|
||||||
const nsIID & aIID, void * *aResult)
|
|
||||||
{
|
|
||||||
nsresult rv;
|
|
||||||
const char* uri;
|
|
||||||
aOuter->GetValueConst(&uri);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIURL> url = do_CreateInstance(NS_STANDARDURL_CONTRACTID, &rv);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
rv = url->SetSpec(nsDependentCString(uri));
|
|
||||||
|
|
||||||
// separate out username, hostname
|
|
||||||
nsCAutoString hostname;
|
|
||||||
nsCAutoString userpass;
|
|
||||||
|
|
||||||
rv = url->GetUserPass(userpass);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
url->GetAsciiHost(hostname);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
nsCOMPtr<nsISmtpService> smtpService = do_GetService(NS_SMTPSERVICE_CONTRACTID, &rv);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
char *unescapedUserPass = ToNewCString(userpass);
|
|
||||||
if (!unescapedUserPass)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
nsUnescape(unescapedUserPass);
|
|
||||||
nsCOMPtr<nsISmtpServer> smtpServer;
|
|
||||||
rv = smtpService->FindServer(unescapedUserPass, hostname.get(), getter_AddRefs(smtpServer));
|
|
||||||
PR_FREEIF(unescapedUserPass);
|
|
||||||
|
|
||||||
// no server, it's a failure!
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
if (!smtpServer) return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
return smtpServer->QueryInterface(aIID, aResult);
|
|
||||||
}
|
|
|
@ -110,7 +110,7 @@ nsresult nsExplainErrorDetails(nsISmtpUrl * aSmtpUrl, int code, ...)
|
||||||
NS_ENSURE_TRUE(dialog, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(dialog, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
PRUnichar * msg;
|
PRUnichar * msg;
|
||||||
nsXPIDLString eMsg;
|
nsString eMsg;
|
||||||
nsCOMPtr<nsIMsgStringService> smtpBundle = do_GetService(NS_MSG_SMTPSTRINGSERVICE_CONTRACTID);
|
nsCOMPtr<nsIMsgStringService> smtpBundle = do_GetService(NS_MSG_SMTPSTRINGSERVICE_CONTRACTID);
|
||||||
|
|
||||||
va_start (args, code);
|
va_start (args, code);
|
||||||
|
@ -128,11 +128,11 @@ nsresult nsExplainErrorDetails(nsISmtpUrl * aSmtpUrl, int code, ...)
|
||||||
case NS_ERROR_SENDING_MESSAGE:
|
case NS_ERROR_SENDING_MESSAGE:
|
||||||
case NS_ERROR_SMTP_GREETING:
|
case NS_ERROR_SMTP_GREETING:
|
||||||
smtpBundle->GetStringByID(code, getter_Copies(eMsg));
|
smtpBundle->GetStringByID(code, getter_Copies(eMsg));
|
||||||
msg = nsTextFormatter::vsmprintf(eMsg, args);
|
msg = nsTextFormatter::vsmprintf(eMsg.get(), args);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
smtpBundle->GetStringByID(NS_ERROR_COMMUNICATIONS_ERROR, getter_Copies(eMsg));
|
smtpBundle->GetStringByID(NS_ERROR_COMMUNICATIONS_ERROR, getter_Copies(eMsg));
|
||||||
msg = nsTextFormatter::smprintf(eMsg, code);
|
msg = nsTextFormatter::smprintf(eMsg.get(), code);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,9 +435,9 @@ void nsSmtpProtocol::UpdateStatus(PRInt32 aStatusID)
|
||||||
{
|
{
|
||||||
if (m_statusFeedback)
|
if (m_statusFeedback)
|
||||||
{
|
{
|
||||||
nsXPIDLString msg;
|
nsString msg;
|
||||||
mSmtpBundle->GetStringByID(aStatusID, getter_Copies(msg));
|
mSmtpBundle->GetStringByID(aStatusID, getter_Copies(msg));
|
||||||
UpdateStatusWithString(msg);
|
UpdateStatusWithString(msg.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1003,8 +1003,8 @@ PRInt32 nsSmtpProtocol::AuthGSSAPIFirst()
|
||||||
nsCAutoString command("AUTH GSSAPI ");
|
nsCAutoString command("AUTH GSSAPI ");
|
||||||
nsCAutoString resp;
|
nsCAutoString resp;
|
||||||
nsCAutoString service("smtp@");
|
nsCAutoString service("smtp@");
|
||||||
nsXPIDLCString hostName;
|
nsCString hostName;
|
||||||
nsXPIDLCString userName;
|
nsCString userName;
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsISmtpServer> smtpServer;
|
nsCOMPtr<nsISmtpServer> smtpServer;
|
||||||
rv = m_runningURL->GetSmtpServer(getter_AddRefs(smtpServer));
|
rv = m_runningURL->GetSmtpServer(getter_AddRefs(smtpServer));
|
||||||
|
@ -1016,7 +1016,7 @@ PRInt32 nsSmtpProtocol::AuthGSSAPIFirst()
|
||||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
service.Append(hostName);
|
service.Append(hostName);
|
||||||
rv = DoGSSAPIStep1(service.get(), userName, resp);
|
rv = DoGSSAPIStep1(service.get(), userName.get(), resp);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
{
|
{
|
||||||
m_nextState = SMTP_AUTH_PROCESS_STATE;
|
m_nextState = SMTP_AUTH_PROCESS_STATE;
|
||||||
|
@ -1088,9 +1088,9 @@ PRInt32 nsSmtpProtocol::AuthLoginStep1()
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
PRInt32 status = 0;
|
PRInt32 status = 0;
|
||||||
nsXPIDLCString username;
|
nsCString username;
|
||||||
char *base64Str = nsnull;
|
char *base64Str = nsnull;
|
||||||
nsXPIDLCString origPassword;
|
nsCString origPassword;
|
||||||
nsCAutoString password;
|
nsCAutoString password;
|
||||||
nsCOMPtr<nsISmtpServer> smtpServer;
|
nsCOMPtr<nsISmtpServer> smtpServer;
|
||||||
rv = m_runningURL->GetSmtpServer(getter_AddRefs(smtpServer));
|
rv = m_runningURL->GetSmtpServer(getter_AddRefs(smtpServer));
|
||||||
|
@ -1133,8 +1133,8 @@ PRInt32 nsSmtpProtocol::AuthLoginStep1()
|
||||||
int len = 1; /* first <NUL> char */
|
int len = 1; /* first <NUL> char */
|
||||||
|
|
||||||
memset(plain_string, 0, 512);
|
memset(plain_string, 0, 512);
|
||||||
PR_snprintf(&plain_string[1], 510, "%s", (const char*)username);
|
PR_snprintf(&plain_string[1], 510, "%s", username.get());
|
||||||
len += PL_strlen(username);
|
len += username.Length();
|
||||||
len++; /* second <NUL> char */
|
len++; /* second <NUL> char */
|
||||||
PR_snprintf(&plain_string[len], 511-len, "%s", password.get());
|
PR_snprintf(&plain_string[len], 511-len, "%s", password.get());
|
||||||
len += password.Length();
|
len += password.Length();
|
||||||
|
@ -1145,8 +1145,8 @@ PRInt32 nsSmtpProtocol::AuthLoginStep1()
|
||||||
else
|
else
|
||||||
if (TestFlag(SMTP_AUTH_LOGIN_ENABLED))
|
if (TestFlag(SMTP_AUTH_LOGIN_ENABLED))
|
||||||
{
|
{
|
||||||
base64Str = PL_Base64Encode((const char *)username,
|
base64Str = PL_Base64Encode(username.get(),
|
||||||
strlen((const char*)username), nsnull);
|
username.Length(), nsnull);
|
||||||
PR_snprintf(buffer, sizeof(buffer), "%.256s" CRLF, base64Str);
|
PR_snprintf(buffer, sizeof(buffer), "%.256s" CRLF, base64Str);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1172,16 +1172,13 @@ PRInt32 nsSmtpProtocol::AuthLoginStep2()
|
||||||
*/
|
*/
|
||||||
PRInt32 status = 0;
|
PRInt32 status = 0;
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsXPIDLCString origPassword;
|
|
||||||
nsCAutoString password;
|
nsCAutoString password;
|
||||||
|
|
||||||
if (!TestFlag(SMTP_USE_LOGIN_REDIRECTION))
|
if (!TestFlag(SMTP_USE_LOGIN_REDIRECTION))
|
||||||
{
|
{
|
||||||
rv = GetPassword(getter_Copies(origPassword));
|
rv = GetPassword(getter_Copies(password));
|
||||||
PRInt32 passwordLength = strlen((const char *) origPassword);
|
if (password.IsEmpty())
|
||||||
if (!(const char*) origPassword || passwordLength == 0)
|
|
||||||
return NS_ERROR_SMTP_PASSWORD_UNDEFINED;
|
return NS_ERROR_SMTP_PASSWORD_UNDEFINED;
|
||||||
password.Assign((const char*) origPassword);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
password.Assign(mLogonCookie);
|
password.Assign(mLogonCookie);
|
||||||
|
@ -1216,7 +1213,7 @@ PRInt32 nsSmtpProtocol::AuthLoginStep2()
|
||||||
rv = m_runningURL->GetSmtpServer(getter_AddRefs(smtpServer));
|
rv = m_runningURL->GetSmtpServer(getter_AddRefs(smtpServer));
|
||||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsXPIDLCString userName;
|
nsCString userName;
|
||||||
rv = smtpServer->GetUsername(getter_Copies(userName));
|
rv = smtpServer->GetUsername(getter_Copies(userName));
|
||||||
|
|
||||||
PR_snprintf(buffer, sizeof(buffer), "%s %s", userName.get(), encodedDigest.get());
|
PR_snprintf(buffer, sizeof(buffer), "%s %s", userName.get(), encodedDigest.get());
|
||||||
|
@ -1554,14 +1551,14 @@ nsresult nsSmtpProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer )
|
||||||
doesn't matter.
|
doesn't matter.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nsXPIDLCString addresses;
|
nsCString addresses;
|
||||||
nsCOMPtr<nsIMsgHeaderParser> parser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID);
|
nsCOMPtr<nsIMsgHeaderParser> parser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID);
|
||||||
|
|
||||||
m_runningURL->GetRecipients(getter_Copies(addresses));
|
m_runningURL->GetRecipients(getter_Copies(addresses));
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && parser)
|
if (NS_SUCCEEDED(rv) && parser)
|
||||||
{
|
{
|
||||||
parser->RemoveDuplicateAddresses(nsnull, addresses, nsnull, PR_FALSE, &addrs1);
|
parser->RemoveDuplicateAddresses(nsnull, addresses.get(), nsnull, PR_FALSE, &addrs1);
|
||||||
|
|
||||||
/* Extract just the mailboxes from the full RFC822 address list.
|
/* Extract just the mailboxes from the full RFC822 address list.
|
||||||
This means that people can post to mailto: URLs which contain
|
This means that people can post to mailto: URLs which contain
|
||||||
|
@ -1800,7 +1797,7 @@ nsSmtpProtocol::GetPassword(char **aPassword)
|
||||||
nsCRT::free(*aPassword);
|
nsCRT::free(*aPassword);
|
||||||
*aPassword = 0;
|
*aPassword = 0;
|
||||||
|
|
||||||
nsXPIDLCString redirectorType;
|
nsCString redirectorType;
|
||||||
rv = smtpServer->GetRedirectorType(getter_Copies(redirectorType));
|
rv = smtpServer->GetRedirectorType(getter_Copies(redirectorType));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
|
@ -1815,7 +1812,7 @@ nsSmtpProtocol::GetPassword(char **aPassword)
|
||||||
rv = prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
|
rv = prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
nsXPIDLCString username;
|
nsCString username;
|
||||||
rv = smtpServer->GetUsername(getter_Copies(username));
|
rv = smtpServer->GetUsername(getter_Copies(username));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
@ -1833,7 +1830,7 @@ nsSmtpProtocol::GetPassword(char **aPassword)
|
||||||
nsAutoString hostnameUTF16;
|
nsAutoString hostnameUTF16;
|
||||||
if (!hideHostnameForPassword)
|
if (!hideHostnameForPassword)
|
||||||
{
|
{
|
||||||
nsXPIDLCString hostname;
|
nsCString hostname;
|
||||||
rv = smtpServer->GetHostname(getter_Copies(hostname));
|
rv = smtpServer->GetHostname(getter_Copies(hostname));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
CopyASCIItoUTF16(hostname, hostnameUTF16);
|
CopyASCIItoUTF16(hostname, hostnameUTF16);
|
||||||
|
@ -1855,7 +1852,7 @@ nsSmtpProtocol::PromptForPassword(nsISmtpServer *aSmtpServer, nsISmtpUrl *aSmtpU
|
||||||
rv = stringService->CreateBundle("chrome://messenger/locale/messengercompose/composeMsgs.properties", getter_AddRefs(composeStringBundle));
|
rv = stringService->CreateBundle("chrome://messenger/locale/messengercompose/composeMsgs.properties", getter_AddRefs(composeStringBundle));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
nsXPIDLString passwordPromptString;
|
nsString passwordPromptString;
|
||||||
if(formatStrings[1])
|
if(formatStrings[1])
|
||||||
rv = composeStringBundle->FormatStringFromID(NS_SMTP_PASSWORD_PROMPT2,
|
rv = composeStringBundle->FormatStringFromID(NS_SMTP_PASSWORD_PROMPT2,
|
||||||
formatStrings, 2,
|
formatStrings, 2,
|
||||||
|
@ -1870,11 +1867,11 @@ nsSmtpProtocol::PromptForPassword(nsISmtpServer *aSmtpServer, nsISmtpUrl *aSmtpU
|
||||||
rv = aSmtpUrl->GetAuthPrompt(getter_AddRefs(netPrompt));
|
rv = aSmtpUrl->GetAuthPrompt(getter_AddRefs(netPrompt));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsXPIDLString passwordTitle;
|
nsString passwordTitle;
|
||||||
rv = composeStringBundle->GetStringFromID(NS_SMTP_PASSWORD_PROMPT_TITLE, getter_Copies(passwordTitle));
|
rv = composeStringBundle->GetStringFromID(NS_SMTP_PASSWORD_PROMPT_TITLE, getter_Copies(passwordTitle));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
rv = aSmtpServer->GetPasswordWithUI(passwordPromptString.get(), passwordTitle,
|
rv = aSmtpServer->GetPasswordWithUI(passwordPromptString.get(), passwordTitle.get(),
|
||||||
netPrompt, aPassword);
|
netPrompt, aPassword);
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -1913,7 +1910,7 @@ nsSmtpProtocol::GetUsernamePassword(char **aUsername, char **aPassword)
|
||||||
nsCRT::free(*aPassword);
|
nsCRT::free(*aPassword);
|
||||||
*aPassword = 0;
|
*aPassword = 0;
|
||||||
|
|
||||||
nsXPIDLCString hostname;
|
nsCString hostname;
|
||||||
rv = smtpServer->GetHostname(getter_Copies(hostname));
|
rv = smtpServer->GetHostname(getter_Copies(hostname));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
@ -1931,40 +1928,38 @@ nsSmtpProtocol::GetUsernamePassword(char **aUsername, char **aPassword)
|
||||||
nsresult nsSmtpProtocol::RequestOverrideInfo(nsISmtpServer * aSmtpServer)
|
nsresult nsSmtpProtocol::RequestOverrideInfo(nsISmtpServer * aSmtpServer)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG(aSmtpServer);
|
NS_ENSURE_ARG(aSmtpServer);
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCAutoString contractID(NS_MSGLOGONREDIRECTORSERVICE_CONTRACTID);
|
nsCAutoString contractID(NS_MSGLOGONREDIRECTORSERVICE_CONTRACTID);
|
||||||
|
|
||||||
// go get the redirection type...
|
// go get the redirection type...
|
||||||
nsXPIDLCString redirectionTypeStr;
|
nsCString redirectionTypeStr;
|
||||||
aSmtpServer->GetRedirectorType(getter_Copies(redirectionTypeStr));
|
aSmtpServer->GetRedirectorType(getter_Copies(redirectionTypeStr));
|
||||||
|
|
||||||
const char * redirectionType = (const char *) redirectionTypeStr;
|
|
||||||
|
|
||||||
// if we don't have a redirection type, then get out and proceed normally.
|
// if we don't have a redirection type, then get out and proceed normally.
|
||||||
if (!redirectionType || !*redirectionType )
|
if (redirectionTypeStr.IsEmpty())
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
contractID.Append('/');
|
contractID.Append('/');
|
||||||
contractID.Append(redirectionTypeStr);
|
contractID.Append(redirectionTypeStr);
|
||||||
|
|
||||||
m_logonRedirector = do_GetService(contractID.get(), &rv);
|
m_logonRedirector = do_GetService(contractID.get(), &rv);
|
||||||
if (m_logonRedirector && NS_SUCCEEDED(rv))
|
if (m_logonRedirector && NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsXPIDLCString password;
|
nsCString password;
|
||||||
nsXPIDLCString userName;
|
nsCString userName;
|
||||||
PRBool requiresPassword = PR_TRUE;
|
PRBool requiresPassword = PR_TRUE;
|
||||||
|
|
||||||
aSmtpServer->GetUsername(getter_Copies(userName));
|
aSmtpServer->GetUsername(getter_Copies(userName));
|
||||||
m_logonRedirector->RequiresPassword(userName, redirectionTypeStr.get(), &requiresPassword);
|
m_logonRedirector->RequiresPassword(userName.get(), redirectionTypeStr.get(), &requiresPassword);
|
||||||
if (requiresPassword)
|
if (requiresPassword)
|
||||||
GetPassword(getter_Copies(password));
|
GetPassword(getter_Copies(password));
|
||||||
|
|
||||||
nsCOMPtr<nsIPrompt> prompter;
|
nsCOMPtr<nsIPrompt> prompter;
|
||||||
m_runningURL->GetPrompt(getter_AddRefs(prompter));
|
m_runningURL->GetPrompt(getter_AddRefs(prompter));
|
||||||
rv = m_logonRedirector->Logon(userName, password, redirectionType, prompter, NS_STATIC_CAST(nsIMsgLogonRedirectionRequester *, this), nsMsgLogonRedirectionServiceIDs::Smtp);
|
rv = m_logonRedirector->Logon(userName.get(), password.get(), redirectionTypeStr.get(), prompter, NS_STATIC_CAST(nsIMsgLogonRedirectionRequester *, this), nsMsgLogonRedirectionServiceIDs::Smtp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this protocol instance now needs to wait until
|
// this protocol instance now needs to wait until
|
||||||
// we receive the login redirection information so set the appropriate state
|
// we receive the login redirection information so set the appropriate state
|
||||||
// flag
|
// flag
|
||||||
|
@ -1976,11 +1971,11 @@ nsresult nsSmtpProtocol::RequestOverrideInfo(nsISmtpServer * aSmtpServer)
|
||||||
// information. So start the url as being run.
|
// information. So start the url as being run.
|
||||||
nsCOMPtr <nsIMsgMailNewsUrl> mailNewsUrl = do_QueryInterface(m_runningURL);
|
nsCOMPtr <nsIMsgMailNewsUrl> mailNewsUrl = do_QueryInterface(m_runningURL);
|
||||||
// this will cause another dialog to get thrown up....
|
// this will cause another dialog to get thrown up....
|
||||||
mailNewsUrl->SetUrlState(PR_TRUE /* start running url */, NS_OK);
|
mailNewsUrl->SetUrlState(PR_TRUE /* start running url */, NS_OK);
|
||||||
UpdateStatus(NS_SMTP_CONNECTING_TO_SERVER);
|
UpdateStatus(NS_SMTP_CONNECTING_TO_SERVER);
|
||||||
// and update the status
|
// and update the status
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsSmtpProtocol::OnLogonRedirectionError(const PRUnichar *pErrMsg, PRBool aBadPassword)
|
NS_IMETHODIMP nsSmtpProtocol::OnLogonRedirectionError(const PRUnichar *pErrMsg, PRBool aBadPassword)
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
|
|
||||||
#include "nsMsgProtocol.h"
|
#include "nsMsgProtocol.h"
|
||||||
#include "nsIStreamListener.h"
|
#include "nsIStreamListener.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsISmtpUrl.h"
|
#include "nsISmtpUrl.h"
|
||||||
#include "nsIMsgStatusFeedback.h"
|
#include "nsIMsgStatusFeedback.h"
|
||||||
#include "nsIMsgLogonRedirector.h"
|
#include "nsIMsgLogonRedirector.h"
|
||||||
|
@ -180,8 +179,8 @@ private:
|
||||||
char *m_addresses;
|
char *m_addresses;
|
||||||
PRUint32 m_addressesLeft;
|
PRUint32 m_addressesLeft;
|
||||||
char *m_verifyAddress;
|
char *m_verifyAddress;
|
||||||
nsXPIDLCString m_mailAddr;
|
nsCString m_mailAddr;
|
||||||
nsXPIDLCString m_helloArgument;
|
nsCString m_helloArgument;
|
||||||
PRInt32 m_sizelimit;
|
PRInt32 m_sizelimit;
|
||||||
|
|
||||||
// *** the following should move to the smtp server when we support
|
// *** the following should move to the smtp server when we support
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "nsIAuthPrompt.h"
|
#include "nsIAuthPrompt.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsISmtpUrl.h"
|
#include "nsISmtpUrl.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
|
@ -139,7 +138,7 @@ nsSmtpServer::SetHostname(const char * aHostname)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSmtpServer::GetDescription(nsACString &aDescription)
|
nsSmtpServer::GetDescription(nsACString &aDescription)
|
||||||
{
|
{
|
||||||
nsXPIDLCString temp;
|
nsCString temp;
|
||||||
mPrefBranch->GetCharPref("description", getter_Copies(temp));
|
mPrefBranch->GetCharPref("description", getter_Copies(temp));
|
||||||
aDescription.Assign(temp);
|
aDescription.Assign(temp);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -183,7 +182,7 @@ nsSmtpServer::GetDisplayname(char * *aDisplayname)
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
NS_ENSURE_ARG_POINTER(aDisplayname);
|
NS_ENSURE_ARG_POINTER(aDisplayname);
|
||||||
|
|
||||||
nsXPIDLCString hostname;
|
nsCString hostname;
|
||||||
rv = mPrefBranch->GetCharPref("hostname", getter_Copies(hostname));
|
rv = mPrefBranch->GetCharPref("hostname", getter_Copies(hostname));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
*aDisplayname=nsnull;
|
*aDisplayname=nsnull;
|
||||||
|
@ -421,9 +420,9 @@ nsSmtpServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
|
||||||
// prompt the user for the password
|
// prompt the user for the password
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsXPIDLString uniPassword;
|
nsString uniPassword;
|
||||||
PRBool okayValue = PR_TRUE;
|
PRBool okayValue = PR_TRUE;
|
||||||
nsXPIDLCString serverUri;
|
nsCString serverUri;
|
||||||
rv = GetServerURI(getter_Copies(serverUri));
|
rv = GetServerURI(getter_Copies(serverUri));
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -446,7 +445,7 @@ nsSmtpServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
|
||||||
}
|
}
|
||||||
|
|
||||||
// we got a password back...so remember it
|
// we got a password back...so remember it
|
||||||
nsCString aCStr; aCStr.AssignWithConversion(uniPassword);
|
nsCString aCStr; LossyCopyUTF16toASCII(uniPassword, aCStr);
|
||||||
|
|
||||||
rv = SetPassword(aCStr.get());
|
rv = SetPassword(aCStr.get());
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
|
@ -475,10 +474,10 @@ nsSmtpServer::GetUsernamePasswordWithUI(const PRUnichar * aPromptMessage, const
|
||||||
// prompt the user for the password
|
// prompt the user for the password
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsXPIDLString uniUsername;
|
nsString uniUsername;
|
||||||
nsXPIDLString uniPassword;
|
nsString uniPassword;
|
||||||
PRBool okayValue = PR_TRUE;
|
PRBool okayValue = PR_TRUE;
|
||||||
nsXPIDLCString serverUri;
|
nsCString serverUri;
|
||||||
rv = GetServerURI(getter_Copies(serverUri));
|
rv = GetServerURI(getter_Copies(serverUri));
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -498,12 +497,12 @@ nsSmtpServer::GetUsernamePasswordWithUI(const PRUnichar * aPromptMessage, const
|
||||||
// we got a userid and password back...so remember it
|
// we got a userid and password back...so remember it
|
||||||
nsCString aCStr;
|
nsCString aCStr;
|
||||||
|
|
||||||
aCStr.AssignWithConversion(uniUsername);
|
LossyCopyUTF16toASCII(uniUsername, aCStr);
|
||||||
rv = SetUsername(aCStr.get());
|
rv = SetUsername(aCStr.get());
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
aCStr.AssignWithConversion(uniPassword);
|
LossyCopyUTF16toASCII(uniPassword, aCStr);
|
||||||
rv = SetPassword(aCStr.get());
|
rv = SetPassword(aCStr.get());
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -524,7 +523,7 @@ nsSmtpServer::ForgetPassword()
|
||||||
nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1", &rv);
|
nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
nsXPIDLCString serverUri;
|
nsCString serverUri;
|
||||||
rv = GetServerURI(getter_Copies(serverUri));
|
rv = GetServerURI(getter_Copies(serverUri));
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -554,26 +553,26 @@ nsSmtpServer::GetServerURI(char **aResult)
|
||||||
uri += "smtp";
|
uri += "smtp";
|
||||||
uri += "://";
|
uri += "://";
|
||||||
|
|
||||||
nsXPIDLCString username;
|
nsCString username;
|
||||||
rv = GetUsername(getter_Copies(username));
|
rv = GetUsername(getter_Copies(username));
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && ((const char*)username) && username[0]) {
|
if (NS_SUCCEEDED(rv) && !username.IsEmpty()) {
|
||||||
nsXPIDLCString escapedUsername;
|
nsCString escapedUsername;
|
||||||
*((char **)getter_Copies(escapedUsername)) =
|
*((char **)getter_Copies(escapedUsername)) =
|
||||||
nsEscape(username, url_XAlphas);
|
nsEscape(username.get(), url_XAlphas);
|
||||||
// nsEscape(username, url_Path);
|
// nsEscape(username, url_Path);
|
||||||
// not all servers have a username
|
// not all servers have a username
|
||||||
uri.Append(escapedUsername);
|
uri.Append(escapedUsername);
|
||||||
uri += '@';
|
uri += '@';
|
||||||
}
|
}
|
||||||
|
|
||||||
nsXPIDLCString hostname;
|
nsCString hostname;
|
||||||
rv = GetHostname(getter_Copies(hostname));
|
rv = GetHostname(getter_Copies(hostname));
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && ((const char*)hostname) && hostname[0]) {
|
if (NS_SUCCEEDED(rv) && !hostname.IsEmpty()) {
|
||||||
nsXPIDLCString escapedHostname;
|
nsCString escapedHostname;
|
||||||
*((char **)getter_Copies(escapedHostname)) =
|
*((char **)getter_Copies(escapedHostname)) =
|
||||||
nsEscape(hostname, url_Path);
|
nsEscape(hostname.get(), url_Path);
|
||||||
// not all servers have a hostname
|
// not all servers have a hostname
|
||||||
uri.Append(escapedHostname);
|
uri.Append(escapedHostname);
|
||||||
}
|
}
|
||||||
|
@ -606,9 +605,9 @@ nsSmtpServer::GetRedirectorType(char **aResult)
|
||||||
{
|
{
|
||||||
if (!nsCRT::strcasecmp(*aResult, "aol"))
|
if (!nsCRT::strcasecmp(*aResult, "aol"))
|
||||||
{
|
{
|
||||||
nsXPIDLCString hostName;
|
nsCString hostName;
|
||||||
rv = GetHostname(getter_Copies(hostName));
|
rv = GetHostname(getter_Copies(hostName));
|
||||||
if (NS_SUCCEEDED(rv) && (hostName.get()) && !nsCRT::strcmp(hostName, "smtp.netscape.net"))
|
if (NS_SUCCEEDED(rv) && hostName.LowerCaseEqualsLiteral("smtp.netscape.net"))
|
||||||
{
|
{
|
||||||
PL_strfree(*aResult);
|
PL_strfree(*aResult);
|
||||||
rv = SetRedirectorType("netscape");
|
rv = SetRedirectorType("netscape");
|
||||||
|
@ -622,7 +621,7 @@ nsSmtpServer::GetRedirectorType(char **aResult)
|
||||||
// created redirected accounts as regular imap accounts,
|
// created redirected accounts as regular imap accounts,
|
||||||
// they won't have redirector type set properly
|
// they won't have redirector type set properly
|
||||||
// this fixes the redirector type for them automatically
|
// this fixes the redirector type for them automatically
|
||||||
nsXPIDLCString hostName;
|
nsCString hostName;
|
||||||
rv = GetHostname(getter_Copies(hostName));
|
rv = GetHostname(getter_Copies(hostName));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
|
@ -632,7 +631,7 @@ nsSmtpServer::GetRedirectorType(char **aResult)
|
||||||
|
|
||||||
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
nsXPIDLCString defaultRedirectorType;
|
nsCString defaultRedirectorType;
|
||||||
rv = prefBranch->GetCharPref(prefName.get(), getter_Copies(defaultRedirectorType));
|
rv = prefBranch->GetCharPref(prefName.get(), getter_Copies(defaultRedirectorType));
|
||||||
if (NS_SUCCEEDED(rv) && !defaultRedirectorType.IsEmpty())
|
if (NS_SUCCEEDED(rv) && !defaultRedirectorType.IsEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include "msgCore.h" // precompiled header...
|
#include "msgCore.h" // precompiled header...
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsIPrefService.h"
|
#include "nsIPrefService.h"
|
||||||
#include "nsIPrefBranch.h"
|
#include "nsIPrefBranch.h"
|
||||||
|
@ -76,8 +75,8 @@ typedef struct _findServerByKeyEntry {
|
||||||
} findServerByKeyEntry;
|
} findServerByKeyEntry;
|
||||||
|
|
||||||
typedef struct _findServerByHostnameEntry {
|
typedef struct _findServerByHostnameEntry {
|
||||||
const char *hostname;
|
nsCString hostname;
|
||||||
const char *username;
|
nsCString username;
|
||||||
nsISmtpServer *server;
|
nsISmtpServer *server;
|
||||||
} findServerByHostnameEntry;
|
} findServerByHostnameEntry;
|
||||||
|
|
||||||
|
@ -135,8 +134,8 @@ nsresult nsSmtpService::SendMailMessage(nsIFile * aFilePath,
|
||||||
if (aPassword && *aPassword)
|
if (aPassword && *aPassword)
|
||||||
smtpServer->SetPassword(aPassword);
|
smtpServer->SetPassword(aPassword);
|
||||||
|
|
||||||
nsXPIDLCString smtpHostName;
|
nsCString smtpHostName;
|
||||||
nsXPIDLCString smtpUserName;
|
nsCString smtpUserName;
|
||||||
PRInt32 smtpPort;
|
PRInt32 smtpPort;
|
||||||
PRInt32 trySSL;
|
PRInt32 trySSL;
|
||||||
|
|
||||||
|
@ -153,9 +152,9 @@ nsresult nsSmtpService::SendMailMessage(nsIFile * aFilePath,
|
||||||
smtpPort = nsISmtpUrl::DEFAULT_SMTP_PORT;
|
smtpPort = nsISmtpUrl::DEFAULT_SMTP_PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smtpHostName && smtpHostName.get()[0] && !CHECK_SIMULATED_ERROR(SIMULATED_SEND_ERROR_10))
|
if (!smtpHostName.IsEmpty() && !CHECK_SIMULATED_ERROR(SIMULATED_SEND_ERROR_10))
|
||||||
{
|
{
|
||||||
rv = NS_MsgBuildSmtpUrl(aFilePath, smtpHostName, smtpPort, smtpUserName,
|
rv = NS_MsgBuildSmtpUrl(aFilePath, smtpHostName.get(), smtpPort, smtpUserName.get(),
|
||||||
aRecipients, aSenderIdentity, aUrlListener, aStatusFeedback,
|
aRecipients, aSenderIdentity, aUrlListener, aStatusFeedback,
|
||||||
aNotificationCallbacks, &urlToRun); // this ref counts urlToRun
|
aNotificationCallbacks, &urlToRun); // this ref counts urlToRun
|
||||||
if (NS_SUCCEEDED(rv) && urlToRun)
|
if (NS_SUCCEEDED(rv) && urlToRun)
|
||||||
|
@ -205,16 +204,16 @@ nsresult NS_MsgBuildSmtpUrl(nsIFile * aFilePath,
|
||||||
nsCAutoString urlSpec("smtp://");
|
nsCAutoString urlSpec("smtp://");
|
||||||
if (aSmtpUserName)
|
if (aSmtpUserName)
|
||||||
{
|
{
|
||||||
nsXPIDLCString escapedUsername;
|
nsCString escapedUsername;
|
||||||
*((char **)getter_Copies(escapedUsername)) = nsEscape(aSmtpUserName, url_XAlphas);
|
*((char **)getter_Copies(escapedUsername)) = nsEscape(aSmtpUserName, url_XAlphas);
|
||||||
urlSpec += escapedUsername;
|
urlSpec.Append(escapedUsername);
|
||||||
urlSpec += '@';
|
urlSpec.Append('@');
|
||||||
}
|
}
|
||||||
|
|
||||||
urlSpec += aSmtpHostName;
|
urlSpec.Append(aSmtpHostName);
|
||||||
if (!PL_strchr(aSmtpHostName, ':'))
|
if (!PL_strchr(aSmtpHostName, ':'))
|
||||||
{
|
{
|
||||||
urlSpec += ':';
|
urlSpec.Append(':');
|
||||||
urlSpec.AppendInt(aSmtpPort);
|
urlSpec.AppendInt(aSmtpPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,8 +391,8 @@ nsSmtpService::loadSmtpServers()
|
||||||
prefService->GetBranch(nsnull, getter_AddRefs(prefRootBranch));
|
prefService->GetBranch(nsnull, getter_AddRefs(prefRootBranch));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
nsXPIDLCString tempServerList;
|
nsCString tempServerList;
|
||||||
nsXPIDLCString serverList;
|
nsCString serverList;
|
||||||
rv = prefRootBranch->GetCharPref(PREF_MAIL_SMTPSERVERS, getter_Copies(tempServerList));
|
rv = prefRootBranch->GetCharPref(PREF_MAIL_SMTPSERVERS, getter_Copies(tempServerList));
|
||||||
|
|
||||||
//Get the pref in a tempServerList and then parse it to see if it has dupes.
|
//Get the pref in a tempServerList and then parse it to see if it has dupes.
|
||||||
|
@ -422,7 +421,7 @@ nsSmtpService::loadSmtpServers()
|
||||||
|
|
||||||
// We need to check if we have any pre-configured smtp servers so that
|
// We need to check if we have any pre-configured smtp servers so that
|
||||||
// those servers can be appended to the list.
|
// those servers can be appended to the list.
|
||||||
nsXPIDLCString appendServerList;
|
nsCString appendServerList;
|
||||||
rv = prefRootBranch->GetCharPref(PREF_MAIL_SMTPSERVERS_APPEND_SERVERS, getter_Copies(appendServerList));
|
rv = prefRootBranch->GetCharPref(PREF_MAIL_SMTPSERVERS_APPEND_SERVERS, getter_Copies(appendServerList));
|
||||||
|
|
||||||
// Get the list of smtp servers (either from regular pref i.e, mail.smtpservers or
|
// Get the list of smtp servers (either from regular pref i.e, mail.smtpservers or
|
||||||
|
@ -552,10 +551,9 @@ nsSmtpService::createKeyedServer(const char *key, nsISmtpServer** aResult)
|
||||||
mServerKeyList += key;
|
mServerKeyList += key;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aResult) {
|
if (aResult)
|
||||||
*aResult = server;
|
server.swap(*aResult);
|
||||||
NS_IF_ADDREF(*aResult);
|
|
||||||
}
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,8 +565,7 @@ nsSmtpService::GetSessionDefaultServer(nsISmtpServer **aServer)
|
||||||
if (!mSessionDefaultServer)
|
if (!mSessionDefaultServer)
|
||||||
return GetDefaultServer(aServer);
|
return GetDefaultServer(aServer);
|
||||||
|
|
||||||
*aServer = mSessionDefaultServer;
|
NS_ADDREF(*aServer = mSessionDefaultServer);
|
||||||
NS_ADDREF(*aServer);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,13 +592,13 @@ nsSmtpService::GetDefaultServer(nsISmtpServer **aServer)
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
// try to get it from the prefs
|
// try to get it from the prefs
|
||||||
nsXPIDLCString defaultServerKey;
|
nsCString defaultServerKey;
|
||||||
rv = prefBranch->GetCharPref(PREF_MAIL_SMTP_DEFAULTSERVER, getter_Copies(defaultServerKey));
|
rv = prefBranch->GetCharPref(PREF_MAIL_SMTP_DEFAULTSERVER, getter_Copies(defaultServerKey));
|
||||||
if (NS_SUCCEEDED(rv) &&
|
if (NS_SUCCEEDED(rv) &&
|
||||||
!defaultServerKey.IsEmpty()) {
|
!defaultServerKey.IsEmpty()) {
|
||||||
|
|
||||||
nsCOMPtr<nsISmtpServer> server;
|
nsCOMPtr<nsISmtpServer> server;
|
||||||
rv = GetServerByKey(defaultServerKey,
|
rv = GetServerByKey(defaultServerKey.get(),
|
||||||
getter_AddRefs(mDefaultSmtpServer));
|
getter_AddRefs(mDefaultSmtpServer));
|
||||||
} else {
|
} else {
|
||||||
// no pref set, so just return the first one, and set the pref
|
// no pref set, so just return the first one, and set the pref
|
||||||
|
@ -623,10 +620,10 @@ nsSmtpService::GetDefaultServer(nsISmtpServer **aServer)
|
||||||
NS_ENSURE_TRUE(mDefaultSmtpServer, NS_ERROR_UNEXPECTED);
|
NS_ENSURE_TRUE(mDefaultSmtpServer, NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
// now we have a default server, set the prefs correctly
|
// now we have a default server, set the prefs correctly
|
||||||
nsXPIDLCString serverKey;
|
nsCString serverKey;
|
||||||
mDefaultSmtpServer->GetKey(getter_Copies(serverKey));
|
mDefaultSmtpServer->GetKey(getter_Copies(serverKey));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
prefBranch->SetCharPref(PREF_MAIL_SMTP_DEFAULTSERVER, serverKey);
|
prefBranch->SetCharPref(PREF_MAIL_SMTP_DEFAULTSERVER, serverKey.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,8 +631,7 @@ nsSmtpService::GetDefaultServer(nsISmtpServer **aServer)
|
||||||
// * mDefaultSmtpServer has a valid server
|
// * mDefaultSmtpServer has a valid server
|
||||||
// * the key has been set in the prefs
|
// * the key has been set in the prefs
|
||||||
|
|
||||||
*aServer = mDefaultSmtpServer;
|
NS_IF_ADDREF(*aServer = mDefaultSmtpServer);
|
||||||
NS_IF_ADDREF(*aServer);
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -647,13 +643,13 @@ nsSmtpService::SetDefaultServer(nsISmtpServer *aServer)
|
||||||
|
|
||||||
mDefaultSmtpServer = aServer;
|
mDefaultSmtpServer = aServer;
|
||||||
|
|
||||||
nsXPIDLCString serverKey;
|
nsCString serverKey;
|
||||||
nsresult rv = aServer->GetKey(getter_Copies(serverKey));
|
nsresult rv = aServer->GetKey(getter_Copies(serverKey));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
prefBranch->SetCharPref(PREF_MAIL_SMTP_DEFAULTSERVER, serverKey);
|
prefBranch->SetCharPref(PREF_MAIL_SMTP_DEFAULTSERVER, serverKey.get());
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -666,11 +662,12 @@ nsSmtpService::findServerByKey (nsISupports *element, void *aData)
|
||||||
|
|
||||||
findServerByKeyEntry *entry = (findServerByKeyEntry*) aData;
|
findServerByKeyEntry *entry = (findServerByKeyEntry*) aData;
|
||||||
|
|
||||||
nsXPIDLCString key;
|
nsCString key;
|
||||||
rv = server->GetKey(getter_Copies(key));
|
rv = server->GetKey(getter_Copies(key));
|
||||||
if (NS_FAILED(rv)) return PR_TRUE;
|
if (NS_FAILED(rv)) return PR_TRUE;
|
||||||
|
|
||||||
if (nsCRT::strcmp(key, entry->key)==0) {
|
if (key.Equals(entry->key))
|
||||||
|
{
|
||||||
entry->server = server;
|
entry->server = server;
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -686,7 +683,7 @@ nsSmtpService::CreateSmtpServer(nsISmtpServer **aResult)
|
||||||
loadSmtpServers();
|
loadSmtpServers();
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
PRInt32 i=0;
|
PRInt32 i = 0;
|
||||||
PRBool unique = PR_FALSE;
|
PRBool unique = PR_FALSE;
|
||||||
|
|
||||||
findServerByKeyEntry entry;
|
findServerByKeyEntry entry;
|
||||||
|
@ -726,8 +723,7 @@ nsSmtpService::GetServerByKey(const char* aKey, nsISmtpServer **aResult)
|
||||||
mSmtpServers->EnumerateForwards(findServerByKey, (void *)&entry);
|
mSmtpServers->EnumerateForwards(findServerByKey, (void *)&entry);
|
||||||
|
|
||||||
if (entry.server) {
|
if (entry.server) {
|
||||||
(*aResult) = entry.server;
|
NS_ADDREF(*aResult = entry.server);
|
||||||
NS_ADDREF(*aResult);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -747,7 +743,7 @@ nsSmtpService::DeleteSmtpServer(nsISmtpServer *aServer)
|
||||||
if (NS_FAILED(rv) || idx==-1)
|
if (NS_FAILED(rv) || idx==-1)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
nsXPIDLCString serverKey;
|
nsCString serverKey;
|
||||||
aServer->GetKey(getter_Copies(serverKey));
|
aServer->GetKey(getter_Copies(serverKey));
|
||||||
|
|
||||||
rv = mSmtpServers->DeleteElementAt(idx);
|
rv = mSmtpServers->DeleteElementAt(idx);
|
||||||
|
@ -764,7 +760,7 @@ nsSmtpService::DeleteSmtpServer(nsISmtpServer *aServer)
|
||||||
char *token = nsCRT::strtok(rest, ",", &newStr);
|
char *token = nsCRT::strtok(rest, ",", &newStr);
|
||||||
while (token) {
|
while (token) {
|
||||||
// only re-add the string if it's not the key
|
// only re-add the string if it's not the key
|
||||||
if (nsCRT::strcmp(token, serverKey) != 0) {
|
if (strcmp(token, serverKey.get()) != 0) {
|
||||||
if (newServerList.IsEmpty())
|
if (newServerList.IsEmpty())
|
||||||
newServerList = token;
|
newServerList = token;
|
||||||
else {
|
else {
|
||||||
|
@ -794,19 +790,20 @@ nsSmtpService::findServerByHostname(nsISupports *element, void *aData)
|
||||||
|
|
||||||
findServerByHostnameEntry *entry = (findServerByHostnameEntry*)aData;
|
findServerByHostnameEntry *entry = (findServerByHostnameEntry*)aData;
|
||||||
|
|
||||||
nsXPIDLCString hostname;
|
nsCString hostname;
|
||||||
rv = server->GetHostname(getter_Copies(hostname));
|
rv = server->GetHostname(getter_Copies(hostname));
|
||||||
if (NS_FAILED(rv)) return PR_TRUE;
|
if (NS_FAILED(rv)) return PR_TRUE;
|
||||||
|
|
||||||
nsXPIDLCString username;
|
nsCString username;
|
||||||
rv = server->GetUsername(getter_Copies(username));
|
rv = server->GetUsername(getter_Copies(username));
|
||||||
if (NS_FAILED(rv)) return PR_TRUE;
|
if (NS_FAILED(rv)) return PR_TRUE;
|
||||||
|
|
||||||
PRBool checkHostname = entry->hostname && PL_strcmp(entry->hostname, "");
|
PRBool checkHostname = !entry->hostname.IsEmpty();
|
||||||
PRBool checkUsername = entry->username && PL_strcmp(entry->username, "");
|
PRBool checkUsername = !entry->username.IsEmpty();
|
||||||
|
|
||||||
if ((!checkHostname || (PL_strcasecmp(entry->hostname, hostname)==0)) &&
|
if ((!checkHostname || (entry->hostname.Equals(hostname, nsCaseInsensitiveCStringComparator())) &&
|
||||||
(!checkUsername || (PL_strcmp(entry->username, username)==0))) {
|
(!checkUsername || entry->username.Equals(username, nsCaseInsensitiveCStringComparator()))))
|
||||||
|
{
|
||||||
entry->server = server;
|
entry->server = server;
|
||||||
return PR_FALSE; // stop when found
|
return PR_FALSE; // stop when found
|
||||||
}
|
}
|
||||||
|
@ -820,7 +817,7 @@ nsSmtpService::FindServer(const char *aUsername,
|
||||||
NS_ENSURE_ARG_POINTER(aResult);
|
NS_ENSURE_ARG_POINTER(aResult);
|
||||||
|
|
||||||
findServerByHostnameEntry entry;
|
findServerByHostnameEntry entry;
|
||||||
entry.server=nsnull;
|
entry.server = nsnull;
|
||||||
entry.hostname = aHostname;
|
entry.hostname = aHostname;
|
||||||
entry.username = aUsername;
|
entry.username = aUsername;
|
||||||
|
|
||||||
|
@ -828,8 +825,7 @@ nsSmtpService::FindServer(const char *aUsername,
|
||||||
|
|
||||||
// entry.server may be null, but that's ok.
|
// entry.server may be null, but that's ok.
|
||||||
// just return null if no server is found
|
// just return null if no server is found
|
||||||
*aResult = entry.server;
|
NS_IF_ADDREF(*aResult = entry.server);
|
||||||
NS_IF_ADDREF(*aResult);
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -841,7 +837,8 @@ nsSmtpService::GetSmtpServerByIdentity(nsIMsgIdentity *aSenderIdentity, nsISmtpS
|
||||||
nsresult rv = NS_ERROR_FAILURE;
|
nsresult rv = NS_ERROR_FAILURE;
|
||||||
|
|
||||||
// First try the identity's preferred server
|
// First try the identity's preferred server
|
||||||
if (aSenderIdentity) {
|
if (aSenderIdentity)
|
||||||
|
{
|
||||||
nsCString smtpServerKey;
|
nsCString smtpServerKey;
|
||||||
rv = aSenderIdentity->GetSmtpServerKey(smtpServerKey);
|
rv = aSenderIdentity->GetSmtpServerKey(smtpServerKey);
|
||||||
if (NS_SUCCEEDED(rv) && !(smtpServerKey.IsEmpty()))
|
if (NS_SUCCEEDED(rv) && !(smtpServerKey.IsEmpty()))
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
#include "nsSmtpUrl.h"
|
#include "nsSmtpUrl.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsEscape.h"
|
#include "nsEscape.h"
|
||||||
#include "nsIMimeConverter.h"
|
#include "nsIMimeConverter.h"
|
||||||
#include "nsMsgMimeCID.h"
|
#include "nsMsgMimeCID.h"
|
||||||
|
|
|
@ -307,7 +307,7 @@ nsURLFetcher::OnStopRequest(nsIRequest *request, nsISupports * ctxt, nsresult aS
|
||||||
mOutStream = nsnull;
|
mOutStream = nsnull;
|
||||||
|
|
||||||
/* In case of multipart/x-mixed-replace, we need to truncate the file to the current part size */
|
/* In case of multipart/x-mixed-replace, we need to truncate the file to the current part size */
|
||||||
if (PL_strcasecmp(mConverterContentType, MULTIPART_MIXED_REPLACE) == 0)
|
if (mConverterContentType.LowerCaseEqualsLiteral(MULTIPART_MIXED_REPLACE))
|
||||||
{
|
{
|
||||||
PRInt64 fileSize;
|
PRInt64 fileSize;
|
||||||
LL_I2L(fileSize, mTotalWritten);
|
LL_I2L(fileSize, mTotalWritten);
|
||||||
|
@ -317,7 +317,7 @@ nsURLFetcher::OnStopRequest(nsIRequest *request, nsISupports * ctxt, nsresult aS
|
||||||
|
|
||||||
// Now if there is a callback, we need to call it...
|
// Now if there is a callback, we need to call it...
|
||||||
if (mCallback)
|
if (mCallback)
|
||||||
mCallback (aStatus, (const char *)mContentType, (const char *)mCharset, mTotalWritten, nsnull, mTagData);
|
mCallback (aStatus, mContentType.get(), mCharset.get(), mTotalWritten, nsnull, mTagData);
|
||||||
|
|
||||||
// Time to return...
|
// Time to return...
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -469,7 +469,7 @@ NS_IMETHODIMP nsURLFetcherStreamConsumer::OnStartRequest(nsIRequest *aRequest, n
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
/* In case of multipart/x-mixed-replace, we need to erase the output file content */
|
/* In case of multipart/x-mixed-replace, we need to erase the output file content */
|
||||||
if (PL_strcasecmp(mURLFetcher->mConverterContentType, MULTIPART_MIXED_REPLACE) == 0)
|
if (mURLFetcher->mConverterContentType.LowerCaseEqualsLiteral(MULTIPART_MIXED_REPLACE))
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsISeekableStream> seekStream = do_QueryInterface(mURLFetcher->mOutStream);
|
nsCOMPtr<nsISeekableStream> seekStream = do_QueryInterface(mURLFetcher->mOutStream);
|
||||||
if (seekStream)
|
if (seekStream)
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
#include "nsIURIContentListener.h"
|
#include "nsIURIContentListener.h"
|
||||||
#include "nsIWebProgressListener.h"
|
#include "nsIWebProgressListener.h"
|
||||||
#include "nsWeakReference.h"
|
#include "nsWeakReference.h"
|
||||||
#include "nsXPIDLString.h"
|
#include "nsString.h"
|
||||||
|
|
||||||
class nsURLFetcher : public nsIURLFetcher,
|
class nsURLFetcher : public nsIURLFetcher,
|
||||||
public nsIStreamListener,
|
public nsIStreamListener,
|
||||||
|
@ -90,13 +90,13 @@ private:
|
||||||
nsCOMPtr<nsIFileOutputStream> mOutStream; // the output file stream
|
nsCOMPtr<nsIFileOutputStream> mOutStream; // the output file stream
|
||||||
nsCOMPtr<nsILocalFile> mLocalFile; // the output file itself
|
nsCOMPtr<nsILocalFile> mLocalFile; // the output file itself
|
||||||
nsCOMPtr<nsIStreamListener> mConverter; // the stream converter, if needed
|
nsCOMPtr<nsIStreamListener> mConverter; // the stream converter, if needed
|
||||||
nsXPIDLCString mConverterContentType; // The content type of the converter
|
nsCString mConverterContentType; // The content type of the converter
|
||||||
PRBool mStillRunning; // Are we still running?
|
PRBool mStillRunning; // Are we still running?
|
||||||
PRInt32 mTotalWritten; // Size counter variable
|
PRInt32 mTotalWritten; // Size counter variable
|
||||||
char *mBuffer; // Buffer used for reading the data
|
char *mBuffer; // Buffer used for reading the data
|
||||||
PRUint32 mBufferSize; // Buffer size;
|
PRUint32 mBufferSize; // Buffer size;
|
||||||
nsXPIDLCString mContentType; // The content type retrieved from the server
|
nsCString mContentType; // The content type retrieved from the server
|
||||||
nsXPIDLCString mCharset; // The charset retrieved from the server
|
nsCString mCharset; // The charset retrieved from the server
|
||||||
void *mTagData; // Tag data for callback...
|
void *mTagData; // Tag data for callback...
|
||||||
nsAttachSaveCompletionCallback mCallback; // Callback to call once the file is saved...
|
nsAttachSaveCompletionCallback mCallback; // Callback to call once the file is saved...
|
||||||
nsCOMPtr<nsISupports> mLoadCookie; // load cookie used by the uri loader when we fetch the url
|
nsCOMPtr<nsISupports> mLoadCookie; // load cookie used by the uri loader when we fetch the url
|
||||||
|
|
Загрузка…
Ссылка в новой задаче