mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-09 13:25:00 +00:00
70252 62437 r=bienvenu sr=sspitzer Use the platform charset while converting filter name etc
from 4x to 6x.
This commit is contained in:
parent
fcbfe8e3e8
commit
516f6b74bc
@ -39,6 +39,7 @@
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsMsgUtf7Utils.h"
|
||||
#include "nsIImportService.h"
|
||||
|
||||
static const char *kImapPrefix = "//imap:";
|
||||
|
||||
@ -381,6 +382,8 @@ nsresult nsMsgFilter::ConvertMoveToFolderValue(nsCString &moveValue)
|
||||
m_filterList->GetVersion(&filterVersion);
|
||||
if (filterVersion <= k60Beta1Version)
|
||||
{
|
||||
nsCOMPtr <nsIImportService> impSvc = do_GetService(NS_IMPORTSERVICE_CONTRACTID);
|
||||
NS_ASSERTION(impSvc, "cannot get importService");
|
||||
nsCOMPtr <nsIMsgFolder> rootFolder;
|
||||
nsXPIDLCString folderUri;
|
||||
|
||||
@ -391,10 +394,10 @@ nsresult nsMsgFilter::ConvertMoveToFolderValue(nsCString &moveValue)
|
||||
{
|
||||
PRInt32 prefixLen = PL_strlen(kImapPrefix);
|
||||
moveValue.Mid(m_action.m_originalServerPath, prefixLen, moveValue.Length() - prefixLen);
|
||||
if ( filterVersion == k45Version)
|
||||
if ( filterVersion == k45Version && impSvc)
|
||||
{
|
||||
nsAutoString unicodeStr;
|
||||
unicodeStr.AssignWithConversion(m_action.m_originalServerPath.get());
|
||||
impSvc->SystemStringToUnicode(m_action.m_originalServerPath.get(), unicodeStr);
|
||||
char *utfNewName = CreateUtf7ConvertedStringFromUnicode(unicodeStr.get());
|
||||
m_action.m_originalServerPath.Assign(utfNewName);
|
||||
nsCRT::free(utfNewName);
|
||||
@ -460,10 +463,10 @@ nsresult nsMsgFilter::ConvertMoveToFolderValue(nsCString &moveValue)
|
||||
nsCRT::free(unescapedMoveValue);
|
||||
#endif
|
||||
destFolderUri.Append('/');
|
||||
if ( filterVersion == k45Version)
|
||||
if ( filterVersion == k45Version && impSvc)
|
||||
{
|
||||
nsAutoString unicodeStr;
|
||||
unicodeStr.AssignWithConversion(moveValue.get());
|
||||
impSvc->SystemStringToUnicode(moveValue.get(), unicodeStr);
|
||||
nsXPIDLCString escapedName;
|
||||
rv =NS_MsgEscapeEncodeURLPath(unicodeStr.get(), getter_Copies(escapedName));
|
||||
if (NS_SUCCEEDED(rv) && escapedName)
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "nsMsgUtils.h"
|
||||
#include "nsMsgSearchTerm.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
#include "nsIImportService.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsIMsgFilterService.h"
|
||||
|
||||
@ -433,7 +433,7 @@ nsresult nsMsgFilterList::LoadTextFilters(nsIOFileStream *aStream)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
nsMsgFilterFileAttribValue attrib;
|
||||
|
||||
nsCOMPtr<nsIImportService> impSvc;
|
||||
// We'd really like to move lot's of these into the objects that they refer to.
|
||||
aStream->seek(PR_SEEK_SET, 0);
|
||||
do
|
||||
@ -460,7 +460,12 @@ nsresult nsMsgFilterList::LoadTextFilters(nsIOFileStream *aStream)
|
||||
attrib = nsIMsgFilterList::attribNone;
|
||||
NS_ASSERTION(PR_FALSE, "error parsing filter file version");
|
||||
}
|
||||
break;
|
||||
if (m_fileVersion == k45Version)
|
||||
{
|
||||
impSvc = do_GetService(NS_IMPORTSERVICE_CONTRACTID);
|
||||
NS_ASSERTION(impSvc, "cannot get importService");
|
||||
}
|
||||
break;
|
||||
case nsIMsgFilterList::attribLogging:
|
||||
m_loggingEnabled = StrToBool(value);
|
||||
break;
|
||||
@ -473,11 +478,11 @@ nsresult nsMsgFilterList::LoadTextFilters(nsIOFileStream *aStream)
|
||||
break;
|
||||
}
|
||||
filter->SetFilterList(NS_STATIC_CAST(nsIMsgFilterList*,this));
|
||||
if (m_fileVersion == k45Version)
|
||||
if (m_fileVersion == k45Version && impSvc)
|
||||
{
|
||||
nsAutoString unicodeStr;
|
||||
unicodeStr.AssignWithConversion(value.get());
|
||||
filter->SetFilterName(unicodeStr.get());
|
||||
nsAutoString unicodeStr;
|
||||
impSvc->SystemStringToUnicode(value.get(), unicodeStr);
|
||||
filter->SetFilterName(unicodeStr.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -534,10 +539,10 @@ nsresult nsMsgFilterList::LoadTextFilters(nsIOFileStream *aStream)
|
||||
case nsIMsgFilterList::attribCondition:
|
||||
if (m_curFilter)
|
||||
{
|
||||
if ( m_fileVersion == k45Version)
|
||||
if ( m_fileVersion == k45Version && impSvc)
|
||||
{
|
||||
nsAutoString unicodeStr;
|
||||
unicodeStr.AssignWithConversion(value.get());
|
||||
impSvc->SystemStringToUnicode(value.get(), unicodeStr);
|
||||
char *utf8 = unicodeStr.ToNewUTF8String();
|
||||
value.Assign(utf8);
|
||||
nsMemory::Free(utf8);
|
||||
|
Loading…
Reference in New Issue
Block a user