Bug 657394 Partly move mailnews/import to frozen linkage r=bienvenu

This commit is contained in:
Neil Rashbrook 2011-11-23 20:26:40 +00:00
Родитель b8bfc79f0a
Коммит 752309c813
36 изменённых файлов: 232 добавлений и 289 удалений

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

@ -613,8 +613,10 @@ void nsAppleMailImportMail::ReportStatus(PRInt32 aErrorNum, nsString &aName, nsA
const PRUnichar *fmt = { aName.get() };
nsresult rv = mBundle->FormatStringFromID(aErrorNum, &fmt, 1, getter_Copies(outString));
// write it out the stream
if (NS_SUCCEEDED(rv))
aStream.Append(outString + NS_LITERAL_STRING("\n"));
if (NS_SUCCEEDED(rv)) {
aStream.Append(outString);
aStream.Append(PRUnichar('\n'));
}
}
void nsAppleMailImportMail::SetLogs(const nsAString &aSuccess, const nsAString &aError, PRUnichar **aOutSuccess, PRUnichar **aOutError)

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

@ -44,9 +44,11 @@ include $(DEPTH)/config/autoconf.mk
MODULE = import
LIBRARY_NAME = import
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
ifdef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
FORCE_SHARED_LIB=1
else
EXPORT_LIBRARY = 1
MOZILLA_INTERNAL_API = 1
LIBXUL_LIBRARY = 1
endif
@ -111,11 +113,14 @@ EXTRA_DSO_LDOPTS += \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
else
EXTRA_DSO_LDOPTS = \
EXTRA_DSO_LDOPTS += \
$(LIBS_DIR) \
$(EXTRA_DSO_LIBS) \
$(ZLIB_LIBS) \
$(MOZ_ZLIB_LIBS) \
$(MOZ_JS_LIBS) \
$(XPCOM_GLUE_LDOPTS) \
$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
$(MOZDEPTH)/rdf/util/src/$(LIB_PREFIX)rdfutil_external_s.$(LIB_SUFFIX) \
$(MOZDEPTH)/modules/libreg/src/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \
$(NSPR_LIBS) \
$(NULL)

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

@ -49,6 +49,8 @@
#include "prmem.h"
#include "nsNativeCharsetUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsMsgUtils.h"
#define kCopyBufferSize 8192
#define kMailReadBufferSize 16384

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

@ -41,6 +41,7 @@
#include "nsILineInputStream.h"
#include "nsNetCID.h"
#include "nsDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
#include "NSReg.h"
#include "nsComponentManagerUtils.h"
@ -128,7 +129,7 @@ nsComm4xProfile::GetProfileList(PRUint32 *length, PRUnichar ***profileNames)
enumstate = 0;
PRUnichar **outArray, **next;
next = outArray = (PRUnichar **)nsMemory::Alloc(numProfileEntries * sizeof(PRUnichar *));
next = outArray = (PRUnichar **)NS_Alloc(numProfileEntries * sizeof(PRUnichar *));
if (!outArray)
return NS_ERROR_OUT_OF_MEMORY;

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

@ -45,9 +45,8 @@
#include "nsIAbCard.h"
#include "nsIServiceManager.h"
#include "nsEudoraImport.h"
#include "nsReadableUtils.h"
#include "nsMsgI18N.h"
#include "nsNativeCharsetUtils.h"
#include "nsEudoraCompose.h"
#include "nsMsgUtils.h"
#include "nsTextFormatter.h"
#include "nsEudoraStringBundle.h"
#include "nsIStringBundle.h"
@ -559,8 +558,8 @@ bool CAliasData::Process( const char *pLine, PRInt32 len)
return( PR_FALSE);
}
str.Right( m_email, str.Length() - tCnt - 1);
str.Left( m_realName, tCnt);
m_email = Substring(str, tCnt + 1);
m_realName = StringHead(str, tCnt);
m_realName.Trim( kWhitespace);
m_email.Trim( kWhitespace);
@ -743,15 +742,9 @@ void nsEudoraAddress::ExtractNoteField( nsCString& note, nsCString& value, const
PRInt32 endIdx = note.FindChar( '>', idx);
if (endIdx == -1)
endIdx = note.Length() - 1;
note.Mid( value, idx, endIdx - idx);
value = Substring(note, idx, endIdx - idx);
idx -= field.Length();
nsCString tempL;
if (idx)
note.Left( tempL, idx);
nsCString tempR;
note.Right( tempR, note.Length() - endIdx - 1);
note = tempL;
note.Append( tempR);
note.Cut(idx, endIdx + 1);
}
}
@ -768,9 +761,8 @@ void nsEudoraAddress::FormatExtraDataInNoteField(PRInt32 labelStringID, nsCStrin
void nsEudoraAddress::SanitizeValue( nsCString& val)
{
val.ReplaceSubstring( "\n", ", ");
val.ReplaceChar( 13, ',');
val.ReplaceChar( 10, ',');
MsgReplaceSubstring(val, "\n", ", ");
MsgReplaceChar(val, '\r', ',');
}
void nsEudoraAddress::SplitString( nsCString& val1, nsCString& val2)
@ -787,9 +779,8 @@ void nsEudoraAddress::SplitString( nsCString& val1, nsCString& val2)
if (idx == -1)
idx= val1.RFindChar( 10);
if (idx != -1) {
val1.Right( val2, val1.Length() - idx - cnt);
val1.Left( temp, idx);
val1 = temp;
val2 = Substring(val1, idx + cnt);
val1.SetLength(idx);
SanitizeValue( val1);
}
}
@ -857,21 +848,20 @@ void nsEudoraAddress::AddSingleCard( CAliasEntry *pEntry, nsVoidArray &emailList
if ( !additionalEmail.IsEmpty() )
{
// Reconstitute line breaks for additional email
additionalEmail.ReplaceSubstring( "\x03", "\n");
MsgReplaceSubstring(additionalEmail, "\x03", "\n");
// Try to figure out if there are multiple email addresses in additionalEmail
PRInt32 idx = additionalEmail.FindCharInSet("\t\r\n,; ");
PRInt32 idx = MsgFindCharInSet(additionalEmail, "\t\r\n,; ");
if (idx != -1)
{
// We found a character that indicates that there's more than one email address here.
// Separate out the addresses after the first one.
additionalEmail.Right(stillMoreEmail, additionalEmail.Length() - idx - 1);
stillMoreEmail = Substring(additionalEmail, idx + 1);
stillMoreEmail.Trim(kWhitespace);
// Separate out the first address.
nsCString tempStashEmail(additionalEmail);
tempStashEmail.Left(additionalEmail, idx);
additionalEmail.SetLength(idx);
}
// If there were more than one additional email addresses store all the extra
@ -883,7 +873,7 @@ void nsEudoraAddress::AddSingleCard( CAliasEntry *pEntry, nsVoidArray &emailList
if ( !otherPhone.IsEmpty() )
{
// Reconstitute line breaks for other phone numbers
otherPhone.ReplaceSubstring( "\x03", "\n");
MsgReplaceSubstring(otherPhone, "\x03", "\n");
// Store other phone numbers in the notes field, labeled nicely
FormatExtraDataInNoteField(EUDORAIMPORT_ADDRESS_LABEL_OTHERPHONE, otherPhone, noteUTF16);
@ -892,7 +882,7 @@ void nsEudoraAddress::AddSingleCard( CAliasEntry *pEntry, nsVoidArray &emailList
if ( !otherWeb.IsEmpty() )
{
// Reconstitute line breaks for other web sites
otherWeb.ReplaceSubstring( "\x03", "\n");
MsgReplaceSubstring(otherWeb, "\x03", "\n");
// Store other web sites in the notes field, labeled nicely
FormatExtraDataInNoteField(EUDORAIMPORT_ADDRESS_LABEL_OTHERWEB, otherWeb, noteUTF16);
@ -911,27 +901,27 @@ void nsEudoraAddress::AddSingleCard( CAliasEntry *pEntry, nsVoidArray &emailList
else
displayName = pEntry->m_name;
address.ReplaceSubstring( "\x03", "\n");
MsgReplaceSubstring(address, "\x03", "\n");
SplitString( address, address2);
note.ReplaceSubstring( "\x03", "\n");
fax.ReplaceSubstring( "\x03", " ");
secondaryFax.ReplaceSubstring( "\x03", " ");
phone.ReplaceSubstring( "\x03", " ");
name.ReplaceSubstring( "\x03", " ");
city.ReplaceSubstring( "\x03", " ");
state.ReplaceSubstring( "\x03", " ");
zip.ReplaceSubstring( "\x03", " ");
country.ReplaceSubstring( "\x03", " ");
MsgReplaceSubstring(note, "\x03", "\n");
MsgReplaceSubstring(fax, "\x03", " ");
MsgReplaceSubstring(secondaryFax, "\x03", " ");
MsgReplaceSubstring(phone, "\x03", " ");
MsgReplaceSubstring(name, "\x03", " ");
MsgReplaceSubstring(city, "\x03", " ");
MsgReplaceSubstring(state, "\x03", " ");
MsgReplaceSubstring(zip, "\x03", " ");
MsgReplaceSubstring(country, "\x03", " ");
addressWK.ReplaceSubstring( "\x03", "\n");
MsgReplaceSubstring(addressWK, "\x03", "\n");
SplitString( addressWK, address2WK);
phoneWK.ReplaceSubstring( "\x03", " ");
cityWK.ReplaceSubstring( "\x03", " ");
stateWK.ReplaceSubstring( "\x03", " ");
zipWK.ReplaceSubstring( "\x03", " ");
countryWK.ReplaceSubstring( "\x03", " ");
title.ReplaceSubstring( "\x03", " ");
company.ReplaceSubstring( "\x03", " ");
MsgReplaceSubstring(phoneWK, "\x03", " ");
MsgReplaceSubstring(cityWK, "\x03", " ");
MsgReplaceSubstring(stateWK, "\x03", " ");
MsgReplaceSubstring(zipWK, "\x03", " ");
MsgReplaceSubstring(countryWK, "\x03", " ");
MsgReplaceSubstring(title, "\x03", " ");
MsgReplaceSubstring(company, "\x03", " ");
if (newRow)
{
@ -965,7 +955,7 @@ void nsEudoraAddress::AddSingleCard( CAliasEntry *pEntry, nsVoidArray &emailList
ADD_FIELD_TO_DB_ROW(pDb, AddWorkState, newRow, stateWK, uniStr);
ADD_FIELD_TO_DB_ROW(pDb, AddWorkCountry, newRow, countryWK, uniStr);
if ( (primaryLocation.IsEmpty() || primaryLocation.LowerCaseEqualsASCII("home")) &&
if ( (primaryLocation.IsEmpty() || primaryLocation.LowerCaseEqualsLiteral("home")) &&
!mobile.IsEmpty() )
{
// Primary location field is either specified to be "home" or is not
@ -985,7 +975,7 @@ void nsEudoraAddress::AddSingleCard( CAliasEntry *pEntry, nsVoidArray &emailList
isSecondaryMobileWorkNumber = PR_FALSE;
}
if ( (primaryLocation.IsEmpty() || primaryLocation.LowerCaseEqualsASCII("home")) &&
if ( (primaryLocation.IsEmpty() || primaryLocation.LowerCaseEqualsLiteral("home")) &&
!fax.IsEmpty() )
{
// Primary location field is either specified to be "home" or is not
@ -1135,7 +1125,8 @@ nsresult nsEudoraAddress::AddSingleList(CAliasEntry *pEntry, nsVoidArray &emailL
for (PRInt32 i = 0; i < max; i++)
{
CAliasData *pData = (CAliasData *)emailList.ElementAt(i);
nsCAutoString ldifValue(NS_LITERAL_CSTRING("mail=") + nsDependentCString(pData->m_email.get()));
nsCAutoString ldifValue("mail");
ldifValue.Append(pData->m_email);
rv = pDb->AddLdifListMember(newRow, ldifValue.get());
}

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

@ -40,7 +40,7 @@
#define nsEudoraAddress_h__
#include "nscore.h"
#include "nsString.h"
#include "nsStringGlue.h"
#include "nsVoidArray.h"
#include "nsILocalFile.h"
#include "nsISupportsArray.h"

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

@ -39,8 +39,8 @@
#include "nscore.h"
#include "prthread.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsStringGlue.h"
#include "nsMsgUtils.h"
#include "nsUnicharUtils.h"
#include "nsCOMPtr.h"
#include "nsIComponentManager.h"
@ -67,7 +67,6 @@
#include "EudoraDebugLog.h"
#include "nsMimeTypes.h"
#include "nsMsgUtils.h"
#include "nsNetUtil.h"
#include "nsAutoPtr.h"
#include "nsIMutableArray.h"
@ -462,20 +461,16 @@ void nsEudoraCompose::GetHeaderValue( const char *pData, PRInt32 dataLen, const
void nsEudoraCompose::ExtractCharset( nsString& str)
{
nsString tStr;
PRInt32 idx = str.Find( "charset=", PR_TRUE);
PRInt32 idx = MsgFind(str, "charset=", PR_TRUE, 0);
if (idx != -1) {
idx += 8;
str.Right( tStr, str.Length() - idx);
idx = tStr.FindChar( ';');
str.Cut(0, idx + 8);
idx = str.FindChar( ';');
if (idx != -1)
tStr.Left( str, idx);
else
str = tStr;
str.SetLength(idx);
str.Trim( kWhitespace);
if ((str.CharAt( 0) == '"') && (str.Length() > 2)) {
str.Mid( tStr, 1, str.Length() - 2);
str = tStr;
str.SetLength(str.Length() - 1);
str.Cut(0, 1);
str.Trim( kWhitespace);
}
}
@ -487,25 +482,21 @@ void nsEudoraCompose::ExtractType( nsString& str)
{
nsString tStr;
PRInt32 idx = str.FindChar( ';');
if (idx != -1) {
str.Left( tStr, idx);
str = tStr;
}
if (idx != -1)
str.SetLength(idx);
str.Trim( kWhitespace);
if ((str.CharAt( 0) == '"') && (str.Length() > 2)) {
str.Mid( tStr, 1, str.Length() - 2);
str = tStr;
str.SetLength(str.Length() - 1);
str.Cut(0, 1);
str.Trim( kWhitespace);
}
// if multipart then ignore it since no outlook message body is ever
// valid multipart!
if (str.Length() > 10) {
str.Left( tStr, 10);
if (tStr.LowerCaseEqualsLiteral("multipart/"))
str.Truncate();
}
if (StringBeginsWith(str, NS_LITERAL_STRING("multipart/"), nsCaseInsensitiveStringComparator()))
str.Truncate();
}
nsresult nsEudoraCompose::GetLocalAttachments(nsIArray **aArray)
@ -591,7 +582,7 @@ nsresult nsEudoraCompose::SendTheMessage(nsIFile *pMailImportLocation, nsIFile *
// As the last resort we'll use the mail default charset.
if ( headerVal.IsEmpty() || (headerVal.Length() > kContentTypeLengthSanityCheck) )
{
CopyASCIItoUTF16(nsMsgI18NFileSystemCharset(), headerVal);
headerVal.AssignASCII(nsMsgI18NFileSystemCharset());
if (headerVal.IsEmpty())
{ // last resort
if (m_defCharset.IsEmpty())
@ -619,7 +610,7 @@ nsresult nsEudoraCompose::SendTheMessage(nsIFile *pMailImportLocation, nsIFile *
// what about all of the other headers?!?!?!?!?!?!
char *pMimeType;
if (!bodyType.IsEmpty())
pMimeType = ToNewCString(bodyType);
pMimeType = ToNewCString(NS_LossyConvertUTF16toASCII(bodyType));
else
pMimeType = ToNewCString(m_bodyType);

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

@ -41,13 +41,20 @@
#include "nscore.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsStringGlue.h"
#include "nsMsgUtils.h"
#include "nsIFile.h"
#include "nsIInputStream.h"
#include "nsVoidArray.h"
#include "nsIImportService.h"
#include "nsNativeCharsetUtils.h"
#ifdef MOZILLA_INTERNAL_API
#include "nsNativeCharsetUtils.h"
#else
#include "nsMsgI18N.h"
#define NS_CopyNativeToUnicode(source, dest) \
nsMsgI18NConvertToUnicode(nsMsgI18NFileSystemCharset(), source, dest)
#endif
class nsIMsgSend;
class nsIMsgCompFields;

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

@ -41,7 +41,8 @@
#include "nsISupportsArray.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsComponentManagerUtils.h"
#include "nsString.h"
#include "nsStringGlue.h"
#include "nsMsgUtils.h"
#include "nsNetUtil.h"
NS_IMPL_ISUPPORTS2(nsEudoraEditor, nsIEditor, nsIEditorMailSupport)
@ -741,12 +742,10 @@ NS_IMETHODIMP nsEudoraEditor::GetEmbeddedObjects(nsISupportsArray ** aNodeList)
// Extract the file name from the embedded content line
PRInt32 startFileName = startEmbeddedContentLine + lenEmbeddedContentTag;
PRInt32 endFileName = m_body.Find(":", PR_FALSE, startFileName);
nsString fileName;
m_body.Mid(fileName, startFileName, endFileName - startFileName);
// Create the file spec for the embedded image
embeddedFolderSpec->Clone(getter_AddRefs(embeddedImageSpec));
embeddedImageSpec->Append(fileName);
embeddedImageSpec->Append(Substring(m_body, startFileName, endFileName - startFileName));
// Verify that the embedded image spec exists and is a file
bool isFile = false;
@ -767,13 +766,13 @@ NS_IMETHODIMP nsEudoraEditor::GetEmbeddedObjects(nsISupportsArray ** aNodeList)
if (endCIDHash != kNotFound)
{
nsString cidHash;
m_body.Mid(cidHash, startCIDHash, endCIDHash - startCIDHash);
cidHash.Assign(Substring(m_body, startCIDHash, endCIDHash - startCIDHash));
if ( !cidHash.IsEmpty() )
{
// Convert CID hash string to numeric value
PRInt32 aErrorCode;
cidHashValue = cidHash.ToInteger(&aErrorCode, kRadix16);
nsresult aErrorCode;
cidHashValue = cidHash.ToInteger(&aErrorCode, 16);
}
}
}
@ -857,16 +856,16 @@ bool nsEudoraEditor::UpdateEmbeddedImageReference(PRUint32 aCIDHash, const nsASt
// Move past the quote
++startSrcValue;
PRInt32 endSrcValue = m_body.Find(nsCString(quoteChar), PR_FALSE, startSrcValue);
PRInt32 endSrcValue = m_body.FindChar(quoteChar, startSrcValue);
PRInt32 srcLength = endSrcValue - startSrcValue;
nsString srcValue;
m_body.Mid(srcValue, startSrcValue, srcLength);
srcValue.Assign(Substring(m_body, startSrcValue, srcLength));
if (aCIDHash != 0)
{
// Verify source value starts with "cid:"
if ( !srcValue.EqualsIgnoreCase("cid:", 4) )
if (!StringBeginsWith(srcValue, NS_LITERAL_STRING("cid:"), nsCaseInsensitiveStringComparator()))
continue;
// Remove "cid:" from the start

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

@ -41,7 +41,7 @@
#include "nsIEditorMailSupport.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsStringGlue.h"
#include "nsIFile.h"

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

@ -46,6 +46,7 @@
#include "nspr.h"
#include "plstr.h"
#include "nsMsgBaseCID.h"
#include "nsMsgUtils.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIMsgFilterList.h"
@ -264,7 +265,11 @@ bool nsEudoraFilters::RealImport()
{
nsAutoString unicodeMailboxPath;
NS_CopyNativeToUnicode(nsCString(pMailboxPath), unicodeMailboxPath);
m_errorLog += NS_LITERAL_STRING("- ") + name + NS_LITERAL_STRING(": ") + nsEudoraStringBundle::FormatString(EUDORAIMPORT_FILTERS_WARN_MAILBOX_MISSING, unicodeMailboxPath.get()) + NS_LITERAL_STRING("\n") ;
m_errorLog += NS_LITERAL_STRING("- ");
m_errorLog += name;
m_errorLog += NS_LITERAL_STRING(": ");
m_errorLog += nsEudoraStringBundle::FormatString(EUDORAIMPORT_FILTERS_WARN_MAILBOX_MISSING, unicodeMailboxPath.get());
m_errorLog += NS_LITERAL_STRING("\n");
rv = NS_OK;
}
}
@ -324,12 +329,22 @@ bool nsEudoraFilters::RealImport()
else if (strcmp(pLine, "manual") == 0)
;// Just ignore manual as TB handles manual in a different way
else if (strcmp(pLine, "outgoing") == 0)
m_errorLog += NS_LITERAL_STRING("- ") + name + NS_LITERAL_STRING(": ") + nsEudoraStringBundle::FormatString(EUDORAIMPORT_FILTERS_WARN_OUTGOING) + NS_LITERAL_STRING("\n") ;
{
m_errorLog += NS_LITERAL_STRING("- ");
m_errorLog += name;
m_errorLog += NS_LITERAL_STRING(": ");
m_errorLog += nsEudoraStringBundle::FormatString(EUDORAIMPORT_FILTERS_WARN_OUTGOING);
m_errorLog += NS_LITERAL_STRING("\n");
}
else
{
nsAutoString unicodeLine;
NS_CopyNativeToUnicode(nsCString(pLine), unicodeLine);
m_errorLog += NS_LITERAL_STRING("- ") + name + NS_LITERAL_STRING(": ") + nsEudoraStringBundle::FormatString(EUDORAIMPORT_FILTERS_WARN_ACTION, unicodeLine.get()) + NS_LITERAL_STRING("\n");
m_errorLog += NS_LITERAL_STRING("- ");
m_errorLog += name;
m_errorLog += NS_LITERAL_STRING(": ");
m_errorLog += nsEudoraStringBundle::FormatString(EUDORAIMPORT_FILTERS_WARN_ACTION, unicodeLine.get());
m_errorLog += NS_LITERAL_STRING("\n");
}
}
}
@ -690,17 +705,27 @@ nsresult nsEudoraFilters::AddTerm(const char* pHeader, const char* pVerb, const
NS_CopyNativeToUnicode(nsCString(pVerb), unicodeVerb);
NS_CopyNativeToUnicode(nsCString(pValue), unicodeValue);
filterTitle = NS_LITERAL_STRING("- ") + unicodeHeader + NS_LITERAL_STRING(" ") + unicodeVerb + NS_LITERAL_STRING(" ") + unicodeValue + NS_LITERAL_STRING(": ");
filterTitle = NS_LITERAL_STRING("- ");
filterTitle += unicodeHeader;
filterTitle += NS_LITERAL_STRING(" ");
filterTitle += unicodeVerb;
filterTitle += NS_LITERAL_STRING(" ");
filterTitle += unicodeValue;
filterTitle += NS_LITERAL_STRING(": ");
if (op < 0)
{
m_errorLog += filterTitle + nsEudoraStringBundle::FormatString(EUDORAIMPORT_FILTERS_WARN_VERB, pVerb) + NS_LITERAL_STRING("\n");
m_errorLog += filterTitle;
m_errorLog += nsEudoraStringBundle::FormatString(EUDORAIMPORT_FILTERS_WARN_VERB, pVerb);
m_errorLog += NS_LITERAL_STRING("\n");
return NS_ERROR_INVALID_ARG;
}
if (!pHeader || !*pHeader)
{
m_errorLog += filterTitle + nsEudoraStringBundle::FormatString(EUDORAIMPORT_FILTERS_WARN_EMPTY_HEADER) + NS_LITERAL_STRING("\n");
m_errorLog += filterTitle;
m_errorLog += nsEudoraStringBundle::FormatString(EUDORAIMPORT_FILTERS_WARN_EMPTY_HEADER);
m_errorLog += NS_LITERAL_STRING("\n");
return NS_ERROR_INVALID_ARG;
}
@ -719,7 +744,9 @@ nsresult nsEudoraFilters::AddTerm(const char* pHeader, const char* pVerb, const
op--;
break;
default:
m_errorLog += filterTitle + nsEudoraStringBundle::FormatString(EUDORAIMPORT_FILTERS_WARN_NEGATE_VERB, unicodeVerb.get()) + NS_LITERAL_STRING("\n");
m_errorLog += filterTitle;
m_errorLog += nsEudoraStringBundle::FormatString(EUDORAIMPORT_FILTERS_WARN_NEGATE_VERB, unicodeVerb.get());
m_errorLog += NS_LITERAL_STRING("\n");
return NS_ERROR_INVALID_ARG;
}
}
@ -729,7 +756,9 @@ nsresult nsEudoraFilters::AddTerm(const char* pHeader, const char* pVerb, const
// Can't handle other Eudora meta-headers (Any Header, Personality, Junk Score)
if (*pHeader == *LDAQ)
{
m_errorLog += filterTitle + nsEudoraStringBundle::FormatString(EUDORAIMPORT_FILTERS_WARN_META_HEADER, unicodeHeader.get()) + NS_LITERAL_STRING("\n");
m_errorLog += filterTitle;
m_errorLog += nsEudoraStringBundle::FormatString(EUDORAIMPORT_FILTERS_WARN_META_HEADER, unicodeHeader.get());
m_errorLog += NS_LITERAL_STRING("\n");
return NS_ERROR_INVALID_ARG;
}

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

@ -50,10 +50,11 @@
#endif
#include "nscore.h"
#include "nsString.h"
#include "nsIServiceManager.h"
#include "nsCOMPtr.h"
#include "nsStringGlue.h"
#include "nsServiceManagerUtils.h"
#include "nsIImportService.h"
#include "nsIComponentManager.h"
#include "nsComponentManagerUtils.h"
#include "nsEudoraImport.h"
#include "nsIMemory.h"
#include "nsIImportService.h"
@ -75,7 +76,6 @@
#include "nsEudoraCompose.h"
#include "nsEudoraSettings.h"
#include "nsEudoraFilters.h"
#include "nsReadableUtils.h"
#include "nsUnicharUtils.h"
#include "nsIMsgTagService.h"
#include "nsMsgBaseCID.h"

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

@ -57,7 +57,6 @@
#include "nsEudoraStringBundle.h"
#include "nsEudoraImport.h"
#include "nsIPop3IncomingServer.h"
#include "nsReadableUtils.h"
#include "nsUnicharUtils.h"
#include "nsNetUtil.h"
#include "EudoraDebugLog.h"

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

@ -41,7 +41,7 @@
#define nsEudoraMac_h__
#include "nscore.h"
#include "nsString.h"
#include "nsStringGlue.h"
#include "nsIFile.h"
#include "nsISupportsArray.h"
#include "nsEudoraMailbox.h"

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

@ -39,7 +39,6 @@
#include "msgCore.h"
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
#include "nsEudoraMailbox.h"
#include "nsDirectoryServiceDefs.h"
#include "nsEudoraCompose.h"

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

@ -40,7 +40,7 @@
#define nsEudoraMailbox_h__
#include "nscore.h"
#include "nsString.h"
#include "nsStringGlue.h"
#include "nsVoidArray.h"
#include "nsIFile.h"
#include "nsISupportsArray.h"

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

@ -45,7 +45,7 @@
#include "nscore.h"
#include "nsEudoraSettings.h"
#include "nsEudoraStringBundle.h"
#include "nsComponentManagerUtils.h"
#include "EudoraDebugLog.h"
#if defined(XP_WIN) || defined(XP_OS2)

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

@ -40,10 +40,9 @@
#include "prprf.h"
#include "prmem.h"
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
#include "nsIStringBundle.h"
#include "nsEudoraStringBundle.h"
#include "nsIServiceManager.h"
#include "nsServiceManagerUtils.h"
#include "nsIURI.h"
#include "nsTextFormatter.h"

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

@ -39,7 +39,7 @@
#ifndef nsEudoraStringBundle_H__
#define nsEudoraStringBundle_H__
#include "nsString.h"
#include "nsStringGlue.h"
class nsIStringBundle;

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

@ -39,7 +39,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
#include "nsMsgUtils.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsIMsgAccountManager.h"
@ -47,7 +47,6 @@
#include "nsIPop3IncomingServer.h"
#include "nsMsgBaseCID.h"
#include "nsMsgCompCID.h"
#include "nsMsgI18N.h"
#include "nsISmtpService.h"
#include "nsISmtpServer.h"
#include "nsEudoraWin32.h"
@ -122,7 +121,7 @@ bool nsEudoraWin32::FindEudoraLocation( nsIFile **pFolder, bool findIni)
nsCString str((const char *)pBytes);
delete [] pBytes;
str.CompressWhitespace();
MsgCompressWhitespace(str);
// Command line is Eudora mailfolder eudora.ini
if (findIni)
@ -132,10 +131,7 @@ bool nsEudoraWin32::FindEudoraLocation( nsIFile **pFolder, bool findIni)
if (index != -1)
{
index++; // skip the space
nsCString path;
str.Mid( path, index, str.Length() - index);
eudoraPath->InitWithNativePath(path);
eudoraPath->InitWithNativePath(Substring(str, index));
eudoraPath->IsFile( &exists);
if (exists)
result = exists;
@ -170,10 +166,7 @@ bool nsEudoraWin32::FindEudoraLocation( nsIFile **pFolder, bool findIni)
endIdx = str.FindChar( ' ', idx);
if (endIdx != -1)
{
nsCString path;
str.Mid( path, idx, endIdx - idx);
eudoraPath->InitWithNativePath(path);
eudoraPath->InitWithNativePath(Substring(str, idx, endIdx - idx));
if (NS_SUCCEEDED( eudoraPath->IsDirectory( &exists)))
result = exists;
@ -298,8 +291,8 @@ nsresult nsEudoraWin32::IterateMailDir( nsIFile *pFolder, nsISupportsArray *pArr
{
if (fName.Length() > 4)
{
fName.Right( ext, 4);
fName.Left( name, fName.Length() - 4);
ext = StringTail(fName, 4);
name = StringHead(fName, fName.Length() - 4);
}
else
{
@ -559,7 +552,7 @@ nsresult nsEudoraWin32::FindTOCFile( nsIFile *pMailFile, nsIFile **ppTOCFile, bo
nsCString name;
if ((leaf.Length() > 4) && (leaf.CharAt( leaf.Length() - 4) == '.'))
leaf.Left( name, leaf.Length() - 4);
name = StringHead(leaf, leaf.Length() - 4);
else
name = leaf;
name.Append( ".toc");
@ -794,10 +787,7 @@ void nsEudoraWin32::GetServerAndUserName( const char *pSection, const char *pIni
serverName = pBuff;
idx = serverName.FindChar( '@');
if (idx != -1)
{
serverName.Right( tStr, serverName.Length() - idx - 1);
serverName = tStr;
}
serverName = Substring(serverName, idx + 1);
}
}
valSize = ::GetPrivateProfileString( pSection, "LoginName", "", pBuff, kIniValueSize, pIni);
@ -811,10 +801,7 @@ void nsEudoraWin32::GetServerAndUserName( const char *pSection, const char *pIni
userName = pBuff;
idx = userName.FindChar( '@');
if (idx != -1)
{
userName.Left( tStr, idx);
userName = tStr;
}
userName.SetLength(idx);
}
}
}
@ -832,17 +819,9 @@ void nsEudoraWin32::GetAccountName( const char *pSection, nsString& str)
}
else
{
nsCString tStr;
CopyASCIItoUTF16(pSection, str);
if (s.Length() > 8)
{
s.Left( tStr, 8);
if (tStr.LowerCaseEqualsLiteral("persona-"))
{
s.Right( tStr, s.Length() - 8);
CopyASCIItoUTF16(tStr, str);
}
}
str.AssignASCII(pSection);
if (StringBeginsWith(s, NS_LITERAL_CSTRING("persona-"), nsCaseInsensitiveCStringComparator()))
CopyASCIItoUTF16(Substring(s, 8), str);
}
}
@ -1113,15 +1092,15 @@ nsresult nsEudoraWin32::GetAttachmentInfo( const char *pFileName, nsIFile *pFile
PRInt32 idx = name.RFindChar( '.');
if (idx != -1)
{
name.Right( ext, name.Length() - idx);
GetMimeTypeFromExtension( ext, mimeType);
ext = Substring(name, idx);
GetMimeTypeFromExtension(ext, mimeType);
}
}
if (mimeType.IsEmpty())
mimeType = "application/octet-stream";
nsAutoString description;
rv = nsMsgI18NConvertToUnicode(nsMsgI18NFileSystemCharset(), name, description);
rv = NS_CopyNativeToUnicode(name, description);
if (NS_SUCCEEDED(rv))
aAttachmentName = NS_ConvertUTF16toUTF8(description);
@ -1168,8 +1147,8 @@ bool nsEudoraWin32::FindMimeIniFile( nsIFile *pFile)
{
if (fName.Length() > 4)
{
fName.Right( ext, 4);
fName.Left( name, fName.Length() - 4);
ext = StringTail(fName, 4);
name = StringHead(fName, fName.Length() - 4);
}
else
{
@ -1473,7 +1452,7 @@ nsresult nsEudoraWin32::FindAddressBooks( nsIFile *pRoot, nsISupportsArray **ppA
nsCString currentDir;
while ((idx = dirs.FindChar( ';')) != -1)
{
dirs.Left( currentDir, idx);
currentDir = StringHead(dirs, idx);
currentDir.Trim( kWhitespace);
if (!currentDir.IsEmpty())
{
@ -1490,8 +1469,7 @@ nsresult nsEudoraWin32::FindAddressBooks( nsIFile *pRoot, nsISupportsArray **ppA
return( rv);
}
}
dirs.Right( currentDir, dirs.Length() - idx - 1);
dirs = currentDir;
dirs = Substring(dirs, idx + 1);
dirs.Trim( kWhitespace);
}
if (!dirs.IsEmpty())
@ -1547,8 +1525,8 @@ nsresult nsEudoraWin32::ScanAddressDir( nsIFile *pDir, nsISupportsArray *pArray,
{
if (fName.Length() > 4)
{
fName.Right( ext, 4);
fName.Left( name, fName.Length() - 4);
ext = StringTail(fName, 4);
name = StringHead(fName, fName.Length() - 4);
}
else
{
@ -1592,12 +1570,9 @@ nsresult nsEudoraWin32::FoundAddressBook( nsIFile *file, const PRUnichar *pName,
if (leaf.IsEmpty())
return( NS_ERROR_FAILURE);
nsString tStr;
leaf.Right( tStr, 4);
tStr = StringTail(leaf, 4);
if (tStr.LowerCaseEqualsLiteral(".txt") || tStr.LowerCaseEqualsLiteral(".nnt"))
{
leaf.Left( tStr, leaf.Length() - 4);
leaf = tStr;
}
leaf.SetLength(leaf.Length() - 4);
}
nsCOMPtr<nsILocalFile> fileLoc = do_QueryInterface(file, &rv);
@ -1636,23 +1611,19 @@ void nsEudoraWin32::ConvertPath( nsCString& str)
idx = str.FindChar( '\\', idx);
if ((idx == 2) && (str.CharAt( 1) == ':'))
{
str.Left( path, 3);
path = StringHead(str, 3);
idx++;
idx = str.FindChar( '\\', idx);
start = 3;
if ((idx == -1) && (str.Length() > 3))
{
str.Right( temp, str.Length() - start);
path.Append( temp);
}
path.Append(Substring(str, start));
}
WIN32_FIND_DATA findFileData;
while (idx != -1)
{
str.Mid( temp, start, idx - start);
search = path;
search.Append( temp);
search.Append(Substring(str, start, idx - start));
HANDLE h = FindFirstFile( search.get(), &findFileData);
if (h == INVALID_HANDLE_VALUE)
return;
@ -1665,9 +1636,8 @@ void nsEudoraWin32::ConvertPath( nsCString& str)
path.Append( '\\');
else
{
str.Right( temp, str.Length() - start);
path.Append( '\\');
path.Append( temp);
path.Append(Substring(str, start));
}
}

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

@ -41,7 +41,7 @@
#define nsEudoraWin32_h__
#include "nscore.h"
#include "nsString.h"
#include "nsStringGlue.h"
#include "nsILocalFile.h"
#include "nsISupportsArray.h"
#include "nsEudoraMailbox.h"

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

@ -40,7 +40,7 @@
#include "nscore.h"
#include "prtypes.h"
#include "nsString.h"
#include "nsStringGlue.h"
#include "nsILocalFile.h"
#include <windows.h>

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

@ -38,7 +38,7 @@
#ifndef nsOE5File_h___
#define nsOE5File_h___
#include "nsString.h"
#include "nsStringGlue.h"
#include "nsIFile.h"
#include <windows.h>

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

@ -44,9 +44,9 @@
*/
#include "nscore.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIComponentManager.h"
#include "nsStringGlue.h"
#include "nsMsgUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsIServiceManager.h"
#include "nsIImportService.h"
#include "nsIImportFieldMap.h"
@ -257,16 +257,12 @@ nsresult nsOEAddressIterator::EnumList( const PRUnichar * pName, LPENTRYID pEid,
void nsOEAddressIterator::SanitizeValue( nsString& val)
{
val.ReplaceSubstring(NS_LITERAL_STRING("\x0D\x0A").get(),
NS_LITERAL_STRING(", ").get());
val.ReplaceChar( 13, ',');
val.ReplaceChar( 10, ',');
MsgReplaceSubstring(val, NS_LITERAL_STRING("\r\n"), NS_LITERAL_STRING(", "));
MsgReplaceChar(val, "\r\n", ',');
}
void nsOEAddressIterator::SplitString( nsString& val1, nsString& val2)
{
nsString temp;
// Find the last line if there is more than one!
PRInt32 idx = val1.RFind( "\x0D\x0A");
PRInt32 cnt = 2;
@ -277,9 +273,8 @@ void nsOEAddressIterator::SplitString( nsString& val1, nsString& val2)
if (idx == -1)
idx= val1.RFindChar( 10);
if (idx != -1) {
val1.Right( val2, val1.Length() - idx - cnt);
val1.Left( temp, idx);
val1 = temp;
val2 = Substring(val1, idx + cnt);
val1.SetLength(idx);
SanitizeValue( val1);
}
}

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

@ -48,9 +48,9 @@
#endif
#include "nscore.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIServiceManager.h"
#include "nsMsgUtils.h"
#include "nsStringGlue.h"
#include "nsComponentManagerUtils.h"
#include "nsIImportService.h"
#include "nsOEImport.h"
#include "nsIMemory.h"

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

@ -49,7 +49,13 @@
#include "nsISeekableStream.h"
#include "plstr.h"
#ifdef MOZILLA_INTERNAL_API
#include "nsNativeCharsetUtils.h"
#else
#include "nsMsgI18N.h"
#define NS_CopyNativeToUnicode(source, dest) \
nsMsgI18NConvertToUnicode(nsMsgI18NFileSystemCharset(), source, dest)
#endif
/*
.nch file format???
@ -248,8 +254,6 @@ bool nsOEScanBoxes::FindMailBoxes( nsIFile* descFile)
PRUint32 next;
MailboxEntry * pEntry;
bool failed;
nsCString ext;
nsCString mbxExt( ".mbx");
while (!done) {
@ -283,8 +287,7 @@ bool nsOEScanBoxes::FindMailBoxes( nsIFile* descFile)
IMPORT_LOG3( " Parent: %ld, Child: %ld, Sibling: %ld\n", pEntry->parent, pEntry->child, pEntry->sibling);
#endif
pEntry->fileName.Right( ext, 4);
if (!ext.Equals(mbxExt))
if (!StringEndsWith(pEntry->fileName, NS_LITERAL_CSTRING(".mbx")))
pEntry->fileName.Append( ".mbx");
m_entryArray.AppendElement( pEntry);
@ -875,7 +878,7 @@ bool nsOEScanBoxes::ReadString( nsIInputStream * stream, nsString& str, PRUint32
if (NS_FAILED( rv) || (cntRead != kOutlookExpressStringLength))
return( PR_FALSE);
buffer[kOutlookExpressStringLength - 1] = 0;
CopyASCIItoUTF16(buffer, str);
str.AssignASCII(buffer);
return( PR_TRUE);
}

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

@ -194,7 +194,7 @@ BOOL CMapiApi::GetRTFPropertyDecodedAsUTF16( LPMAPIPROP pProp, nsString& val,
val.Assign(decoder.text(), decoder.textSize());
}
else { // WrapCompressedRTFStreamEx available and original type is not rtf
CopyUTF8toUTF16(streamData.c_str(), val);
CopyUTF8toUTF16(nsDependentCString(streamData.c_str()), val);
}
return TRUE;
}
@ -1273,7 +1273,7 @@ BOOL CMapiApi::GetLargeStringProperty( LPMAPIPROP pProp, ULONG tag, nsCString& v
if (!GetLargeProperty(pProp, tag, &result))
return FALSE;
if (PROP_TYPE(tag) == PT_UNICODE) // unicode string
LossyCopyUTF16toASCII(static_cast<wchar_t*>(result), val);
LossyCopyUTF16toASCII(nsDependentString(static_cast<wchar_t*>(result)), val);
else // either PT_STRING8 or some other binary - use as is
val.Assign(static_cast<char*>(result));
delete[] result;
@ -1325,7 +1325,7 @@ BOOL CMapiApi::GetStringFromProp( LPSPropValue pVal, nsCString& val, BOOL delVal
if ( pVal && (PROP_TYPE( pVal->ulPropTag) == PT_STRING8))
val = pVal->Value.lpszA;
else if ( pVal && (PROP_TYPE( pVal->ulPropTag) == PT_UNICODE))
LossyCopyUTF16toASCII((PRUnichar *) pVal->Value.lpszW, val);
LossyCopyUTF16toASCII(nsDependentString(pVal->Value.lpszW), val);
else if (pVal && (PROP_TYPE( pVal->ulPropTag) == PT_NULL))
val.Truncate();
else if (pVal && (PROP_TYPE( pVal->ulPropTag) == PT_ERROR)) {
@ -1522,44 +1522,21 @@ void CMapiApi::GetPropTagName( ULONG tag, nsCString& s)
}
}
void ReplaceEolChars( nsCString& s)
{
int idx;
nsCString t;
nsCString rt;
while ((idx = s.Find( "\x0D")) != -1) {
s.Left( t, idx);
t += "\\n";
s.Right( rt, s.Length() - idx - 1);
t += rt;
s = t;
}
while ((idx = s.Find( "\x0A")) != -1) {
s.Left( t, idx);
t += "\\r";
s.Right( rt, s.Length() - idx - 1);
t += rt;
s = t;
}
}
void CMapiApi::ListPropertyValue( LPSPropValue pVal, nsCString& s)
{
nsCString strVal;
char nBuff[64];
nsCString t;
s += "value: ";
switch (PROP_TYPE( pVal->ulPropTag)) {
case PT_STRING8:
GetStringFromProp( pVal, strVal, FALSE);
if (strVal.Length() > 60) {
strVal.Left( t, 60);
strVal = t;
strVal.SetLength(60);
strVal += "...";
}
ReplaceEolChars( strVal);
MsgReplaceSubstring(strVal, "\r", "\\r");
MsgReplaceSubstring(strVal, "\n", "\\n");
s += strVal;
break;
case PT_LONG:

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

@ -286,7 +286,7 @@ bool CMapiMessage::FetchHeaders( void)
else if ((PROP_TYPE(pVal->ulPropTag) == PT_UNICODE) &&
(pVal->Value.lpszW) && (*(pVal->Value.lpszW))) {
nsCString headers;
LossyCopyUTF16toASCII(pVal->Value.lpszW, headers);
LossyCopyUTF16toASCII(nsDependentString(pVal->Value.lpszW), headers);
m_headers.Assign(headers.get());
}
@ -306,15 +306,6 @@ bool CMapiMessage::FetchHeaders( void)
return( !m_headers.IsEmpty());
}
bool CMapiMessage::IsMultipart( void) const
{
nsCString left;
m_mimeContentType.Left( left, 10);
if (left.LowerCaseEqualsLiteral("multipart/"))
return true;
return false;
}
// Mime-Version: 1.0
// Content-Type: text/plain; charset="US-ASCII"
// Content-Type: multipart/mixed; boundary="=====================_874475278==_"
@ -732,7 +723,7 @@ bool CMapiMessage::FetchBody( void)
// To detect the "true" plain text messages, we look for our string
// immediately following the <BODY> tag.
if (!m_body.IsEmpty() &&
m_body.Find(L"<BODY>\r\n<!-- Converted from text/plain format -->") ==
m_body.Find("<BODY>\r\n<!-- Converted from text/plain format -->") ==
kNotFound) {
m_bodyIsHtml = true;
}
@ -1077,7 +1068,7 @@ bool CMapiMessage::AddAttachment(DWORD aNum)
if (fext.IsEmpty()) {
int idx = fname.RFindChar(L'.');
if (idx != -1)
fname.Right(fext, fname.Length() - idx);
fext = Substring(fname, idx);
}
else if (fname.RFindChar(L'.') == -1) {
fname += L".";

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

@ -217,7 +217,6 @@ public:
inline bool IsForvarded() const {
return m_msgLastVerb == EXCHIVERB_FORWARD; }
bool IsMultipart( void) const;
bool HasContentHeader( void) const {
return( !m_mimeContentType.IsEmpty());}
bool HasMimeVersion( void) const {

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

@ -48,7 +48,6 @@
#include "nsIIOService.h"
#include "nsIURI.h"
#include "nsMsgI18N.h"
#include "nsNativeCharsetUtils.h"
#include "nsIOutputStream.h"
#include "nsMsgBaseCID.h"
@ -434,14 +433,14 @@ nsOutlookCompose::ReplaceCidInLine::ReplaceCidInLine(nsCString& line)
: m_line(line)
{
// If the line begins with Content-ID: string, process it! Otherwise, no need to waste time
m_finishedReplacing = (line.Compare("Content-ID:", PR_TRUE, 11) != 0);
m_finishedReplacing = StringBeginsWith(line, NS_LITERAL_CSTRING("Content-ID:"), nsCaseInsensitiveCStringComparator());
}
void nsOutlookCompose::ReplaceCidInLine::operator () (const CidReplacePair* pair)
{
if (m_finishedReplacing)
return; // Only one cid per line possible!
PRInt32 pos = m_line.Find(pair->cidNew, PR_FALSE, 12);
PRInt32 pos = MsgFind(m_line, pair->cidNew, false, 12);
if (pos != kNotFound) {
m_finishedReplacing = true; // Stop further search
m_line.Replace(pos, pair->cidNew.Length(), pair->cidOrig);
@ -639,7 +638,9 @@ void nsOutlookCompose::UpdateHeaders(CMapiMessageHeaders& oldHeaders, const CMap
void nsOutlookCompose::HackBody(const wchar_t* orig, size_t origLen, nsString& hack)
{
#ifdef MOZILLA_INTERNAL_API
hack.SetCapacity(static_cast<size_t>(origLen*1.4));
#endif
hack.Assign(hackBeginW);
hack.Append(m_hackedPostfix);
@ -674,50 +675,26 @@ void nsOutlookCompose::UnhackBody(nsCString& txt)
hackedString.Assign(hackEndA);
hackedString.Append(hackedPostfixA);
PRInt32 end = txt.Find(hackedString, PR_FALSE, begin);
PRInt32 end = MsgFind(txt, hackedString, PR_FALSE, begin);
if (end == kNotFound)
return; // ?
txt.Cut(end, hackedString.Length());
nsCString range;
range.Assign(Substring(txt, begin, end - begin));
// 1. Remove all CRLFs from the selected range
PRInt32 i = begin;
while (i < end) {
PRInt32 r = txt.Find(MSG_LINEBREAK, PR_FALSE, i, end-i);
if (r == kNotFound)
break;
txt.Cut(r, 2);
end -= 2;
i = r;
}
MsgReplaceSubstring(range, MSG_LINEBREAK, "");
// 2. Restore the original CRLFs
hackedString.Assign(hackCRLFA);
hackedString.Append(hackedPostfixA);
i = begin;
while (i < end) {
PRInt32 r = txt.Find(hackedString, PR_FALSE, i, end-i);
if (r == kNotFound)
break;
txt.Replace(r, hackedString.Length(), MSG_LINEBREAK, 2);
end -= hackedString.Length()-2;
i = r+2;
}
MsgReplaceSubstring(range, hackedString.get(), MSG_LINEBREAK);
// 3. Restore the original ampersands
hackedString.Assign(hackAmpersandA);
hackedString.Append(hackedPostfixA);
i = begin;
while (i < end) {
PRInt32 r = txt.Find(hackedString, PR_FALSE, i, end-i);
if (r == kNotFound)
break;
MsgReplaceSubstring(range, hackedString.get(), "&");
txt.Replace(r, hackedString.Length(), '&');
end -= hackedString.Length()-1;
i = r+1;
}
txt.Replace(begin, end - begin, range);
}
bool nsOutlookCompose::GenerateHackSequence(const wchar_t* body, size_t origLen)
@ -827,9 +804,11 @@ nsresult CCompositionFile::ToDest(_OutFn dest, const char* term, int termSize)
{
CTermGuard guard(term, termSize);
#ifdef MOZILLA_INTERNAL_API
// We already know the required string size, so reduce future reallocations
if (!guard.IsChecking() && !m_convertCRs)
dest.SetCapacity(m_fileSize - m_fileReadPos);
#endif
bool wasCR = false;
char c = 0;
@ -881,7 +860,9 @@ nsresult CCompositionFile::ToDest(_OutFn dest, const char* term, int termSize)
class dest_nsCString {
public:
dest_nsCString(nsCString& str) : m_str(str) { m_str.Truncate(); }
#ifdef MOZILLA_INTERNAL_API
void SetCapacity(PRInt32 sz) { m_str.SetCapacity(sz); }
#endif
nsresult Append(const char* buf, PRUint32 count) {
m_str.Append(buf, count); return NS_OK; }
private:
@ -891,7 +872,9 @@ private:
class dest_Stream {
public:
dest_Stream(nsIOutputStream *dest) : m_stream(dest) {}
#ifdef MOZILLA_INTERNAL_API
void SetCapacity(PRInt32) { /*do nothing*/ }
#endif
// const_cast here is due to the poor design of the EscapeFromSpaceLine()
// that requires a non-constant pointer while doesn't modify its data
nsresult Append(const char* buf, PRUint32 count) {

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

@ -38,10 +38,10 @@
#include "nsOutlookEditor.h"
#include "nsISupportsArray.h"
#include "nsMsgUtils.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsComponentManagerUtils.h"
#include "nsString.h"
#include "nsStringGlue.h"
#include "nsNetUtil.h"
NS_IMPL_ISUPPORTS2(nsOutlookEditor, nsIEditor, nsIEditorMailSupport)
@ -637,8 +637,8 @@ nsresult nsOutlookEditor::GetCids(PRUint32 embedIndex, nsACString& origCid,
if (node) {
if (!node->NewCid())
return NS_ERROR_FAILURE; // no need to replace anything!
LossyCopyUTF16toASCII(node->OrigCid(), origCid);
LossyCopyUTF16toASCII(node->NewCid(), newCid);
LossyCopyUTF16toASCII(nsDependentString(node->OrigCid()), origCid);
LossyCopyUTF16toASCII(nsDependentString(node->NewCid()), newCid);
}
return rv;
}
@ -1332,7 +1332,7 @@ NS_IMETHODIMP nsOutlookHTMLImageElement::SetSrc(const nsAString & aSrc)
// The nsMsgNend::ProcessMultipartRelated seems to call SetSrc twice.
// I'm not sure if I need to do it second time.
if (m_cid_new.IsEmpty())
m_cid_new.Assign(aSrc.Data()+4, aSrc.Length()-4); // strip the "cid:"
m_cid_new.Assign(Substring(aSrc, 4)); // strip the "cid:"
return NS_OK;
}

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

@ -41,7 +41,7 @@
#include "nsIEditorMailSupport.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsStringGlue.h"
#include "nsIFile.h"
class nsOutlookEditor : public nsIEditor, public nsIEditorMailSupport

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

@ -55,7 +55,6 @@
#include "OutlookDebugLog.h"
#include "nsOutlookMail.h"
#include "nsUnicharUtils.h"
#include "nsMsgUtils.h"
#include "nsIOutputStream.h"
#include "nsMsgI18N.h"
#include "nsNetUtil.h"
@ -623,7 +622,7 @@ nsresult nsOutlookMail::CreateList( const PRUnichar * pName,
rv = pDb->GetNewListRow(getter_AddRefs(newListRow));
NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString column;
LossyCopyUTF16toASCII(pName, column );
LossyCopyUTF16toASCII(nsDependentString(pName), column);
rv = pDb->AddListName(newListRow, column.get());
NS_ENSURE_SUCCESS(rv, rv);
@ -721,16 +720,12 @@ nsresult nsOutlookMail::CreateList( const PRUnichar * pName,
void nsOutlookMail::SanitizeValue( nsString& val)
{
val.ReplaceSubstring(NS_LITERAL_STRING("\x0D\x0A").get(),
NS_LITERAL_STRING(", ").get());
val.ReplaceChar( 13, ',');
val.ReplaceChar( 10, ',');
MsgReplaceSubstring(val, NS_LITERAL_STRING("\r\n"), NS_LITERAL_STRING(", "));
MsgReplaceChar(val, "\r\n", ',');
}
void nsOutlookMail::SplitString( nsString& val1, nsString& val2)
{
nsString temp;
// Find the last line if there is more than one!
PRInt32 idx = val1.RFind( "\x0D\x0A");
PRInt32 cnt = 2;
@ -741,9 +736,8 @@ void nsOutlookMail::SplitString( nsString& val1, nsString& val2)
if (idx == -1)
idx= val1.RFindChar( 10);
if (idx != -1) {
val1.Right( val2, val1.Length() - idx - cnt);
val1.Left( temp, idx);
val1 = temp;
val2 = Substring(val1, idx + cnt);
val1.SetLength(idx);
SanitizeValue( val1);
}
}

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

@ -49,6 +49,12 @@
#include "plstr.h"
#include "msgCore.h"
#ifndef MOZILLA_INTERNAL_API
#include "nsMsgI18N.h"
#define NS_CopyNativeToUnicode(source, dest) \
nsMsgI18NConvertToUnicode(nsMsgI18NFileSystemCharset(), source, dest)
#endif
#define kWhitespace " \t\b\r\n"
// If we get a line longer than 32K it's just toooooo bad!

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

@ -72,7 +72,7 @@
#include "nsIPrefBranch.h"
#include "TextDebugLog.h"
#include "nsNetUtil.h"
#include "nsISupportsArray.h"
#include "nsMsgUtils.h"
#define TEXT_MSGS_URL "chrome://messenger/locale/textImportMsgs.properties"
#define TEXTIMPORT_NAME 2000

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

@ -53,7 +53,8 @@
#include "nsIImportService.h"
#include "nsILocalFile.h"
#include "nsImportStringBundle.h"
#include "nsISupportsArray.h"
#include "nsMsgUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsTextFormatter.h"
#include "nsVCardAddress.h"