зеркало из 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(_retval);
|
||||
|
||||
nsXPIDLCString url;
|
||||
nsCString url;
|
||||
attachment->GetUrl(getter_Copies(url));
|
||||
|
||||
*_retval = mUrl.Equals(url);
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "nsIMsgStringService.h"
|
||||
#include "nsMsgComposeStringBundle.h"
|
||||
#include "nsMsgCompCID.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIMsgMessageService.h"
|
||||
#include "nsMsgUtils.h"
|
||||
|
@ -397,37 +396,22 @@ nsMsgAttachmentHandler::PickEncoding(const char *charset, nsIMsgSend *mime_deliv
|
|||
}
|
||||
else if (!PL_strcasecmp(m_encoding, ENCODING_UUENCODE))
|
||||
{
|
||||
char *tailName = NULL;
|
||||
nsXPIDLCString turl;
|
||||
nsCString tailName;
|
||||
nsCString turl;
|
||||
|
||||
if (mURL)
|
||||
{
|
||||
mURL->GetSpec(turl);
|
||||
|
||||
tailName = PL_strrchr(turl, '/');
|
||||
if (tailName)
|
||||
{
|
||||
char * tmp = tailName;
|
||||
tailName = PL_strdup(tailName+1);
|
||||
PR_FREEIF(tmp);
|
||||
}
|
||||
}
|
||||
PRInt32 tailNamePos = turl.RFindChar('/');
|
||||
if (tailNamePos != kNotFound)
|
||||
turl.Right(tailName, turl.Length() - tailNamePos -1);
|
||||
}
|
||||
|
||||
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_delivery_state);
|
||||
PR_FREEIF(tailName);
|
||||
if (!m_encoder_data) return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
else if (!PL_strcasecmp(m_encoding, ENCODING_QUOTED_PRINTABLE))
|
||||
|
@ -659,7 +643,7 @@ nsresult
|
|||
nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
|
||||
{
|
||||
nsresult status = 0;
|
||||
nsXPIDLCString url_string;
|
||||
nsCString url_string;
|
||||
|
||||
NS_ASSERTION (! m_done, "Already done");
|
||||
|
||||
|
@ -702,11 +686,11 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
|
|||
mURL->GetSpec(url_string);
|
||||
|
||||
#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
|
||||
// address in the url.
|
||||
char *src_filename = nsMsgGetLocalFileFromURL (url_string);
|
||||
char *src_filename = nsMsgGetLocalFileFromURL (url_string.get());
|
||||
if (!src_filename)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -1089,8 +1073,8 @@ nsMsgAttachmentHandler::UrlExit(nsresult status, const PRUnichar* aMsg)
|
|||
// if we should continue without this attachment.
|
||||
//
|
||||
PRBool keepOnGoing = PR_TRUE;
|
||||
nsXPIDLCString turl;
|
||||
nsXPIDLString msg;
|
||||
nsCString turl;
|
||||
nsString msg;
|
||||
PRUnichar *printfString = nsnull;
|
||||
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));
|
||||
|
||||
if (m_real_name && *m_real_name)
|
||||
printfString = nsTextFormatter::smprintf(msg, m_real_name);
|
||||
printfString = nsTextFormatter::smprintf(msg.get(), m_real_name);
|
||||
else
|
||||
if (NS_SUCCEEDED(mURL->GetSpec(turl)) && (turl))
|
||||
if (NS_SUCCEEDED(mURL->GetSpec(turl)) && !turl.IsEmpty())
|
||||
{
|
||||
nsCAutoString unescapeUrl(turl);
|
||||
nsUnescape(unescapeUrl.BeginWriting());
|
||||
if (unescapeUrl.IsEmpty())
|
||||
printfString = nsTextFormatter::smprintf(msg, turl.get());
|
||||
printfString = nsTextFormatter::smprintf(msg.get(), turl.get());
|
||||
else
|
||||
printfString = nsTextFormatter::smprintf(msg, unescapeUrl.get());
|
||||
printfString = nsTextFormatter::smprintf(msg.get(), unescapeUrl.get());
|
||||
}
|
||||
else
|
||||
printfString = nsTextFormatter::smprintf(msg, "?");
|
||||
printfString = nsTextFormatter::smprintf(msg.get(), "?");
|
||||
|
||||
nsCOMPtr<nsIPrompt> aPrompt;
|
||||
if (m_mime_delivery_state)
|
||||
|
|
|
@ -73,7 +73,7 @@ nsMsgCompFields::nsMsgCompFields()
|
|||
m_needToCheckCharset = PR_TRUE;
|
||||
|
||||
// Get the default charset from pref, use this as a mail charset.
|
||||
nsXPIDLString charset;
|
||||
nsString charset;
|
||||
NS_GetLocalizedUnicharPreferenceWithDefault(nsnull, "mailnews.send_default_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_ASSERTION(recipients, "The recipient list is not supposed to be null -Fix the caller!");
|
||||
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (! _retval)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*_retval = nsnull;
|
||||
|
||||
if (! _retval)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*_retval = nsnull;
|
||||
|
||||
nsMsgRecipientArray* pAddrArray = new nsMsgRecipientArray;
|
||||
if (! pAddrArray)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = pAddrArray->QueryInterface(NS_GET_IID(nsIMsgRecipientArray), (void **)_retval);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIMsgHeaderParser> parser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID);
|
||||
if (parser)
|
||||
{
|
||||
nsCAutoString recipientsStr;
|
||||
char * names;
|
||||
char * addresses;
|
||||
PRUint32 numAddresses;
|
||||
|
||||
CopyUTF16toUTF8(recipients, recipientsStr);
|
||||
|
||||
rv= parser->ParseHeaderAddresses("UTF-8", recipientsStr.get(), &names,
|
||||
&addresses, &numAddresses);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
PRUint32 i=0;
|
||||
char * pNames = names;
|
||||
char * pAddresses = addresses;
|
||||
PRBool aBool;
|
||||
|
||||
nsMsgRecipientArray* pAddrArray = new nsMsgRecipientArray;
|
||||
if (! pAddrArray)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = pAddrArray->QueryInterface(NS_GET_IID(nsIMsgRecipientArray), (void **)_retval);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIMsgHeaderParser> parser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID);
|
||||
if (parser)
|
||||
{
|
||||
nsCAutoString recipientsStr;
|
||||
char * names;
|
||||
char * addresses;
|
||||
PRUint32 numAddresses;
|
||||
|
||||
CopyUTF16toUTF8(recipients, recipientsStr);
|
||||
|
||||
rv= parser->ParseHeaderAddresses("UTF-8", recipientsStr.get(), &names,
|
||||
&addresses, &numAddresses);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
PRUint32 i=0;
|
||||
char * pNames = names;
|
||||
char * pAddresses = addresses;
|
||||
PRBool aBool;
|
||||
|
||||
for (i = 0; i < numAddresses; i ++)
|
||||
{
|
||||
nsXPIDLCString fullAddress;
|
||||
nsCString fullAddress;
|
||||
nsAutoString recipient;
|
||||
if (!emailAddressOnly)
|
||||
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);
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
|
||||
|
||||
rv = pAddrArray->AppendString(recipient.get(), &aBool);
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
|
||||
pNames += PL_strlen(pNames) + 1;
|
||||
pAddresses += PL_strlen(pAddresses) + 1;
|
||||
}
|
||||
|
||||
PR_FREEIF(names);
|
||||
PR_FREEIF(addresses);
|
||||
}
|
||||
}
|
||||
else
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
pNames += PL_strlen(pNames) + 1;
|
||||
pAddresses += PL_strlen(pAddresses) + 1;
|
||||
}
|
||||
|
||||
PR_FREEIF(names);
|
||||
PR_FREEIF(addresses);
|
||||
}
|
||||
}
|
||||
else
|
||||
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)
|
||||
{
|
||||
NS_ASSERTION(recipients, "The recipient list is not supposed to be null -Fix the caller!");
|
||||
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
||||
nsMsgRecipientArray* pAddrsArray = nsnull;
|
||||
if (fullAddrsArray)
|
||||
{
|
||||
|
@ -670,49 +670,44 @@ nsresult nsMsgCompFields::SplitRecipientsEx(const PRUnichar *recipients, nsIMsgR
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (pAddrsArray || pEmailsArray)
|
||||
{
|
||||
nsCOMPtr<nsIMsgHeaderParser> parser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID);
|
||||
if (parser)
|
||||
{
|
||||
nsCAutoString recipientsStr;
|
||||
char * names;
|
||||
char *addresses;
|
||||
PRUint32 numAddresses;
|
||||
|
||||
CopyUTF16toUTF8(recipients, recipientsStr);
|
||||
rv= parser->ParseHeaderAddresses("UTF-8", recipientsStr.get(), &names,
|
||||
|
||||
if (pAddrsArray || pEmailsArray)
|
||||
{
|
||||
nsCOMPtr<nsIMsgHeaderParser> parser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID);
|
||||
if (parser)
|
||||
{
|
||||
nsCAutoString recipientsStr;
|
||||
char * names;
|
||||
char *addresses;
|
||||
PRUint32 numAddresses;
|
||||
|
||||
CopyUTF16toUTF8(recipients, recipientsStr);
|
||||
rv= parser->ParseHeaderAddresses("UTF-8", recipientsStr.get(), &names,
|
||||
&addresses, &numAddresses);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
PRUint32 i=0;
|
||||
char * pNames = names;
|
||||
char * pAddresses = addresses;
|
||||
nsAutoString recipient;
|
||||
PRBool aBool;
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
PRUint32 i=0;
|
||||
char * pNames = names;
|
||||
char * pAddresses = addresses;
|
||||
nsAutoString recipient;
|
||||
PRBool aBool;
|
||||
|
||||
for (i = 0; i < numAddresses; i ++)
|
||||
{
|
||||
nsXPIDLCString fullAddress;
|
||||
nsCString fullAddress;
|
||||
if (pAddrsArray)
|
||||
{
|
||||
rv = parser->MakeFullAddress("UTF-8", pNames, pAddresses,
|
||||
getter_Copies(fullAddress));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = ConvertToUnicode("UTF-8", fullAddress, recipient);
|
||||
}
|
||||
else
|
||||
rv = ConvertToUnicode("UTF-8", pAddresses, recipient);
|
||||
rv = ConvertToUnicode("UTF-8", NS_SUCCEEDED(rv) ? fullAddress.get() : pAddresses, recipient);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
||||
rv = pAddrsArray->AppendString(recipient.get(), &aBool);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
if (pEmailsArray)
|
||||
{
|
||||
rv = ConvertToUnicode("UTF-8", pAddresses, recipient);
|
||||
|
@ -722,19 +717,19 @@ nsresult nsMsgCompFields::SplitRecipientsEx(const PRUnichar *recipients, nsIMsgR
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
pNames += PL_strlen(pNames) + 1;
|
||||
pAddresses += PL_strlen(pAddresses) + 1;
|
||||
}
|
||||
|
||||
PR_FREEIF(names);
|
||||
PR_FREEIF(addresses);
|
||||
|
||||
PR_FREEIF(names);
|
||||
PR_FREEIF(addresses);
|
||||
}
|
||||
}
|
||||
else
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include "nsINntpService.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsMsgComposeStringBundle.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsIDocumentEncoder.h" // for editor output flags
|
||||
|
@ -154,12 +153,12 @@ nsMsgCreateTempFileName(const char *tFileName)
|
|||
if (NS_FAILED(rv))
|
||||
return nsnull;
|
||||
|
||||
nsXPIDLCString tempString;
|
||||
nsCString tempString;
|
||||
rv = tmpFile->GetNativePath(tempString);
|
||||
if (NS_FAILED(rv))
|
||||
return nsnull;
|
||||
|
||||
char *tString = (char *)PL_strdup(tempString.get());
|
||||
char *tString = ToNewCString(tempString);
|
||||
if (!tString)
|
||||
return PL_strdup("mozmail.tmp"); // No need to I18N
|
||||
|
||||
|
@ -486,11 +485,11 @@ mime_generate_headers (nsMsgCompFields *fields,
|
|||
nsCAutoString userAgentString;
|
||||
#ifdef MOZ_THUNDERBIRD
|
||||
|
||||
nsXPIDLCString userAgentOverride;
|
||||
nsCString userAgentOverride;
|
||||
prefs->GetCharPref("general.useragent.override", getter_Copies(userAgentOverride));
|
||||
|
||||
// allow a user to override the default UA
|
||||
if (!userAgentOverride)
|
||||
if (userAgentOverride.IsEmpty())
|
||||
{
|
||||
nsCOMPtr<nsIXULAppInfo> xulAppInfo (do_GetService(XULAPPINFO_SERVICE_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
@ -573,10 +572,11 @@ mime_generate_headers (nsMsgCompFields *fields,
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
nsXPIDLCString newsgroupsHeaderVal;
|
||||
nsXPIDLCString newshostHeaderVal;
|
||||
nsCString newsgroupsHeaderVal;
|
||||
nsCString newshostHeaderVal;
|
||||
rv = nntpService->GenerateNewsHeaderValsForPosting(n2, getter_Copies(newsgroupsHeaderVal), getter_Copies(newshostHeaderVal));
|
||||
if (NS_FAILED(rv)) {
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
*status = rv;
|
||||
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
|
||||
// really send the message.
|
||||
if (!hasDisclosedRecipient && !isDraft) {
|
||||
if (!hasDisclosedRecipient && !isDraft)
|
||||
{
|
||||
PRBool bAddUndisclosedRecipients = PR_TRUE;
|
||||
prefs->GetBoolPref("mail.compose.add_undisclosed_recipients", &bAddUndisclosedRecipients);
|
||||
if (bAddUndisclosedRecipients) {
|
||||
if (bAddUndisclosedRecipients)
|
||||
{
|
||||
const char* pBcc = fields->GetBcc(); //Do not free me!
|
||||
if (pBcc && *pBcc) {
|
||||
if (pBcc && *pBcc)
|
||||
{
|
||||
nsCOMPtr<nsIStringBundleService> stringService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIStringBundle> composeStringBundle;
|
||||
rv = stringService->CreateBundle("chrome://messenger/locale/messengercompose/composeMsgs.properties", getter_AddRefs(composeStringBundle));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsXPIDLString undisclosedRecipients;
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsString 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);
|
||||
if (cstr) {
|
||||
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);
|
||||
}
|
||||
|
||||
// Skip no or empty priority.
|
||||
if (pPriority && *pPriority) {
|
||||
if (pPriority && *pPriority)
|
||||
{
|
||||
nsMsgPriorityValue priorityValue;
|
||||
|
||||
NS_MsgGetPriorityFromString(pPriority, priorityValue);
|
||||
|
@ -835,7 +841,7 @@ mime_generate_attachment_headers (const char *type,
|
|||
|
||||
/* Let's encode the real name */
|
||||
char *encodedRealName = nsnull;
|
||||
nsXPIDLCString charset; // actual charset used for MIME encode
|
||||
nsCString charset; // actual charset used for MIME encode
|
||||
nsAutoString realName;
|
||||
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
|
||||
{
|
||||
nsXPIDLCString url;
|
||||
nsCString url;
|
||||
attachment->mURL->GetSpec(url);
|
||||
|
||||
s = url;
|
||||
s = url.get();
|
||||
s2 = PL_strchr (s, ':');
|
||||
if (s2) s = s2 + 1;
|
||||
/* If we know the URL doesn't have a sensible file name in it,
|
||||
don't bother emitting a content-disposition. */
|
||||
if (!PL_strncasecmp (url, "news:", 5) ||
|
||||
!PL_strncasecmp (url, "snews:", 6) ||
|
||||
!PL_strncasecmp (url, "IMAP:", 5) ||
|
||||
!PL_strncasecmp (url, "mailbox:", 8))
|
||||
if (StringBeginsWith (url, NS_LITERAL_CSTRING("news:"), nsCaseInsensitiveCStringComparator()) ||
|
||||
StringBeginsWith (url, NS_LITERAL_CSTRING("snews:"), nsCaseInsensitiveCStringComparator()) ||
|
||||
StringBeginsWith (url, NS_LITERAL_CSTRING("IMAP:"), nsCaseInsensitiveCStringComparator()) ||
|
||||
StringBeginsWith (url, NS_LITERAL_CSTRING("mailbox:"), nsCaseInsensitiveCStringComparator()))
|
||||
return;
|
||||
|
||||
/* Take the part of the file name after the last / or \ */
|
||||
|
@ -1836,16 +1842,16 @@ char *
|
|||
GenerateFileNameFromURI(nsIURI *aURL)
|
||||
{
|
||||
nsresult rv;
|
||||
nsXPIDLCString file;
|
||||
nsXPIDLCString spec;
|
||||
nsCString file;
|
||||
nsCString spec;
|
||||
char *returnString;
|
||||
char *cp = nsnull;
|
||||
char *cp1 = nsnull;
|
||||
|
||||
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)
|
||||
return nsnull;
|
||||
|
||||
|
@ -1877,9 +1883,9 @@ GenerateFileNameFromURI(nsIURI *aURL)
|
|||
|
||||
|
||||
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)
|
||||
return nsnull;
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIDocumentEncoder.h" // for editor output flags
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIMsgHeaderParser.h"
|
||||
#include "nsMsgCompUtils.h"
|
||||
#include "nsIMsgStringService.h"
|
||||
|
@ -126,11 +125,11 @@
|
|||
|
||||
static void GetReplyHeaderInfo(PRInt32* reply_header_type,
|
||||
nsString& reply_header_locale,
|
||||
nsXPIDLString& reply_header_authorwrote,
|
||||
nsXPIDLString& reply_header_ondate,
|
||||
nsString& reply_header_authorwrote,
|
||||
nsString& reply_header_ondate,
|
||||
nsString& reply_header_separator,
|
||||
nsString& reply_header_colon,
|
||||
nsXPIDLString& reply_header_originalmessage)
|
||||
nsString& reply_header_originalmessage)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||
|
@ -399,10 +398,10 @@ nsresult nsMsgCompose::ResetUrisForEmbeddedObjects()
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsXPIDLCString curDraftIdURL;
|
||||
nsCString 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).
|
||||
if (NS_SUCCEEDED(rv) && mMsgSend && !curDraftIdURL.IsEmpty())
|
||||
|
@ -412,7 +411,7 @@ nsresult nsMsgCompose::ResetUrisForEmbeddedObjects()
|
|||
return NS_OK;
|
||||
|
||||
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.");
|
||||
if (NS_SUCCEEDED(rv) && msgDBHdr)
|
||||
{
|
||||
|
@ -492,9 +491,9 @@ nsresult nsMsgCompose::TagEmbeddedObjects(nsIEditorMailSupport *aEditor)
|
|||
nsCOMPtr<nsIDOMNode> node;
|
||||
|
||||
nsCOMPtr<nsIURI> originalUrl;
|
||||
nsXPIDLCString originalScheme;
|
||||
nsXPIDLCString originalHost;
|
||||
nsXPIDLCString originalPath;
|
||||
nsCString originalScheme;
|
||||
nsCString originalHost;
|
||||
nsCString originalPath;
|
||||
|
||||
// first, convert the rdf original msg uri into a url that represents the message...
|
||||
nsCOMPtr <nsIMsgMessageService> msgService;
|
||||
|
@ -800,7 +799,7 @@ nsMsgCompose::Initialize(nsIDOMWindowInternal *aWindow, nsIMsgComposeParams *par
|
|||
MSG_ComposeType type;
|
||||
params->GetType(&type);
|
||||
|
||||
nsXPIDLCString originalMsgURI;
|
||||
nsCString originalMsgURI;
|
||||
params->GetOriginalMsgURI(getter_Copies(originalMsgURI));
|
||||
params->GetOrigMsgHdr(getter_AddRefs(mOrigMsgHdr));
|
||||
|
||||
|
@ -840,9 +839,9 @@ nsMsgCompose::Initialize(nsIDOMWindowInternal *aWindow, nsIMsgComposeParams *par
|
|||
if(externalSendListener)
|
||||
AddMsgSendListener( externalSendListener );
|
||||
|
||||
nsXPIDLCString smtpPassword;
|
||||
nsCString smtpPassword;
|
||||
params->GetSmtpPassword(getter_Copies(smtpPassword));
|
||||
mSmtpPassword = (const char *)smtpPassword;
|
||||
mSmtpPassword = smtpPassword;
|
||||
|
||||
if (aWindow)
|
||||
{
|
||||
|
@ -850,7 +849,7 @@ nsMsgCompose::Initialize(nsIDOMWindowInternal *aWindow, nsIMsgComposeParams *par
|
|||
rv = composeService->RegisterComposeWindow(aWindow, this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
return CreateMessage(originalMsgURI, type, composeFields);
|
||||
return CreateMessage(originalMsgURI.get(), type, composeFields);
|
||||
}
|
||||
|
||||
nsresult nsMsgCompose::SetDocumentCharset(const char *charset)
|
||||
|
@ -1085,8 +1084,8 @@ NS_IMETHODIMP nsMsgCompose::SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity
|
|||
if (NS_SUCCEEDED(rv) && !msgBody.IsEmpty())
|
||||
{
|
||||
// Convert body to mail charset
|
||||
nsXPIDLCString outCString;
|
||||
nsXPIDLCString fallbackCharset;
|
||||
nsCString outCString;
|
||||
nsCString fallbackCharset;
|
||||
PRBool isAsciiOnly;
|
||||
// check if the body text is covered by the current charset.
|
||||
rv = nsMsgI18NSaveAsCharset(contentType, m_compFields->GetCharacterSet(),
|
||||
|
@ -1118,7 +1117,7 @@ NS_IMETHODIMP nsMsgCompose::SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity
|
|||
}
|
||||
}
|
||||
// re-label to the fallback charset
|
||||
else if (fallbackCharset)
|
||||
else if (!fallbackCharset.IsEmpty())
|
||||
m_compFields->SetCharacterSet(fallbackCharset.get());
|
||||
m_compFields->SetBodyIsAsciiOnly(isAsciiOnly);
|
||||
m_compFields->SetBody(outCString.get());
|
||||
|
@ -1587,14 +1586,14 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
|||
|
||||
if (m_identity)
|
||||
{
|
||||
nsXPIDLCString::const_iterator start, end;
|
||||
nsCString::const_iterator start, end;
|
||||
|
||||
/* Setup reply-to field */
|
||||
nsCString replyTo;
|
||||
m_identity->GetReplyTo(replyTo);
|
||||
if (!replyTo.IsEmpty())
|
||||
{
|
||||
nsXPIDLCString replyToStr;
|
||||
nsCString replyToStr;
|
||||
replyToStr.Assign(m_compFields->GetReplyTo());
|
||||
|
||||
replyToStr.BeginReading(start);
|
||||
|
@ -1613,7 +1612,7 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
|||
m_identity->GetDoBcc(&doBcc);
|
||||
if (doBcc)
|
||||
{
|
||||
nsXPIDLCString bccStr;
|
||||
nsCString bccStr;
|
||||
bccStr.Assign(m_compFields->GetBcc());
|
||||
|
||||
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.");
|
||||
if (msgDBHdr)
|
||||
{
|
||||
nsXPIDLCString queuedDisposition;
|
||||
nsCString queuedDisposition;
|
||||
msgDBHdr->GetStringProperty(QUEUED_DISPOSITION_PROPERTY, getter_Copies(queuedDisposition));
|
||||
nsXPIDLCString originalMsgURIs;
|
||||
nsCString originalMsgURIs;
|
||||
msgDBHdr->GetStringProperty(ORIG_URI_PROPERTY, getter_Copies(originalMsgURIs));
|
||||
mOriginalMsgURI = originalMsgURIs;
|
||||
if (!queuedDisposition.IsEmpty())
|
||||
|
@ -1731,8 +1730,8 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
|||
}
|
||||
if (msgHdr)
|
||||
{
|
||||
nsXPIDLString subject;
|
||||
nsXPIDLCString decodedCString;
|
||||
nsString subject;
|
||||
nsCString decodedCString;
|
||||
|
||||
if (!charsetOverride && charset.IsEmpty())
|
||||
{
|
||||
|
@ -1753,7 +1752,7 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
|||
prefs->GetBoolPref("mailnews.reply_in_default_charset",
|
||||
&replyInDefault);
|
||||
if (replyInDefault) {
|
||||
nsXPIDLString str;
|
||||
nsString str;
|
||||
NS_GetLocalizedUnicharPreferenceWithDefault(prefs, "mailnews.send_default_charset",
|
||||
EmptyString(), str);
|
||||
if (!str.IsEmpty())
|
||||
|
@ -1771,9 +1770,9 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
|||
if (isFirstPass && !charset.IsEmpty())
|
||||
m_compFields->SetCharacterSet(charset.get());
|
||||
|
||||
nsXPIDLCString subjectCStr;
|
||||
nsCString subjectCStr;
|
||||
(void) msgHdr->GetSubject(getter_Copies(subjectCStr));
|
||||
rv = mimeConverter->DecodeMimeHeader(subjectCStr,
|
||||
rv = mimeConverter->DecodeMimeHeader(subjectCStr.get(),
|
||||
getter_Copies(decodedCString),
|
||||
originCharset.get(), charsetOverride);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -1810,7 +1809,7 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
|||
db->GetMsgHdrForMessageID(reference.get(), getter_AddRefs(refHdr));
|
||||
|
||||
if (refHdr) {
|
||||
nsXPIDLCString refSubject;
|
||||
nsCString refSubject;
|
||||
rv = refHdr->GetSubject(getter_Copies(refSubject));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsACString::const_iterator start, end;
|
||||
|
@ -1854,7 +1853,7 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
|||
subject.Insert(NS_LITERAL_STRING("Re: "), 0);
|
||||
m_compFields->SetSubject(subject);
|
||||
|
||||
nsXPIDLCString author, authorEmailAddress;
|
||||
nsCString author, authorEmailAddress;
|
||||
msgHdr->GetAuthor(getter_Copies(author));
|
||||
nsCOMPtr<nsIMsgHeaderParser> parser (do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID));
|
||||
if (parser) {
|
||||
|
@ -1872,7 +1871,7 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsISupportsArray> identities;
|
||||
nsXPIDLCString accountKey;
|
||||
nsCString accountKey;
|
||||
msgHdr->GetAccountKey(getter_Copies(accountKey));
|
||||
if(replyToSelfCheckAll)
|
||||
{
|
||||
|
@ -1929,19 +1928,19 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
|
|||
}
|
||||
}
|
||||
|
||||
nsXPIDLCString toField;
|
||||
nsCString toField;
|
||||
if (isReplyToOwnMsg)
|
||||
msgHdr->GetRecipients(getter_Copies(toField));
|
||||
else
|
||||
toField.Assign(author);
|
||||
|
||||
rv = mimeConverter->DecodeMimeHeader(toField,
|
||||
rv = mimeConverter->DecodeMimeHeader(toField.get(),
|
||||
getter_Copies(decodedCString),
|
||||
originCharset.get(), charsetOverride);
|
||||
if (NS_SUCCEEDED(rv) && decodedCString)
|
||||
m_compFields->SetTo(decodedCString);
|
||||
if (NS_SUCCEEDED(rv) && !decodedCString.IsEmpty())
|
||||
m_compFields->SetTo(decodedCString.get());
|
||||
else
|
||||
m_compFields->SetTo(toField);
|
||||
m_compFields->SetTo(toField.get());
|
||||
|
||||
// Setup quoting callbacks for later...
|
||||
mWhatHolder = 1;
|
||||
|
@ -2054,12 +2053,12 @@ QuotingOutputStreamListener::QuotingOutputStreamListener(const char * originalMs
|
|||
|
||||
if (! mHeadersOnly)
|
||||
{
|
||||
nsXPIDLString replyHeaderOriginalmessage;
|
||||
nsString replyHeaderOriginalmessage;
|
||||
// For the built message body...
|
||||
if (originalMsgHdr && !quoteHeaders)
|
||||
{
|
||||
// Setup the cite information....
|
||||
nsXPIDLCString myGetter;
|
||||
nsCString myGetter;
|
||||
if (NS_SUCCEEDED(originalMsgHdr->GetMessageId(getter_Copies(myGetter))))
|
||||
{
|
||||
if (!myGetter.IsEmpty())
|
||||
|
@ -2080,8 +2079,8 @@ QuotingOutputStreamListener::QuotingOutputStreamListener(const char * originalMs
|
|||
PRBool header, headerDate;
|
||||
PRInt32 replyHeaderType;
|
||||
nsAutoString replyHeaderLocale;
|
||||
nsXPIDLString replyHeaderAuthorwrote;
|
||||
nsXPIDLString replyHeaderOndate;
|
||||
nsString replyHeaderAuthorwrote;
|
||||
nsString replyHeaderOndate;
|
||||
nsAutoString replyHeaderSeparator;
|
||||
nsAutoString replyHeaderColon;
|
||||
|
||||
|
@ -2165,12 +2164,12 @@ QuotingOutputStreamListener::QuotingOutputStreamListener(const char * originalMs
|
|||
}
|
||||
|
||||
|
||||
nsXPIDLCString author;
|
||||
nsCString author;
|
||||
rv = originalMsgHdr->GetAuthor(getter_Copies(author));
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsXPIDLCString decodedString;
|
||||
nsCString decodedString;
|
||||
mMimeConverter = do_GetService(NS_MIME_CONVERTER_CONTRACTID);
|
||||
// Decode header, the result string is null if the input is non MIME encoded ASCII.
|
||||
if (mMimeConverter)
|
||||
|
@ -2180,12 +2179,12 @@ QuotingOutputStreamListener::QuotingOutputStreamListener(const char * originalMs
|
|||
|
||||
if (parser)
|
||||
{
|
||||
nsXPIDLCString authorName;
|
||||
rv = parser->ExtractHeaderAddressName("UTF-8", decodedString ? decodedString.get() : author.get(),
|
||||
nsCString authorName;
|
||||
rv = parser->ExtractHeaderAddressName("UTF-8", !decodedString.IsEmpty() ? decodedString.get() : author.get(),
|
||||
getter_Copies(authorName));
|
||||
// take care "%s wrote"
|
||||
PRUnichar *formatedString = nsnull;
|
||||
if (NS_SUCCEEDED(rv) && authorName)
|
||||
if (NS_SUCCEEDED(rv) && !authorName.IsEmpty())
|
||||
formatedString = nsTextFormatter::smprintf(replyHeaderAuthorwrote.get(), authorName.get());
|
||||
else
|
||||
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.
|
||||
PRInt32 replyHeaderType;
|
||||
nsAutoString replyHeaderLocale;
|
||||
nsXPIDLString replyHeaderAuthorwrote;
|
||||
nsXPIDLString replyHeaderOndate;
|
||||
nsString replyHeaderAuthorwrote;
|
||||
nsString replyHeaderOndate;
|
||||
nsAutoString replyHeaderSeparator;
|
||||
nsAutoString replyHeaderColon;
|
||||
GetReplyHeaderInfo(&replyHeaderType,
|
||||
|
@ -2300,44 +2299,38 @@ NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, ns
|
|||
nsAutoString messageId;
|
||||
nsAutoString references;
|
||||
nsAutoString listPost;
|
||||
nsXPIDLCString outCString;
|
||||
nsCString outCString;
|
||||
PRBool needToRemoveDup = PR_FALSE;
|
||||
if (!mMimeConverter)
|
||||
{
|
||||
mMimeConverter = do_GetService(NS_MIME_CONVERTER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
nsXPIDLCString charset;
|
||||
nsCString charset;
|
||||
compFields->GetCharacterSet(getter_Copies(charset));
|
||||
|
||||
if (type == nsIMsgCompType::ReplyAll)
|
||||
{
|
||||
mHeaders->ExtractHeader(HEADER_TO, PR_TRUE, getter_Copies(outCString));
|
||||
if (outCString)
|
||||
{
|
||||
mMimeConverter->DecodeMimeHeader(outCString, recipient, charset);
|
||||
}
|
||||
if (!outCString.IsEmpty())
|
||||
mMimeConverter->DecodeMimeHeader(outCString.get(), recipient, charset.get());
|
||||
|
||||
mHeaders->ExtractHeader(HEADER_CC, PR_TRUE, getter_Copies(outCString));
|
||||
if (outCString)
|
||||
{
|
||||
mMimeConverter->DecodeMimeHeader(outCString, cc, charset);
|
||||
}
|
||||
if (!outCString.IsEmpty())
|
||||
mMimeConverter->DecodeMimeHeader(outCString.get(), cc, charset.get());
|
||||
|
||||
// preserve BCC for the reply-to-self case
|
||||
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)
|
||||
compFields->SetBcc(bcc);
|
||||
}
|
||||
|
||||
mHeaders->ExtractHeader(HEADER_MAIL_FOLLOWUP_TO, PR_TRUE, getter_Copies(outCString));
|
||||
if (outCString)
|
||||
{
|
||||
mMimeConverter->DecodeMimeHeader(outCString, mailFollowupTo, charset);
|
||||
}
|
||||
if (!outCString.IsEmpty())
|
||||
mMimeConverter->DecodeMimeHeader(outCString.get(), mailFollowupTo, charset.get());
|
||||
|
||||
if (! mailFollowupTo.IsEmpty())
|
||||
{ // 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));
|
||||
if (!outCString.IsEmpty())
|
||||
mMimeConverter->DecodeMimeHeader(outCString, listPost, charset);
|
||||
mMimeConverter->DecodeMimeHeader(outCString.get(), listPost, charset.get());
|
||||
|
||||
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));
|
||||
if (outCString)
|
||||
{
|
||||
mMimeConverter->DecodeMimeHeader(outCString, replyTo, charset);
|
||||
}
|
||||
if (!outCString.IsEmpty())
|
||||
mMimeConverter->DecodeMimeHeader(outCString.get(), replyTo, charset.get());
|
||||
|
||||
mHeaders->ExtractHeader(HEADER_MAIL_REPLY_TO, PR_TRUE, getter_Copies(outCString));
|
||||
if (outCString)
|
||||
{
|
||||
mMimeConverter->DecodeMimeHeader(outCString, mailReplyTo, charset);
|
||||
}
|
||||
if (!outCString.IsEmpty())
|
||||
mMimeConverter->DecodeMimeHeader(outCString.get(), mailReplyTo, charset.get());
|
||||
|
||||
mHeaders->ExtractHeader(HEADER_NEWSGROUPS, PR_FALSE, getter_Copies(outCString));
|
||||
if (outCString)
|
||||
{
|
||||
mMimeConverter->DecodeMimeHeader(outCString, newgroups, charset);
|
||||
}
|
||||
if (!outCString.IsEmpty())
|
||||
mMimeConverter->DecodeMimeHeader(outCString.get(), newgroups, charset.get());
|
||||
|
||||
mHeaders->ExtractHeader(HEADER_FOLLOWUP_TO, PR_FALSE, getter_Copies(outCString));
|
||||
if (outCString)
|
||||
{
|
||||
mMimeConverter->DecodeMimeHeader(outCString, followUpTo, charset);
|
||||
}
|
||||
if (!outCString.IsEmpty())
|
||||
mMimeConverter->DecodeMimeHeader(outCString.get(), followUpTo, charset.get());
|
||||
|
||||
mHeaders->ExtractHeader(HEADER_MESSAGE_ID, PR_FALSE, getter_Copies(outCString));
|
||||
if (outCString)
|
||||
{
|
||||
mMimeConverter->DecodeMimeHeader(outCString, messageId, charset);
|
||||
}
|
||||
if (!outCString.IsEmpty())
|
||||
mMimeConverter->DecodeMimeHeader(outCString.get(), messageId, charset.get());
|
||||
|
||||
mHeaders->ExtractHeader(HEADER_REFERENCES, PR_FALSE, getter_Copies(outCString));
|
||||
if (outCString)
|
||||
{
|
||||
mMimeConverter->DecodeMimeHeader(outCString, references, charset);
|
||||
}
|
||||
if (!outCString.IsEmpty())
|
||||
mMimeConverter->DecodeMimeHeader(outCString.get(), references, charset.get());
|
||||
|
||||
if (! ((type == nsIMsgCompType::ReplyAll) && ! mailFollowupTo.IsEmpty()) &&
|
||||
! ((type == nsIMsgCompType::ReplyToList) && ! listPost.IsEmpty()))
|
||||
|
@ -2455,10 +2436,10 @@ NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, ns
|
|||
else
|
||||
{
|
||||
mHeaders->ExtractHeader(HEADER_FROM, PR_FALSE, getter_Copies(outCString));
|
||||
if (outCString)
|
||||
if (!outCString.IsEmpty())
|
||||
{
|
||||
nsAutoString from;
|
||||
mMimeConverter->DecodeMimeHeader(outCString, from, charset);
|
||||
mMimeConverter->DecodeMimeHeader(outCString.get(), from, charset.get());
|
||||
compFields->SetTo(from);
|
||||
}
|
||||
}
|
||||
|
@ -3328,7 +3309,7 @@ nsMsgComposeSendListener::GetMsgFolder(nsIMsgCompose *compObj, nsIMsgFolder **ms
|
|||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMsgFolder> aMsgFolder;
|
||||
nsXPIDLCString folderUri;
|
||||
nsCString folderUri;
|
||||
|
||||
rv = compObj->GetSavedFolderURI(getter_Copies(folderUri));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -3342,8 +3323,7 @@ nsMsgComposeSendListener::GetMsgFolder(nsIMsgCompose *compObj, nsIMsgFolder **ms
|
|||
|
||||
aMsgFolder = do_QueryInterface(resource, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
*msgFolder = aMsgFolder;
|
||||
NS_IF_ADDREF(*msgFolder);
|
||||
NS_IF_ADDREF(*msgFolder = aMsgFolder);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -3514,10 +3494,10 @@ NS_IMETHODIMP nsMsgComposeSendListener::OnStateChange(nsIWebProgress *aWebProgre
|
|||
progress->GetProcessCanceledByUser(&bCanceled);
|
||||
if (bCanceled)
|
||||
{
|
||||
nsXPIDLString msg;
|
||||
nsString msg;
|
||||
nsCOMPtr<nsIMsgStringService> strBundle = do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID);
|
||||
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));
|
||||
|
||||
nsXPIDLCString uri;
|
||||
nsCString uri;
|
||||
// rv = directory->GetDirUri(getter_Copies(uri));
|
||||
rv = source->GetValue(getter_Copies(uri));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 pos;
|
||||
if (nsCRT::strcmp((const char *)uri, kPersonalAddressbookUri) == 0)
|
||||
if (uri.EqualsLiteral(kPersonalAddressbookUri))
|
||||
pos = 0;
|
||||
else
|
||||
{
|
||||
PRUint32 count = 0;
|
||||
directoriesArray->Count(&count);
|
||||
|
||||
if (PL_strcmp((const char *)uri, kCollectedAddressbookUri) == 0)
|
||||
if (uri.EqualsLiteral(kCollectedAddressbookUri))
|
||||
{
|
||||
collectedAddressbookFound = PR_TRUE;
|
||||
pos = count;
|
||||
|
@ -4177,14 +4157,14 @@ nsresult nsMsgCompose::BuildMailListArray(nsIAddrDatabase* database, nsIAbDirect
|
|||
|
||||
if (NS_SUCCEEDED(directory->GetIsMailList(&bIsMailList)) && bIsMailList)
|
||||
{
|
||||
nsXPIDLString listName;
|
||||
nsXPIDLString listDescription;
|
||||
nsString listName;
|
||||
nsString listDescription;
|
||||
|
||||
directory->GetDirName(getter_Copies(listName));
|
||||
directory->GetDescription(getter_Copies(listDescription));
|
||||
|
||||
nsMsgMailList* mailList = new nsMsgMailList(nsAutoString((const PRUnichar*)listName),
|
||||
nsAutoString((const PRUnichar*)listDescription), directory);
|
||||
nsMsgMailList* mailList = new nsMsgMailList(listName,
|
||||
listDescription, directory);
|
||||
if (!mailList)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mailList);
|
||||
|
@ -4272,8 +4252,8 @@ NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients(PRBool populateMailList,
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
PRInt32 nbrRecipients;
|
||||
nsXPIDLString emailAddr;
|
||||
nsXPIDLString addr;
|
||||
nsString emailAddr;
|
||||
nsString addr;
|
||||
addressArray->GetCount(&nbrRecipients);
|
||||
|
||||
for (j = 0; j < nbrRecipients; j ++)
|
||||
|
@ -4286,7 +4266,7 @@ NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients(PRBool populateMailList,
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsMsgRecipient* recipient = new nsMsgRecipient(nsAutoString(addr), nsAutoString(emailAddr));
|
||||
nsMsgRecipient* recipient = new nsMsgRecipient(addr, emailAddr);
|
||||
if (!recipient)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(recipient);
|
||||
|
@ -4340,7 +4320,7 @@ NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients(PRBool populateMailList,
|
|||
|
||||
nsCOMPtr<nsIRDFResource> source(do_QueryInterface(abDirectory));
|
||||
|
||||
nsXPIDLCString uri;
|
||||
nsCString uri;
|
||||
rv = source->GetValue(getter_Copies(uri));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -4405,7 +4385,7 @@ NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients(PRBool populateMailList,
|
|||
|
||||
if (parser)
|
||||
{
|
||||
nsXPIDLCString fullAddress;
|
||||
nsCString fullAddress;
|
||||
|
||||
parser->MakeFullAddress(nsnull, NS_ConvertUTF16toUTF8(pDisplayName).get(),
|
||||
NS_ConvertUTF16toUTF8(pEmail).get(), getter_Copies(fullAddress));
|
||||
|
@ -4502,8 +4482,8 @@ NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients(PRBool populateMailList,
|
|||
*/
|
||||
nsAutoString recipientsStr;
|
||||
nsAutoString nonHtmlRecipientsStr;
|
||||
nsXPIDLString plaintextDomains;
|
||||
nsXPIDLString htmlDomains;
|
||||
nsString plaintextDomains;
|
||||
nsString htmlDomains;
|
||||
nsAutoString domain;
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch (do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
|
@ -5165,15 +5145,15 @@ nsMsgMailList::nsMsgMailList(nsString listName, nsString listDescription, nsIAbD
|
|||
|
||||
if (parser)
|
||||
{
|
||||
nsXPIDLCString utf8Email;
|
||||
nsCString utf8Email;
|
||||
if (listDescription.IsEmpty())
|
||||
CopyUTF16toUTF8(listName, utf8Email);
|
||||
else
|
||||
CopyUTF16toUTF8(listDescription, utf8Email);
|
||||
|
||||
nsXPIDLCString fullAddress;
|
||||
nsCString fullAddress;
|
||||
parser->MakeFullAddress(nsnull, NS_ConvertUTF16toUTF8(listName).get(),
|
||||
utf8Email, getter_Copies(fullAddress));
|
||||
utf8Email.get(), getter_Copies(fullAddress));
|
||||
if (!fullAddress.IsEmpty())
|
||||
{
|
||||
/* We need to convert back the result from UTF-8 to Unicode */
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "nsISupportsArray.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIMsgIdentity.h"
|
||||
#include "nsISmtpUrl.h"
|
||||
#include "nsIURI.h"
|
||||
|
@ -528,14 +527,14 @@ NS_IMETHODIMP nsMsgComposeService::GetParamsForMailto(nsIURI * aURI, nsIMsgCompo
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
MSG_ComposeFormat requestedComposeFormat = nsIMsgCompFormat::Default;
|
||||
nsXPIDLCString aToPart;
|
||||
nsXPIDLCString aCcPart;
|
||||
nsXPIDLCString aBccPart;
|
||||
nsXPIDLCString aSubjectPart;
|
||||
nsXPIDLCString aBodyPart;
|
||||
nsXPIDLCString aNewsgroup;
|
||||
nsXPIDLCString aRefPart;
|
||||
nsXPIDLCString aHTMLBodyPart;
|
||||
nsCString aToPart;
|
||||
nsCString aCcPart;
|
||||
nsCString aBccPart;
|
||||
nsCString aSubjectPart;
|
||||
nsCString aBodyPart;
|
||||
nsCString aNewsgroup;
|
||||
nsCString aRefPart;
|
||||
nsCString aHTMLBodyPart;
|
||||
|
||||
// we are explictly not allowing attachments to be specified in mailto: urls
|
||||
// as it's a potential security problem.
|
||||
|
@ -570,7 +569,7 @@ NS_IMETHODIMP nsMsgComposeService::GetParamsForMailto(nsIURI * aURI, nsIMsgCompo
|
|||
// Create the appropriate output sink
|
||||
nsCOMPtr<nsIContentSink> sink = do_CreateInstance(MOZ_SANITIZINGHTMLSERIALIZER_CONTRACTID);
|
||||
|
||||
nsXPIDLCString allowedTags;
|
||||
nsCString allowedTags;
|
||||
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
if (prefs)
|
||||
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->SetBcc(NS_ConvertUTF8toUTF16(aBccPart));
|
||||
pMsgCompFields->SetNewsgroups(NS_ConvertUTF8toUTF16(aNewsgroup));
|
||||
pMsgCompFields->SetReferences(aRefPart);
|
||||
pMsgCompFields->SetReferences(aRefPart.get());
|
||||
pMsgCompFields->SetSubject(NS_ConvertUTF8toUTF16(aSubjectPart));
|
||||
pMsgCompFields->SetBody(composeHTMLFormat ? sanitizedBody : rawBody);
|
||||
pMsgComposeParams->SetComposeFields(pMsgCompFields);
|
||||
|
@ -921,14 +920,14 @@ NS_IMETHODIMP nsMsgTemplateReplyHelper::OnStopRunningUrl(nsIURI *aUrl, nsresult
|
|||
if (NS_FAILED(rv) || (!pMsgComposeParams) ) return rv ;
|
||||
nsCOMPtr<nsIMsgCompFields> compFields = do_CreateInstance(NS_MSGCOMPFIELDS_CONTRACTID, &rv) ;
|
||||
|
||||
nsXPIDLCString replyTo;
|
||||
nsCString replyTo;
|
||||
mHdrToReplyTo->GetStringProperty("replyTo", getter_Copies(replyTo));
|
||||
if (replyTo.IsEmpty())
|
||||
mHdrToReplyTo->GetAuthor(getter_Copies(replyTo));
|
||||
compFields->SetTo(NS_ConvertUTF8toUTF16(replyTo));
|
||||
|
||||
nsAutoString body;
|
||||
nsXPIDLString templateSubject, replySubject;
|
||||
nsString body;
|
||||
nsString templateSubject, replySubject;
|
||||
|
||||
mTemplateHdr->GetMime2DecodedSubject(getter_Copies(templateSubject));
|
||||
mHdrToReplyTo->GetMime2DecodedSubject(getter_Copies(replySubject));
|
||||
|
@ -939,7 +938,7 @@ NS_IMETHODIMP nsMsgTemplateReplyHelper::OnStopRunningUrl(nsIURI *aUrl, nsresult
|
|||
templateSubject.Append(NS_LITERAL_STRING(")"));
|
||||
}
|
||||
compFields->SetSubject(templateSubject);
|
||||
body.AssignWithConversion(mTemplateBody);
|
||||
CopyASCIItoUTF16(mTemplateBody, body);
|
||||
compFields->SetBody(body);
|
||||
|
||||
nsCString msgUri;
|
||||
|
@ -1293,13 +1292,13 @@ nsresult nsMsgComposeService::AddGlobalHtmlDomains()
|
|||
// Update the list as needed
|
||||
if (htmlDomainListCurrentVersion <= htmlDomainListDefaultVersion) {
|
||||
// Get list of global domains need to be added
|
||||
nsXPIDLCString globalHtmlDomainList;
|
||||
nsCString globalHtmlDomainList;
|
||||
rv = prefBranch->GetCharPref(HTMLDOMAINUPDATE_DOMAINLIST_PREF_NAME, getter_Copies(globalHtmlDomainList));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && !globalHtmlDomainList.IsEmpty()) {
|
||||
|
||||
// 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));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
|
@ -1310,7 +1309,7 @@ nsresult nsMsgComposeService::AddGlobalHtmlDomains()
|
|||
htmlDomainArray.ParseString(currentHtmlDomainList.get(), DOMAIN_DELIMITER);
|
||||
|
||||
// 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));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsMsgCopy.h"
|
||||
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsMsgFolderFlags.h"
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include "nsIPrompt.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsMsgComposeStringBundle.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsMsgCompCID.h"
|
||||
|
||||
nsresult
|
||||
|
@ -50,12 +49,10 @@ nsMsgBuildErrorMessageByID(PRInt32 msgID, nsString& retval, nsString* param0, ns
|
|||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIMsgStringService> composebundle (do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID, &rv));
|
||||
nsXPIDLString msg;
|
||||
|
||||
if (composebundle)
|
||||
{
|
||||
composebundle->GetStringByID(msgID, getter_Copies(msg));
|
||||
retval = msg;
|
||||
composebundle->GetStringByID(msgID, getter_Copies(retval));
|
||||
|
||||
nsString target;
|
||||
if (param0)
|
||||
|
@ -78,12 +75,12 @@ nsMsgDisplayMessageByID(nsIPrompt * aPrompt, PRInt32 msgID, const PRUnichar * wi
|
|||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIMsgStringService> composebundle (do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID, &rv));
|
||||
nsXPIDLString msg;
|
||||
nsString msg;
|
||||
|
||||
if (composebundle)
|
||||
{
|
||||
composebundle->GetStringByID(msgID, getter_Copies(msg));
|
||||
rv = nsMsgDisplayMessageByString(aPrompt, msg, windowTitle);
|
||||
rv = nsMsgDisplayMessageByString(aPrompt, msg.get(), windowTitle);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -113,12 +110,12 @@ nsresult
|
|||
nsMsgAskBooleanQuestionByID(nsIPrompt * aPrompt, PRInt32 msgID, PRBool *answer, const PRUnichar * windowTitle)
|
||||
{
|
||||
nsCOMPtr<nsIMsgStringService> composebundle (do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID));
|
||||
nsXPIDLString msg;
|
||||
nsString msg;
|
||||
|
||||
if (composebundle)
|
||||
{
|
||||
composebundle->GetStringByID(msgID, getter_Copies(msg));
|
||||
nsMsgAskBooleanQuestionByString(aPrompt, msg, answer, windowTitle);
|
||||
nsMsgAskBooleanQuestionByString(aPrompt, msg.get(), answer, windowTitle);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -179,10 +176,10 @@ nsMsgAskAboutUncoveredCharacters(nsIPrompt * aPrompt)
|
|||
getter_AddRefs(composeBundle));
|
||||
NS_ENSURE_TRUE(composeBundle, 0);
|
||||
|
||||
nsXPIDLString title;
|
||||
nsXPIDLString msg;
|
||||
nsXPIDLString sendInUTF8;
|
||||
nsXPIDLString sendAnyway;
|
||||
nsString title;
|
||||
nsString msg;
|
||||
nsString sendInUTF8;
|
||||
nsString sendAnyway;
|
||||
|
||||
composeBundle->
|
||||
GetStringFromName(NS_LITERAL_STRING("initErrorDlogTitle").get(),
|
||||
|
@ -198,12 +195,12 @@ nsMsgAskAboutUncoveredCharacters(nsIPrompt * aPrompt)
|
|||
getter_Copies(sendAnyway));
|
||||
|
||||
nsresult rv = dialog->
|
||||
ConfirmEx(title, msg,
|
||||
ConfirmEx(title.get(), msg.get(),
|
||||
nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_0 +
|
||||
nsIPrompt::BUTTON_TITLE_CANCEL * nsIPrompt::BUTTON_POS_1 +
|
||||
nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_2 +
|
||||
nsIPrompt::BUTTON_POS_0_DEFAULT,
|
||||
sendInUTF8, nsnull, sendAnyway, nsnull, 0, &result);
|
||||
sendInUTF8.get(), nsnull, sendAnyway.get(), nsnull, 0, &result);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, 0);
|
||||
return result;
|
||||
|
|
|
@ -58,7 +58,6 @@
|
|||
#include "nsMsgCompCID.h"
|
||||
#include "nsMsgCompose.h"
|
||||
#include "nsMsgMailNewsUrl.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsMsgQuoteListener)
|
||||
NS_IMPL_THREADSAFE_RELEASE(nsMsgQuoteListener)
|
||||
|
|
|
@ -65,7 +65,6 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "nsIFileURL.h"
|
||||
#include "nsMsgCopy.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsMsgPrompts.h"
|
||||
|
@ -528,7 +527,7 @@ nsMsgComposeAndSend::GatherMimeAttachments()
|
|||
PRBool plaintext_is_mainbody_p = PR_FALSE; // only using text converted from HTML?
|
||||
char *buffer = 0;
|
||||
char *buffer_tail = 0;
|
||||
nsXPIDLString msg;
|
||||
nsString msg;
|
||||
PRBool tonews;
|
||||
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");
|
||||
|
||||
mComposeBundle->GetStringByID(NS_MSG_ASSEMBLING_MSG, getter_Copies(msg));
|
||||
SetStatusMessage( msg );
|
||||
SetStatusMessage(msg);
|
||||
|
||||
/* First, open the message file.
|
||||
*/
|
||||
|
@ -1107,7 +1106,7 @@ nsMsgComposeAndSend::GatherMimeAttachments()
|
|||
|
||||
// Tell the user we are creating the message...
|
||||
mComposeBundle->GetStringByID(NS_MSG_CREATING_MESSAGE, getter_Copies(msg));
|
||||
SetStatusMessage( msg );
|
||||
SetStatusMessage(msg);
|
||||
|
||||
// OK, now actually write the structure we've carefully built up.
|
||||
status = toppart->Write();
|
||||
|
@ -1149,7 +1148,7 @@ nsMsgComposeAndSend::GatherMimeAttachments()
|
|||
}
|
||||
|
||||
mComposeBundle->GetStringByID(NS_MSG_ASSEMB_DONE_MSG, getter_Copies(msg));
|
||||
SetStatusMessage( msg );
|
||||
SetStatusMessage(msg);
|
||||
|
||||
if (m_dont_deliver_p && mListener)
|
||||
{
|
||||
|
@ -1239,7 +1238,7 @@ nsMsgComposeAndSend::PreProcessPart(nsMsgAttachmentHandler *ma,
|
|||
if (NS_FAILED(status))
|
||||
return 0;
|
||||
|
||||
nsXPIDLCString turl;
|
||||
nsCString turl;
|
||||
if (!ma->mURL)
|
||||
{
|
||||
if (ma->m_uri)
|
||||
|
@ -1254,7 +1253,7 @@ nsMsgComposeAndSend::PreProcessPart(nsMsgAttachmentHandler *ma,
|
|||
ma->m_x_mac_type,
|
||||
ma->m_x_mac_creator,
|
||||
ma->m_real_name,
|
||||
turl,
|
||||
turl.get(),
|
||||
m_digest_p,
|
||||
ma,
|
||||
ma->m_charset, // rhp - this needs
|
||||
|
@ -1742,7 +1741,7 @@ nsMsgComposeAndSend::GetBodyFromEditor()
|
|||
const char *attachment1_type = TEXT_HTML;
|
||||
|
||||
// Convert body to mail charset
|
||||
nsXPIDLCString outCString;
|
||||
nsCString outCString;
|
||||
const char *aCharset = mCompFields->GetCharacterSet();
|
||||
|
||||
if (aCharset && *aCharset)
|
||||
|
@ -1769,7 +1768,7 @@ nsMsgComposeAndSend::GetBodyFromEditor()
|
|||
bodyTextPtr++;
|
||||
}
|
||||
|
||||
nsXPIDLCString fallbackCharset;
|
||||
nsCString fallbackCharset;
|
||||
rv = nsMsgI18NSaveAsCharset(TEXT_PLAIN, aCharset, bodyText,
|
||||
getter_Copies(outCString), getter_Copies(fallbackCharset));
|
||||
|
||||
|
@ -1794,7 +1793,7 @@ nsMsgComposeAndSend::GetBodyFromEditor()
|
|||
}
|
||||
}
|
||||
// re-label to the fallback charset
|
||||
else if (fallbackCharset)
|
||||
else if (!fallbackCharset.IsEmpty())
|
||||
mCompFields->SetCharacterSet(fallbackCharset.get());
|
||||
}
|
||||
|
||||
|
@ -2193,7 +2192,7 @@ nsMsgComposeAndSend::CountCompFieldAttachments()
|
|||
|
||||
//Parse the attachments array
|
||||
nsCOMPtr<nsIMsgAttachment> element;
|
||||
nsXPIDLCString url;
|
||||
nsCString url;
|
||||
for (i = 0; i < attachmentCount; i ++)
|
||||
{
|
||||
attachmentsArray->QueryElementAt(i, NS_GET_IID(nsIMsgAttachment), getter_AddRefs(element));
|
||||
|
@ -2248,7 +2247,7 @@ nsMsgComposeAndSend::AddCompFieldLocalAttachments()
|
|||
|
||||
//Parse the attachments array
|
||||
nsCOMPtr<nsIMsgAttachment> element;
|
||||
nsXPIDLCString url;
|
||||
nsCString url;
|
||||
for (i = 0; i < attachmentCount; i ++)
|
||||
{
|
||||
attachmentsArray->QueryElementAt(i, NS_GET_IID(nsIMsgAttachment), getter_AddRefs(element));
|
||||
|
@ -2257,162 +2256,162 @@ nsMsgComposeAndSend::AddCompFieldLocalAttachments()
|
|||
element->GetUrl(getter_Copies(url));
|
||||
if (!url.IsEmpty())
|
||||
{
|
||||
// Just look for local file:// attachments and do the right thing.
|
||||
if (nsMsgIsLocalFile(url.get()))
|
||||
{
|
||||
#if defined(DEBUG_ducarroz)
|
||||
printf("Adding LOCAL attachment %d: %s\n", newLoc, url.get());
|
||||
#endif
|
||||
//
|
||||
// Now we have to setup the m_attachments entry for the file://
|
||||
// URL that is passed in...
|
||||
//
|
||||
m_attachments[newLoc].mDeleteFile = PR_FALSE;
|
||||
// Just look for local file:// attachments and do the right thing.
|
||||
if (nsMsgIsLocalFile(url.get()))
|
||||
{
|
||||
#if defined(DEBUG_ducarroz)
|
||||
printf("Adding LOCAL attachment %d: %s\n", newLoc, url.get());
|
||||
#endif
|
||||
//
|
||||
// Now we have to setup the m_attachments entry for the file://
|
||||
// URL that is passed in...
|
||||
//
|
||||
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].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)
|
||||
if (m_attachments[newLoc].mTmpFile)
|
||||
{
|
||||
nsCOMPtr<nsIURL> fileUrl(do_CreateInstance(NS_STANDARDURL_CONTRACTID));
|
||||
if (fileUrl)
|
||||
{
|
||||
nsCAutoString fileExt;
|
||||
//First try using the real file name
|
||||
rv = fileUrl->SetFileName(nsDependentCString(m_attachments[newLoc].m_real_name));
|
||||
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);
|
||||
}
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
//Then try using the url if we still haven't figured out the content type
|
||||
if ((!m_attachments[newLoc].m_type) || (!*m_attachments[newLoc].m_type))
|
||||
// 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 (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))
|
||||
{
|
||||
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
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
//Then try using the url if we still haven't figured out the content type
|
||||
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
|
||||
{
|
||||
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)
|
||||
else
|
||||
{
|
||||
char *tmpCharset = (char *)nsMsgI18NParseMetaCharset(m_attachments[newLoc].mTmpFile);
|
||||
if (tmpCharset[0] != '\0')
|
||||
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)
|
||||
{
|
||||
PR_FREEIF(m_attachments[newLoc].m_charset);
|
||||
m_attachments[newLoc].m_charset = PL_strdup(tmpCharset);
|
||||
char *tmpCharset = (char *)nsMsgI18NParseMetaCharset(m_attachments[newLoc].mTmpFile);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -2438,7 +2437,7 @@ nsMsgComposeAndSend::AddCompFieldRemoteAttachments(PRUint32 aStartLocation,
|
|||
|
||||
//Parse the attachments array
|
||||
nsCOMPtr<nsIMsgAttachment> element;
|
||||
nsXPIDLCString url;
|
||||
nsCString url;
|
||||
for (i = 0; i < attachmentCount; i ++)
|
||||
{
|
||||
attachmentsArray->QueryElementAt(i, NS_GET_IID(nsIMsgAttachment), getter_AddRefs(element));
|
||||
|
@ -2770,17 +2769,17 @@ nsMsgComposeAndSend::HackAttachments(const nsMsgAttachmentData *attachments,
|
|||
// Display some feedback to user...
|
||||
PRUnichar *printfString = nsnull;
|
||||
|
||||
nsXPIDLString msg;
|
||||
nsString msg;
|
||||
mComposeBundle->GetStringByID(NS_MSG_GATHERING_ATTACHMENT, getter_Copies(msg));
|
||||
|
||||
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
|
||||
printfString = nsTextFormatter::smprintf(msg, "");
|
||||
printfString = nsTextFormatter::smprintf(msg.get(), "");
|
||||
|
||||
if (printfString)
|
||||
{
|
||||
SetStatusMessage(printfString);
|
||||
SetStatusMessage(nsDependentString(printfString));
|
||||
PR_Free(printfString);
|
||||
}
|
||||
|
||||
|
@ -2792,7 +2791,7 @@ nsMsgComposeAndSend::HackAttachments(const nsMsgAttachmentData *attachments,
|
|||
nsresult status = m_attachments[i].SnarfAttachment(mCompFields);
|
||||
if (NS_FAILED(status))
|
||||
{
|
||||
nsXPIDLString errorMsg;
|
||||
nsString errorMsg;
|
||||
nsAutoString attachmentFileName;
|
||||
nsresult rv = ConvertToUnicode(nsMsgI18NFileSystemCharset(), m_attachments[i].m_real_name, attachmentFileName);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
@ -2803,7 +2802,7 @@ nsMsgComposeAndSend::HackAttachments(const nsMsgAttachmentData *attachments,
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -3230,13 +3229,13 @@ nsMsgComposeAndSend::Init(
|
|||
//Let make sure we retreive the correct number of related parts. It may have changed since last time
|
||||
GetMultipartRelatedCount(PR_TRUE);
|
||||
|
||||
nsXPIDLString msg;
|
||||
nsString msg;
|
||||
if (!mComposeBundle)
|
||||
mComposeBundle = do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID);
|
||||
|
||||
// Tell the user we are assembling the message...
|
||||
mComposeBundle->GetStringByID(NS_MSG_ASSEMBLING_MESSAGE, getter_Copies(msg));
|
||||
SetStatusMessage( msg );
|
||||
SetStatusMessage(msg);
|
||||
if (mSendReport)
|
||||
mSendReport->SetCurrentProcess(nsIMsgSendReport::process_BuildMessage);
|
||||
|
||||
|
@ -3414,12 +3413,12 @@ nsMsgComposeAndSend::DeliverMessage()
|
|||
{
|
||||
PRBool abortTheSend = PR_FALSE;
|
||||
|
||||
nsXPIDLString msg;
|
||||
nsString 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)
|
||||
{
|
||||
|
@ -3501,11 +3500,11 @@ nsMsgComposeAndSend::DeliverFileAsMail()
|
|||
|
||||
if (!buf)
|
||||
{
|
||||
nsXPIDLString eMsg;
|
||||
nsString eMsg;
|
||||
mComposeBundle->GetStringByID(NS_ERROR_OUT_OF_MEMORY, getter_Copies(eMsg));
|
||||
|
||||
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);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -3614,9 +3613,9 @@ nsMsgComposeAndSend::DeliverFileAsMail()
|
|||
GetNotificationCallbacks(getter_AddRefs(callbacks));
|
||||
|
||||
// Tell the user we are sending the message!
|
||||
nsXPIDLString msg;
|
||||
nsString msg;
|
||||
mComposeBundle->GetStringByID(NS_MSG_SENDING_MESSAGE, getter_Copies(msg));
|
||||
SetStatusMessage( msg );
|
||||
SetStatusMessage(msg);
|
||||
nsCOMPtr<nsIMsgStatusFeedback> msgStatus (do_QueryInterface(mSendProgress));
|
||||
// if the sendProgress isn't set, let's use the member variable.
|
||||
if (!msgStatus)
|
||||
|
@ -3657,9 +3656,9 @@ nsMsgComposeAndSend::DeliverFileAsNews()
|
|||
// using callbacks for notification
|
||||
|
||||
// Tell the user we are posting the message!
|
||||
nsXPIDLString msg;
|
||||
nsString msg;
|
||||
mComposeBundle->GetStringByID(NS_MSG_POSTING_MESSAGE, getter_Copies(msg));
|
||||
SetStatusMessage( msg );
|
||||
SetStatusMessage(msg);
|
||||
|
||||
nsCOMPtr <nsIMsgMailSession> mailSession = do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -3733,14 +3732,14 @@ nsMsgComposeAndSend::FormatStringWithSMTPHostNameByID(PRInt32 aMsgId, PRUnichar
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// Get the smtp hostname and format the string.
|
||||
nsXPIDLCString smtpHostName;
|
||||
nsCString smtpHostName;
|
||||
nsCOMPtr<nsISmtpServer> smtpServer;
|
||||
rv = smtpService->GetSmtpServerByIdentity(mUserIdentity, getter_AddRefs(smtpServer));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
smtpServer->GetHostname(getter_Copies(smtpHostName));
|
||||
|
||||
nsAutoString hostStr;
|
||||
hostStr.AssignWithConversion(smtpHostName.get());
|
||||
CopyASCIItoUTF16(smtpHostName, hostStr);
|
||||
const PRUnichar *params[] = { hostStr.get() };
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
rv = mComposeBundle->GetBundle(getter_AddRefs(bundle));
|
||||
|
@ -3760,7 +3759,7 @@ nsMsgComposeAndSend::DoDeliveryExitProcessing(nsIURI * aUri, nsresult aExitCode,
|
|||
printf("\nMessage Delivery Failed!\n");
|
||||
#endif
|
||||
|
||||
nsXPIDLString eMsg;
|
||||
nsString eMsg;
|
||||
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_WITH_STARTTLS1 ||
|
||||
|
@ -3769,7 +3768,7 @@ nsMsgComposeAndSend::DoDeliveryExitProcessing(nsIURI * aUri, nsresult aExitCode,
|
|||
else
|
||||
mComposeBundle->GetStringByID(aExitCode, getter_Copies(eMsg));
|
||||
|
||||
Fail(aExitCode, eMsg, &aExitCode);
|
||||
Fail(aExitCode, eMsg.get(), &aExitCode);
|
||||
NotifyListenerOnStopSending(nsnull, aExitCode, nsnull, nsnull);
|
||||
return;
|
||||
}
|
||||
|
@ -4022,14 +4021,14 @@ nsMsgComposeAndSend::NotifyListenerOnStopCopy(nsresult aStatus)
|
|||
}
|
||||
|
||||
// Set a status message...
|
||||
nsXPIDLString msg;
|
||||
nsString msg;
|
||||
|
||||
if (NS_SUCCEEDED(aStatus))
|
||||
mComposeBundle->GetStringByID(NS_MSG_START_COPY_MESSAGE_COMPLETE, getter_Copies(msg));
|
||||
else
|
||||
mComposeBundle->GetStringByID(NS_MSG_START_COPY_MESSAGE_FAILED, getter_Copies(msg));
|
||||
|
||||
SetStatusMessage( msg );
|
||||
SetStatusMessage(msg);
|
||||
nsCOMPtr<nsIPrompt> prompt;
|
||||
GetDefaultPrompt(getter_AddRefs(prompt));
|
||||
|
||||
|
@ -4499,7 +4498,7 @@ nsMsgComposeAndSend::MimeDoFCC(nsIFile *input_file,
|
|||
printfString = nsTextFormatter::smprintf(msg.get(), "?");
|
||||
if (printfString)
|
||||
{
|
||||
SetStatusMessage(printfString);
|
||||
SetStatusMessage(nsDependentString(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
|
||||
//without any chance of crashing due to holding onto a deleted feedback.
|
||||
nsresult
|
||||
nsMsgComposeAndSend::SetStatusMessage(const PRUnichar *aMsgString)
|
||||
nsMsgComposeAndSend::SetStatusMessage(const nsString &aMsgString)
|
||||
{
|
||||
if (mSendProgress)
|
||||
mSendProgress->OnStatusChange(nsnull, nsnull, 0, aMsgString);
|
||||
mSendProgress->OnStatusChange(nsnull, nsnull, 0, aMsgString.get());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ public:
|
|||
// For part processing
|
||||
|
||||
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
|
||||
|
|
|
@ -62,7 +62,6 @@
|
|||
#include "nsIMsgSendLaterListener.h"
|
||||
#include "nsMsgCopy.h"
|
||||
#include "nsMsgComposeStringBundle.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsISmtpUrl.h"
|
||||
|
@ -475,8 +474,8 @@ nsMsgSendLater::CompleteMailFileSend()
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Get the recipients...
|
||||
nsXPIDLCString recips;
|
||||
nsXPIDLCString ccList;
|
||||
nsCString recips;
|
||||
nsCString ccList;
|
||||
if (NS_FAILED(mMessage->GetRecipients(getter_Copies(recips))))
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
else
|
||||
|
@ -494,12 +493,12 @@ nsMsgSendLater::CompleteMailFileSend()
|
|||
// Since we have already parsed all of the headers, we are simply going to
|
||||
// set the composition fields and move on.
|
||||
//
|
||||
nsXPIDLCString author;
|
||||
nsCString author;
|
||||
mMessage->GetAuthor(getter_Copies(author));
|
||||
|
||||
nsMsgCompFields * fields = (nsMsgCompFields *)compFields.get();
|
||||
|
||||
nsXPIDLCString decodedString;
|
||||
nsCString decodedString;
|
||||
// decoded string is null if the input is not MIME encoded
|
||||
mimeConverter->DecodeMimeHeader(author.get(), getter_Copies(decodedString));
|
||||
|
||||
|
@ -706,21 +705,18 @@ nsresult nsMsgSendLater::SetOrigMsgDisposition()
|
|||
// and see if we need to set replied/forwarded
|
||||
// flags for the original message that this message might be a reply to
|
||||
// or forward of.
|
||||
nsXPIDLCString originalMsgURIs;
|
||||
nsXPIDLCString queuedDisposition;
|
||||
nsCString originalMsgURIs;
|
||||
nsCString queuedDisposition;
|
||||
mMessage->GetStringProperty(ORIG_URI_PROPERTY, getter_Copies(originalMsgURIs));
|
||||
mMessage->GetStringProperty(QUEUED_DISPOSITION_PROPERTY, getter_Copies(queuedDisposition));
|
||||
if (!queuedDisposition.IsEmpty())
|
||||
{
|
||||
char *uriList = PL_strdup(originalMsgURIs.get());
|
||||
if (!uriList)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
char *newStr = uriList;
|
||||
char *uri;
|
||||
while (nsnull != (uri = nsCRT::strtok(newStr, ",", &newStr)))
|
||||
nsCStringArray uriArray;
|
||||
uriArray.ParseString(originalMsgURIs.get(), ",");
|
||||
for (PRInt32 i = 0; i < uriArray.Count(); i++)
|
||||
{
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
nsresult rv = GetMsgDBHdrFromURI(uri, getter_AddRefs(msgHdr));
|
||||
nsresult rv = GetMsgDBHdrFromURI(uriArray[i]->get(), getter_AddRefs(msgHdr));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
if (msgHdr)
|
||||
{
|
||||
|
@ -737,7 +733,6 @@ nsresult nsMsgSendLater::SetOrigMsgDisposition()
|
|||
}
|
||||
}
|
||||
}
|
||||
PR_Free(uriList);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -219,9 +219,9 @@ NS_IMETHODIMP nsMsgSendReport::SetMessage(PRInt32 process, const PRUnichar *mess
|
|||
if (!mProcessReport[process])
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsXPIDLString currMessage;
|
||||
nsString currMessage;
|
||||
mProcessReport[process]->GetMessage(getter_Copies(currMessage));
|
||||
if (overwriteMessage || (!currMessage) || (const char *)currMessage[0] == 0)
|
||||
if (overwriteMessage || currMessage.IsEmpty())
|
||||
return mProcessReport[process]->SetMessage(message);
|
||||
else
|
||||
return NS_OK;
|
||||
|
@ -237,8 +237,7 @@ NS_IMETHODIMP nsMsgSendReport::GetProcessReport(PRInt32 process, nsIMsgProcessRe
|
|||
if (process == process_Current)
|
||||
process = mCurrentProcess;
|
||||
|
||||
*_retval = mProcessReport[process];
|
||||
NS_IF_ADDREF(*_retval);
|
||||
NS_IF_ADDREF(*_retval = mProcessReport[process]);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -257,7 +256,7 @@ NS_IMETHODIMP nsMsgSendReport::DisplayReport(nsIPrompt *prompt, PRBool showError
|
|||
if (showErrorOnly && NS_SUCCEEDED(currError))
|
||||
return NS_OK;
|
||||
|
||||
nsXPIDLString currMessage;
|
||||
nsString currMessage;
|
||||
mProcessReport[mCurrentProcess]->GetMessage(getter_Copies(currMessage));
|
||||
|
||||
|
||||
|
@ -269,8 +268,8 @@ NS_IMETHODIMP nsMsgSendReport::DisplayReport(nsIPrompt *prompt, PRBool showError
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsXPIDLString dialogTitle;
|
||||
nsXPIDLString dialogMessage;
|
||||
nsString dialogTitle;
|
||||
nsString dialogMessage;
|
||||
|
||||
if (NS_SUCCEEDED(currError))
|
||||
{
|
||||
|
@ -360,34 +359,29 @@ NS_IMETHODIMP nsMsgSendReport::DisplayReport(nsIPrompt *prompt, PRBool showError
|
|||
|
||||
if (!currMessage.IsEmpty())
|
||||
{
|
||||
nsAutoString temp((const PRUnichar *)dialogMessage); // Because of bug 74726, we cannot use directly an XPIDLString
|
||||
|
||||
//Don't need to repeat ourself!
|
||||
if (! currMessage.Equals(temp))
|
||||
if (!currMessage.Equals(dialogMessage))
|
||||
{
|
||||
if (! dialogMessage.IsEmpty())
|
||||
temp.AppendLiteral("\n");
|
||||
temp.Append(currMessage);
|
||||
dialogMessage.Assign(temp);
|
||||
if (!dialogMessage.IsEmpty())
|
||||
dialogMessage.Append(PRUnichar('\n'));
|
||||
dialogMessage.Append(currMessage);
|
||||
}
|
||||
}
|
||||
|
||||
if (askToGoBackToCompose)
|
||||
{
|
||||
PRBool oopsGiveMeBackTheComposeWindow = PR_TRUE;
|
||||
nsXPIDLString text1;
|
||||
nsString 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())
|
||||
temp.AppendLiteral("\n");
|
||||
temp.Append(text1);
|
||||
dialogMessage.Assign(temp);
|
||||
nsMsgAskBooleanQuestionByString(prompt, dialogMessage, &oopsGiveMeBackTheComposeWindow, dialogTitle);
|
||||
dialogMessage.AppendLiteral("\n");
|
||||
dialogMessage.Append(text1);
|
||||
nsMsgAskBooleanQuestionByString(prompt, dialogMessage.get(), &oopsGiveMeBackTheComposeWindow, dialogTitle.get());
|
||||
if (!oopsGiveMeBackTheComposeWindow)
|
||||
*_retval = NS_OK;
|
||||
}
|
||||
else
|
||||
nsMsgDisplayMessageByString(prompt, dialogMessage, dialogTitle);
|
||||
nsMsgDisplayMessageByString(prompt, dialogMessage.get(), dialogTitle.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -431,14 +425,12 @@ NS_IMETHODIMP nsMsgSendReport::DisplayReport(nsIPrompt *prompt, PRBool showError
|
|||
|
||||
if (!currMessage.IsEmpty())
|
||||
{
|
||||
nsAutoString temp((const PRUnichar *)dialogMessage); // Because of bug 74726, we cannot use directly an XPIDLString
|
||||
if (! dialogMessage.IsEmpty())
|
||||
temp.AppendLiteral("\n");
|
||||
temp.Append(currMessage);
|
||||
dialogMessage.Assign(temp);
|
||||
dialogMessage.AppendLiteral("\n");
|
||||
dialogMessage.Append(currMessage);
|
||||
}
|
||||
|
||||
nsMsgDisplayMessageByString(prompt, dialogMessage, dialogTitle);
|
||||
nsMsgDisplayMessageByString(prompt, dialogMessage.get(), dialogTitle.get());
|
||||
}
|
||||
|
||||
mAlreadyDisplayReport = PR_TRUE;
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsEnumeratorUtils.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
@ -118,7 +117,7 @@ nsSmtpDataSource::initGlobalObjects()
|
|||
/* readonly attribute string URI; */
|
||||
NS_IMETHODIMP nsSmtpDataSource::GetURI(char * *aURI)
|
||||
{
|
||||
*aURI = nsCRT::strdup("NC:smtpservers");
|
||||
*aURI = strdup("NC:smtpservers");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -141,7 +140,7 @@ nsSmtpDataSource::GetTarget(nsIRDFResource *aSource,
|
|||
PRBool aTruthValue, nsIRDFNode **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsXPIDLCString str;
|
||||
nsCString str;
|
||||
|
||||
*aResult = nsnull;
|
||||
|
||||
|
@ -166,7 +165,7 @@ nsSmtpDataSource::GetTarget(nsIRDFResource *aSource,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoString unicodeString;
|
||||
unicodeString.AssignWithConversion((const char*)str);
|
||||
CopyASCIItoUTF16(str, unicodeString);
|
||||
|
||||
nsCOMPtr<nsIRDFLiteral> literalResult;
|
||||
rv = rdf->GetLiteral(unicodeString.get(), getter_AddRefs(literalResult));
|
||||
|
@ -265,7 +264,7 @@ nsSmtpDataSource::GetSmtpServerTargets(nsISupportsArray **aResultArray)
|
|||
(void **)getter_AddRefs(smtpServer));
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
nsXPIDLCString smtpServerUri;
|
||||
nsCString smtpServerUri;
|
||||
rv = smtpServer->GetServerURI(getter_Copies(smtpServerUri));
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
|
@ -276,8 +275,7 @@ nsSmtpDataSource::GetSmtpServerTargets(nsISupportsArray **aResultArray)
|
|||
rv = smtpServerResources->AppendElement(smtpServerResource);
|
||||
}
|
||||
|
||||
*aResultArray = smtpServerResources;
|
||||
NS_ADDREF(*aResultArray);
|
||||
smtpServerResources.swap(*aResultArray);
|
||||
|
||||
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);
|
||||
|
||||
PRUnichar * msg;
|
||||
nsXPIDLString eMsg;
|
||||
nsString eMsg;
|
||||
nsCOMPtr<nsIMsgStringService> smtpBundle = do_GetService(NS_MSG_SMTPSTRINGSERVICE_CONTRACTID);
|
||||
|
||||
va_start (args, code);
|
||||
|
@ -128,11 +128,11 @@ nsresult nsExplainErrorDetails(nsISmtpUrl * aSmtpUrl, int code, ...)
|
|||
case NS_ERROR_SENDING_MESSAGE:
|
||||
case NS_ERROR_SMTP_GREETING:
|
||||
smtpBundle->GetStringByID(code, getter_Copies(eMsg));
|
||||
msg = nsTextFormatter::vsmprintf(eMsg, args);
|
||||
msg = nsTextFormatter::vsmprintf(eMsg.get(), args);
|
||||
break;
|
||||
default:
|
||||
smtpBundle->GetStringByID(NS_ERROR_COMMUNICATIONS_ERROR, getter_Copies(eMsg));
|
||||
msg = nsTextFormatter::smprintf(eMsg, code);
|
||||
msg = nsTextFormatter::smprintf(eMsg.get(), code);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -435,9 +435,9 @@ void nsSmtpProtocol::UpdateStatus(PRInt32 aStatusID)
|
|||
{
|
||||
if (m_statusFeedback)
|
||||
{
|
||||
nsXPIDLString msg;
|
||||
nsString msg;
|
||||
mSmtpBundle->GetStringByID(aStatusID, getter_Copies(msg));
|
||||
UpdateStatusWithString(msg);
|
||||
UpdateStatusWithString(msg.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1003,8 +1003,8 @@ PRInt32 nsSmtpProtocol::AuthGSSAPIFirst()
|
|||
nsCAutoString command("AUTH GSSAPI ");
|
||||
nsCAutoString resp;
|
||||
nsCAutoString service("smtp@");
|
||||
nsXPIDLCString hostName;
|
||||
nsXPIDLCString userName;
|
||||
nsCString hostName;
|
||||
nsCString userName;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISmtpServer> smtpServer;
|
||||
rv = m_runningURL->GetSmtpServer(getter_AddRefs(smtpServer));
|
||||
|
@ -1016,7 +1016,7 @@ PRInt32 nsSmtpProtocol::AuthGSSAPIFirst()
|
|||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
service.Append(hostName);
|
||||
rv = DoGSSAPIStep1(service.get(), userName, resp);
|
||||
rv = DoGSSAPIStep1(service.get(), userName.get(), resp);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
m_nextState = SMTP_AUTH_PROCESS_STATE;
|
||||
|
@ -1088,9 +1088,9 @@ PRInt32 nsSmtpProtocol::AuthLoginStep1()
|
|||
char buffer[512];
|
||||
nsresult rv;
|
||||
PRInt32 status = 0;
|
||||
nsXPIDLCString username;
|
||||
nsCString username;
|
||||
char *base64Str = nsnull;
|
||||
nsXPIDLCString origPassword;
|
||||
nsCString origPassword;
|
||||
nsCAutoString password;
|
||||
nsCOMPtr<nsISmtpServer> smtpServer;
|
||||
rv = m_runningURL->GetSmtpServer(getter_AddRefs(smtpServer));
|
||||
|
@ -1133,8 +1133,8 @@ PRInt32 nsSmtpProtocol::AuthLoginStep1()
|
|||
int len = 1; /* first <NUL> char */
|
||||
|
||||
memset(plain_string, 0, 512);
|
||||
PR_snprintf(&plain_string[1], 510, "%s", (const char*)username);
|
||||
len += PL_strlen(username);
|
||||
PR_snprintf(&plain_string[1], 510, "%s", username.get());
|
||||
len += username.Length();
|
||||
len++; /* second <NUL> char */
|
||||
PR_snprintf(&plain_string[len], 511-len, "%s", password.get());
|
||||
len += password.Length();
|
||||
|
@ -1145,8 +1145,8 @@ PRInt32 nsSmtpProtocol::AuthLoginStep1()
|
|||
else
|
||||
if (TestFlag(SMTP_AUTH_LOGIN_ENABLED))
|
||||
{
|
||||
base64Str = PL_Base64Encode((const char *)username,
|
||||
strlen((const char*)username), nsnull);
|
||||
base64Str = PL_Base64Encode(username.get(),
|
||||
username.Length(), nsnull);
|
||||
PR_snprintf(buffer, sizeof(buffer), "%.256s" CRLF, base64Str);
|
||||
}
|
||||
else
|
||||
|
@ -1172,16 +1172,13 @@ PRInt32 nsSmtpProtocol::AuthLoginStep2()
|
|||
*/
|
||||
PRInt32 status = 0;
|
||||
nsresult rv;
|
||||
nsXPIDLCString origPassword;
|
||||
nsCAutoString password;
|
||||
|
||||
if (!TestFlag(SMTP_USE_LOGIN_REDIRECTION))
|
||||
{
|
||||
rv = GetPassword(getter_Copies(origPassword));
|
||||
PRInt32 passwordLength = strlen((const char *) origPassword);
|
||||
if (!(const char*) origPassword || passwordLength == 0)
|
||||
rv = GetPassword(getter_Copies(password));
|
||||
if (password.IsEmpty())
|
||||
return NS_ERROR_SMTP_PASSWORD_UNDEFINED;
|
||||
password.Assign((const char*) origPassword);
|
||||
}
|
||||
else
|
||||
password.Assign(mLogonCookie);
|
||||
|
@ -1216,7 +1213,7 @@ PRInt32 nsSmtpProtocol::AuthLoginStep2()
|
|||
rv = m_runningURL->GetSmtpServer(getter_AddRefs(smtpServer));
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLCString userName;
|
||||
nsCString userName;
|
||||
rv = smtpServer->GetUsername(getter_Copies(userName));
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
nsXPIDLCString addresses;
|
||||
nsCString addresses;
|
||||
nsCOMPtr<nsIMsgHeaderParser> parser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID);
|
||||
|
||||
m_runningURL->GetRecipients(getter_Copies(addresses));
|
||||
|
||||
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.
|
||||
This means that people can post to mailto: URLs which contain
|
||||
|
@ -1800,7 +1797,7 @@ nsSmtpProtocol::GetPassword(char **aPassword)
|
|||
nsCRT::free(*aPassword);
|
||||
*aPassword = 0;
|
||||
|
||||
nsXPIDLCString redirectorType;
|
||||
nsCString redirectorType;
|
||||
rv = smtpServer->GetRedirectorType(getter_Copies(redirectorType));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
|
@ -1815,7 +1812,7 @@ nsSmtpProtocol::GetPassword(char **aPassword)
|
|||
rv = prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsXPIDLCString username;
|
||||
nsCString username;
|
||||
rv = smtpServer->GetUsername(getter_Copies(username));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -1833,7 +1830,7 @@ nsSmtpProtocol::GetPassword(char **aPassword)
|
|||
nsAutoString hostnameUTF16;
|
||||
if (!hideHostnameForPassword)
|
||||
{
|
||||
nsXPIDLCString hostname;
|
||||
nsCString hostname;
|
||||
rv = smtpServer->GetHostname(getter_Copies(hostname));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
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));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsXPIDLString passwordPromptString;
|
||||
nsString passwordPromptString;
|
||||
if(formatStrings[1])
|
||||
rv = composeStringBundle->FormatStringFromID(NS_SMTP_PASSWORD_PROMPT2,
|
||||
formatStrings, 2,
|
||||
|
@ -1870,11 +1867,11 @@ nsSmtpProtocol::PromptForPassword(nsISmtpServer *aSmtpServer, nsISmtpUrl *aSmtpU
|
|||
rv = aSmtpUrl->GetAuthPrompt(getter_AddRefs(netPrompt));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsXPIDLString passwordTitle;
|
||||
nsString passwordTitle;
|
||||
rv = composeStringBundle->GetStringFromID(NS_SMTP_PASSWORD_PROMPT_TITLE, getter_Copies(passwordTitle));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = aSmtpServer->GetPasswordWithUI(passwordPromptString.get(), passwordTitle,
|
||||
rv = aSmtpServer->GetPasswordWithUI(passwordPromptString.get(), passwordTitle.get(),
|
||||
netPrompt, aPassword);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
return rv;
|
||||
|
@ -1913,7 +1910,7 @@ nsSmtpProtocol::GetUsernamePassword(char **aUsername, char **aPassword)
|
|||
nsCRT::free(*aPassword);
|
||||
*aPassword = 0;
|
||||
|
||||
nsXPIDLCString hostname;
|
||||
nsCString hostname;
|
||||
rv = smtpServer->GetHostname(getter_Copies(hostname));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -1931,40 +1928,38 @@ nsSmtpProtocol::GetUsernamePassword(char **aUsername, char **aPassword)
|
|||
nsresult nsSmtpProtocol::RequestOverrideInfo(nsISmtpServer * aSmtpServer)
|
||||
{
|
||||
NS_ENSURE_ARG(aSmtpServer);
|
||||
|
||||
nsresult rv;
|
||||
nsCAutoString contractID(NS_MSGLOGONREDIRECTORSERVICE_CONTRACTID);
|
||||
|
||||
|
||||
nsresult rv;
|
||||
nsCAutoString contractID(NS_MSGLOGONREDIRECTORSERVICE_CONTRACTID);
|
||||
|
||||
// go get the redirection type...
|
||||
nsXPIDLCString redirectionTypeStr;
|
||||
nsCString 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 (!redirectionType || !*redirectionType )
|
||||
if (redirectionTypeStr.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
contractID.Append('/');
|
||||
contractID.Append(redirectionTypeStr);
|
||||
|
||||
m_logonRedirector = do_GetService(contractID.get(), &rv);
|
||||
if (m_logonRedirector && NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsXPIDLCString password;
|
||||
nsXPIDLCString userName;
|
||||
|
||||
contractID.Append('/');
|
||||
contractID.Append(redirectionTypeStr);
|
||||
|
||||
m_logonRedirector = do_GetService(contractID.get(), &rv);
|
||||
if (m_logonRedirector && NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCString password;
|
||||
nsCString userName;
|
||||
PRBool requiresPassword = PR_TRUE;
|
||||
|
||||
aSmtpServer->GetUsername(getter_Copies(userName));
|
||||
m_logonRedirector->RequiresPassword(userName, redirectionTypeStr.get(), &requiresPassword);
|
||||
|
||||
aSmtpServer->GetUsername(getter_Copies(userName));
|
||||
m_logonRedirector->RequiresPassword(userName.get(), redirectionTypeStr.get(), &requiresPassword);
|
||||
if (requiresPassword)
|
||||
GetPassword(getter_Copies(password));
|
||||
|
||||
GetPassword(getter_Copies(password));
|
||||
|
||||
nsCOMPtr<nsIPrompt> 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
|
||||
// we receive the login redirection information so set the appropriate state
|
||||
// flag
|
||||
|
@ -1976,11 +1971,11 @@ nsresult nsSmtpProtocol::RequestOverrideInfo(nsISmtpServer * aSmtpServer)
|
|||
// information. So start the url as being run.
|
||||
nsCOMPtr <nsIMsgMailNewsUrl> mailNewsUrl = do_QueryInterface(m_runningURL);
|
||||
// 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);
|
||||
// and update the status
|
||||
|
||||
return rv;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSmtpProtocol::OnLogonRedirectionError(const PRUnichar *pErrMsg, PRBool aBadPassword)
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
|
||||
#include "nsMsgProtocol.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsISmtpUrl.h"
|
||||
#include "nsIMsgStatusFeedback.h"
|
||||
#include "nsIMsgLogonRedirector.h"
|
||||
|
@ -180,8 +179,8 @@ private:
|
|||
char *m_addresses;
|
||||
PRUint32 m_addressesLeft;
|
||||
char *m_verifyAddress;
|
||||
nsXPIDLCString m_mailAddr;
|
||||
nsXPIDLCString m_helloArgument;
|
||||
nsCString m_mailAddr;
|
||||
nsCString m_helloArgument;
|
||||
PRInt32 m_sizelimit;
|
||||
|
||||
// *** the following should move to the smtp server when we support
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "nsIObserverService.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIAuthPrompt.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsISmtpUrl.h"
|
||||
#include "nsCRT.h"
|
||||
|
@ -139,7 +138,7 @@ nsSmtpServer::SetHostname(const char * aHostname)
|
|||
NS_IMETHODIMP
|
||||
nsSmtpServer::GetDescription(nsACString &aDescription)
|
||||
{
|
||||
nsXPIDLCString temp;
|
||||
nsCString temp;
|
||||
mPrefBranch->GetCharPref("description", getter_Copies(temp));
|
||||
aDescription.Assign(temp);
|
||||
return NS_OK;
|
||||
|
@ -183,7 +182,7 @@ nsSmtpServer::GetDisplayname(char * *aDisplayname)
|
|||
nsresult rv;
|
||||
NS_ENSURE_ARG_POINTER(aDisplayname);
|
||||
|
||||
nsXPIDLCString hostname;
|
||||
nsCString hostname;
|
||||
rv = mPrefBranch->GetCharPref("hostname", getter_Copies(hostname));
|
||||
if (NS_FAILED(rv)) {
|
||||
*aDisplayname=nsnull;
|
||||
|
@ -421,9 +420,9 @@ nsSmtpServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
|
|||
// prompt the user for the password
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsXPIDLString uniPassword;
|
||||
nsString uniPassword;
|
||||
PRBool okayValue = PR_TRUE;
|
||||
nsXPIDLCString serverUri;
|
||||
nsCString serverUri;
|
||||
rv = GetServerURI(getter_Copies(serverUri));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -446,7 +445,7 @@ nsSmtpServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
|
|||
}
|
||||
|
||||
// we got a password back...so remember it
|
||||
nsCString aCStr; aCStr.AssignWithConversion(uniPassword);
|
||||
nsCString aCStr; LossyCopyUTF16toASCII(uniPassword, aCStr);
|
||||
|
||||
rv = SetPassword(aCStr.get());
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -475,10 +474,10 @@ nsSmtpServer::GetUsernamePasswordWithUI(const PRUnichar * aPromptMessage, const
|
|||
// prompt the user for the password
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsXPIDLString uniUsername;
|
||||
nsXPIDLString uniPassword;
|
||||
nsString uniUsername;
|
||||
nsString uniPassword;
|
||||
PRBool okayValue = PR_TRUE;
|
||||
nsXPIDLCString serverUri;
|
||||
nsCString serverUri;
|
||||
rv = GetServerURI(getter_Copies(serverUri));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -498,12 +497,12 @@ nsSmtpServer::GetUsernamePasswordWithUI(const PRUnichar * aPromptMessage, const
|
|||
// we got a userid and password back...so remember it
|
||||
nsCString aCStr;
|
||||
|
||||
aCStr.AssignWithConversion(uniUsername);
|
||||
LossyCopyUTF16toASCII(uniUsername, aCStr);
|
||||
rv = SetUsername(aCStr.get());
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
aCStr.AssignWithConversion(uniPassword);
|
||||
LossyCopyUTF16toASCII(uniPassword, aCStr);
|
||||
rv = SetPassword(aCStr.get());
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -524,7 +523,7 @@ nsSmtpServer::ForgetPassword()
|
|||
nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsXPIDLCString serverUri;
|
||||
nsCString serverUri;
|
||||
rv = GetServerURI(getter_Copies(serverUri));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -554,26 +553,26 @@ nsSmtpServer::GetServerURI(char **aResult)
|
|||
uri += "smtp";
|
||||
uri += "://";
|
||||
|
||||
nsXPIDLCString username;
|
||||
nsCString username;
|
||||
rv = GetUsername(getter_Copies(username));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && ((const char*)username) && username[0]) {
|
||||
nsXPIDLCString escapedUsername;
|
||||
if (NS_SUCCEEDED(rv) && !username.IsEmpty()) {
|
||||
nsCString escapedUsername;
|
||||
*((char **)getter_Copies(escapedUsername)) =
|
||||
nsEscape(username, url_XAlphas);
|
||||
nsEscape(username.get(), url_XAlphas);
|
||||
// nsEscape(username, url_Path);
|
||||
// not all servers have a username
|
||||
uri.Append(escapedUsername);
|
||||
uri += '@';
|
||||
}
|
||||
|
||||
nsXPIDLCString hostname;
|
||||
nsCString hostname;
|
||||
rv = GetHostname(getter_Copies(hostname));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && ((const char*)hostname) && hostname[0]) {
|
||||
nsXPIDLCString escapedHostname;
|
||||
if (NS_SUCCEEDED(rv) && !hostname.IsEmpty()) {
|
||||
nsCString escapedHostname;
|
||||
*((char **)getter_Copies(escapedHostname)) =
|
||||
nsEscape(hostname, url_Path);
|
||||
nsEscape(hostname.get(), url_Path);
|
||||
// not all servers have a hostname
|
||||
uri.Append(escapedHostname);
|
||||
}
|
||||
|
@ -606,9 +605,9 @@ nsSmtpServer::GetRedirectorType(char **aResult)
|
|||
{
|
||||
if (!nsCRT::strcasecmp(*aResult, "aol"))
|
||||
{
|
||||
nsXPIDLCString hostName;
|
||||
nsCString 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);
|
||||
rv = SetRedirectorType("netscape");
|
||||
|
@ -622,7 +621,7 @@ nsSmtpServer::GetRedirectorType(char **aResult)
|
|||
// created redirected accounts as regular imap accounts,
|
||||
// they won't have redirector type set properly
|
||||
// this fixes the redirector type for them automatically
|
||||
nsXPIDLCString hostName;
|
||||
nsCString hostName;
|
||||
rv = GetHostname(getter_Copies(hostName));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
|
@ -632,7 +631,7 @@ nsSmtpServer::GetRedirectorType(char **aResult)
|
|||
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
nsXPIDLCString defaultRedirectorType;
|
||||
nsCString defaultRedirectorType;
|
||||
rv = prefBranch->GetCharPref(prefName.get(), getter_Copies(defaultRedirectorType));
|
||||
if (NS_SUCCEEDED(rv) && !defaultRedirectorType.IsEmpty())
|
||||
{
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "msgCore.h" // precompiled header...
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
|
@ -76,8 +75,8 @@ typedef struct _findServerByKeyEntry {
|
|||
} findServerByKeyEntry;
|
||||
|
||||
typedef struct _findServerByHostnameEntry {
|
||||
const char *hostname;
|
||||
const char *username;
|
||||
nsCString hostname;
|
||||
nsCString username;
|
||||
nsISmtpServer *server;
|
||||
} findServerByHostnameEntry;
|
||||
|
||||
|
@ -135,8 +134,8 @@ nsresult nsSmtpService::SendMailMessage(nsIFile * aFilePath,
|
|||
if (aPassword && *aPassword)
|
||||
smtpServer->SetPassword(aPassword);
|
||||
|
||||
nsXPIDLCString smtpHostName;
|
||||
nsXPIDLCString smtpUserName;
|
||||
nsCString smtpHostName;
|
||||
nsCString smtpUserName;
|
||||
PRInt32 smtpPort;
|
||||
PRInt32 trySSL;
|
||||
|
||||
|
@ -153,9 +152,9 @@ nsresult nsSmtpService::SendMailMessage(nsIFile * aFilePath,
|
|||
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,
|
||||
aNotificationCallbacks, &urlToRun); // this ref counts urlToRun
|
||||
if (NS_SUCCEEDED(rv) && urlToRun)
|
||||
|
@ -205,16 +204,16 @@ nsresult NS_MsgBuildSmtpUrl(nsIFile * aFilePath,
|
|||
nsCAutoString urlSpec("smtp://");
|
||||
if (aSmtpUserName)
|
||||
{
|
||||
nsXPIDLCString escapedUsername;
|
||||
nsCString escapedUsername;
|
||||
*((char **)getter_Copies(escapedUsername)) = nsEscape(aSmtpUserName, url_XAlphas);
|
||||
urlSpec += escapedUsername;
|
||||
urlSpec += '@';
|
||||
urlSpec.Append(escapedUsername);
|
||||
urlSpec.Append('@');
|
||||
}
|
||||
|
||||
urlSpec += aSmtpHostName;
|
||||
urlSpec.Append(aSmtpHostName);
|
||||
if (!PL_strchr(aSmtpHostName, ':'))
|
||||
{
|
||||
urlSpec += ':';
|
||||
urlSpec.Append(':');
|
||||
urlSpec.AppendInt(aSmtpPort);
|
||||
}
|
||||
|
||||
|
@ -392,8 +391,8 @@ nsSmtpService::loadSmtpServers()
|
|||
prefService->GetBranch(nsnull, getter_AddRefs(prefRootBranch));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLCString tempServerList;
|
||||
nsXPIDLCString serverList;
|
||||
nsCString tempServerList;
|
||||
nsCString serverList;
|
||||
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.
|
||||
|
@ -422,7 +421,7 @@ nsSmtpService::loadSmtpServers()
|
|||
|
||||
// We need to check if we have any pre-configured smtp servers so that
|
||||
// those servers can be appended to the list.
|
||||
nsXPIDLCString appendServerList;
|
||||
nsCString 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
|
||||
|
@ -552,10 +551,9 @@ nsSmtpService::createKeyedServer(const char *key, nsISmtpServer** aResult)
|
|||
mServerKeyList += key;
|
||||
}
|
||||
|
||||
if (aResult) {
|
||||
*aResult = server;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
}
|
||||
if (aResult)
|
||||
server.swap(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -567,8 +565,7 @@ nsSmtpService::GetSessionDefaultServer(nsISmtpServer **aServer)
|
|||
if (!mSessionDefaultServer)
|
||||
return GetDefaultServer(aServer);
|
||||
|
||||
*aServer = mSessionDefaultServer;
|
||||
NS_ADDREF(*aServer);
|
||||
NS_ADDREF(*aServer = mSessionDefaultServer);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -595,13 +592,13 @@ nsSmtpService::GetDefaultServer(nsISmtpServer **aServer)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// try to get it from the prefs
|
||||
nsXPIDLCString defaultServerKey;
|
||||
nsCString defaultServerKey;
|
||||
rv = prefBranch->GetCharPref(PREF_MAIL_SMTP_DEFAULTSERVER, getter_Copies(defaultServerKey));
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
!defaultServerKey.IsEmpty()) {
|
||||
|
||||
nsCOMPtr<nsISmtpServer> server;
|
||||
rv = GetServerByKey(defaultServerKey,
|
||||
rv = GetServerByKey(defaultServerKey.get(),
|
||||
getter_AddRefs(mDefaultSmtpServer));
|
||||
} else {
|
||||
// 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);
|
||||
|
||||
// now we have a default server, set the prefs correctly
|
||||
nsXPIDLCString serverKey;
|
||||
nsCString serverKey;
|
||||
mDefaultSmtpServer->GetKey(getter_Copies(serverKey));
|
||||
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
|
||||
// * the key has been set in the prefs
|
||||
|
||||
*aServer = mDefaultSmtpServer;
|
||||
NS_IF_ADDREF(*aServer);
|
||||
NS_IF_ADDREF(*aServer = mDefaultSmtpServer);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -647,13 +643,13 @@ nsSmtpService::SetDefaultServer(nsISmtpServer *aServer)
|
|||
|
||||
mDefaultSmtpServer = aServer;
|
||||
|
||||
nsXPIDLCString serverKey;
|
||||
nsCString serverKey;
|
||||
nsresult rv = aServer->GetKey(getter_Copies(serverKey));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
prefBranch->SetCharPref(PREF_MAIL_SMTP_DEFAULTSERVER, serverKey);
|
||||
prefBranch->SetCharPref(PREF_MAIL_SMTP_DEFAULTSERVER, serverKey.get());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -666,11 +662,12 @@ nsSmtpService::findServerByKey (nsISupports *element, void *aData)
|
|||
|
||||
findServerByKeyEntry *entry = (findServerByKeyEntry*) aData;
|
||||
|
||||
nsXPIDLCString key;
|
||||
nsCString key;
|
||||
rv = server->GetKey(getter_Copies(key));
|
||||
if (NS_FAILED(rv)) return PR_TRUE;
|
||||
|
||||
if (nsCRT::strcmp(key, entry->key)==0) {
|
||||
if (key.Equals(entry->key))
|
||||
{
|
||||
entry->server = server;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -686,7 +683,7 @@ nsSmtpService::CreateSmtpServer(nsISmtpServer **aResult)
|
|||
loadSmtpServers();
|
||||
nsresult rv;
|
||||
|
||||
PRInt32 i=0;
|
||||
PRInt32 i = 0;
|
||||
PRBool unique = PR_FALSE;
|
||||
|
||||
findServerByKeyEntry entry;
|
||||
|
@ -726,8 +723,7 @@ nsSmtpService::GetServerByKey(const char* aKey, nsISmtpServer **aResult)
|
|||
mSmtpServers->EnumerateForwards(findServerByKey, (void *)&entry);
|
||||
|
||||
if (entry.server) {
|
||||
(*aResult) = entry.server;
|
||||
NS_ADDREF(*aResult);
|
||||
NS_ADDREF(*aResult = entry.server);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -747,7 +743,7 @@ nsSmtpService::DeleteSmtpServer(nsISmtpServer *aServer)
|
|||
if (NS_FAILED(rv) || idx==-1)
|
||||
return NS_OK;
|
||||
|
||||
nsXPIDLCString serverKey;
|
||||
nsCString serverKey;
|
||||
aServer->GetKey(getter_Copies(serverKey));
|
||||
|
||||
rv = mSmtpServers->DeleteElementAt(idx);
|
||||
|
@ -764,7 +760,7 @@ nsSmtpService::DeleteSmtpServer(nsISmtpServer *aServer)
|
|||
char *token = nsCRT::strtok(rest, ",", &newStr);
|
||||
while (token) {
|
||||
// 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())
|
||||
newServerList = token;
|
||||
else {
|
||||
|
@ -794,19 +790,20 @@ nsSmtpService::findServerByHostname(nsISupports *element, void *aData)
|
|||
|
||||
findServerByHostnameEntry *entry = (findServerByHostnameEntry*)aData;
|
||||
|
||||
nsXPIDLCString hostname;
|
||||
nsCString hostname;
|
||||
rv = server->GetHostname(getter_Copies(hostname));
|
||||
if (NS_FAILED(rv)) return PR_TRUE;
|
||||
|
||||
nsXPIDLCString username;
|
||||
nsCString username;
|
||||
rv = server->GetUsername(getter_Copies(username));
|
||||
if (NS_FAILED(rv)) return PR_TRUE;
|
||||
|
||||
PRBool checkHostname = entry->hostname && PL_strcmp(entry->hostname, "");
|
||||
PRBool checkUsername = entry->username && PL_strcmp(entry->username, "");
|
||||
PRBool checkHostname = !entry->hostname.IsEmpty();
|
||||
PRBool checkUsername = !entry->username.IsEmpty();
|
||||
|
||||
if ((!checkHostname || (PL_strcasecmp(entry->hostname, hostname)==0)) &&
|
||||
(!checkUsername || (PL_strcmp(entry->username, username)==0))) {
|
||||
if ((!checkHostname || (entry->hostname.Equals(hostname, nsCaseInsensitiveCStringComparator())) &&
|
||||
(!checkUsername || entry->username.Equals(username, nsCaseInsensitiveCStringComparator()))))
|
||||
{
|
||||
entry->server = server;
|
||||
return PR_FALSE; // stop when found
|
||||
}
|
||||
|
@ -820,7 +817,7 @@ nsSmtpService::FindServer(const char *aUsername,
|
|||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
findServerByHostnameEntry entry;
|
||||
entry.server=nsnull;
|
||||
entry.server = nsnull;
|
||||
entry.hostname = aHostname;
|
||||
entry.username = aUsername;
|
||||
|
||||
|
@ -828,8 +825,7 @@ nsSmtpService::FindServer(const char *aUsername,
|
|||
|
||||
// entry.server may be null, but that's ok.
|
||||
// just return null if no server is found
|
||||
*aResult = entry.server;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
NS_IF_ADDREF(*aResult = entry.server);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -841,7 +837,8 @@ nsSmtpService::GetSmtpServerByIdentity(nsIMsgIdentity *aSenderIdentity, nsISmtpS
|
|||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
// First try the identity's preferred server
|
||||
if (aSenderIdentity) {
|
||||
if (aSenderIdentity)
|
||||
{
|
||||
nsCString smtpServerKey;
|
||||
rv = aSenderIdentity->GetSmtpServerKey(smtpServerKey);
|
||||
if (NS_SUCCEEDED(rv) && !(smtpServerKey.IsEmpty()))
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "nsSmtpUrl.h"
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsIMimeConverter.h"
|
||||
#include "nsMsgMimeCID.h"
|
||||
|
|
|
@ -307,7 +307,7 @@ nsURLFetcher::OnStopRequest(nsIRequest *request, nsISupports * ctxt, nsresult aS
|
|||
mOutStream = nsnull;
|
||||
|
||||
/* 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;
|
||||
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...
|
||||
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...
|
||||
return NS_OK;
|
||||
|
@ -469,7 +469,7 @@ NS_IMETHODIMP nsURLFetcherStreamConsumer::OnStartRequest(nsIRequest *aRequest, n
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
/* 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);
|
||||
if (seekStream)
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#include "nsIURIContentListener.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsURLFetcher : public nsIURLFetcher,
|
||||
public nsIStreamListener,
|
||||
|
@ -90,13 +90,13 @@ private:
|
|||
nsCOMPtr<nsIFileOutputStream> mOutStream; // the output file stream
|
||||
nsCOMPtr<nsILocalFile> mLocalFile; // the output file itself
|
||||
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?
|
||||
PRInt32 mTotalWritten; // Size counter variable
|
||||
char *mBuffer; // Buffer used for reading the data
|
||||
PRUint32 mBufferSize; // Buffer size;
|
||||
nsXPIDLCString mContentType; // The content type retrieved from the server
|
||||
nsXPIDLCString mCharset; // The charset retrieved from the server
|
||||
nsCString mContentType; // The content type retrieved from the server
|
||||
nsCString mCharset; // The charset retrieved from the server
|
||||
void *mTagData; // Tag data for callback...
|
||||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче