зеркало из https://github.com/mozilla/pjs.git
Bug 369913 Remove Duplicated code in nsIImportService and nsMsgI18N.h/cpp (Part 2). r/sr=bienvenu
This commit is contained in:
Родитель
cd6d4a1126
Коммит
dfdf0c4349
|
@ -67,8 +67,7 @@ REQUIRES = xpcom \
|
|||
pref \
|
||||
msgnews \
|
||||
txmgr \
|
||||
import \
|
||||
addrbook \
|
||||
addrbook \
|
||||
docshell \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@
|
|||
#include "nsReadableUtils.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsMsgI18N.h"
|
||||
#include "nsIImportService.h"
|
||||
#include "nsISupportsObsolete.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
@ -625,8 +624,6 @@ nsresult nsMsgFilter::ConvertMoveOrCopyToFolderValue(nsIMsgRuleAction *filterAct
|
|||
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;
|
||||
|
||||
|
@ -638,11 +635,15 @@ nsresult nsMsgFilter::ConvertMoveOrCopyToFolderValue(nsIMsgRuleAction *filterAct
|
|||
PRInt32 prefixLen = PL_strlen(kImapPrefix);
|
||||
nsCAutoString originalServerPath;
|
||||
moveValue.Mid(originalServerPath, prefixLen, moveValue.Length() - prefixLen);
|
||||
if ( filterVersion == k45Version && impSvc)
|
||||
if (filterVersion == k45Version)
|
||||
{
|
||||
nsAutoString unicodeStr;
|
||||
impSvc->SystemStringToUnicode(originalServerPath.get(), unicodeStr);
|
||||
nsresult rv = CopyUTF16toMUTF7(unicodeStr, originalServerPath);
|
||||
nsresult rv = nsMsgI18NConvertToUnicode(nsMsgI18NFileSystemCharset(),
|
||||
originalServerPath,
|
||||
unicodeStr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = CopyUTF16toMUTF7(unicodeStr, originalServerPath);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
@ -703,10 +704,13 @@ nsresult nsMsgFilter::ConvertMoveOrCopyToFolderValue(nsIMsgRuleAction *filterAct
|
|||
nsCRT::free(unescapedMoveValue);
|
||||
#endif
|
||||
destFolderUri.Append('/');
|
||||
if ( filterVersion == k45Version && impSvc)
|
||||
if (filterVersion == k45Version)
|
||||
{
|
||||
nsAutoString unicodeStr;
|
||||
impSvc->SystemStringToUnicode(moveValue.get(), unicodeStr);
|
||||
rv = nsMsgI18NConvertToUnicode(nsMsgI18NFileSystemCharset(),
|
||||
moveValue, unicodeStr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = NS_MsgEscapeEncodeURLPath(unicodeStr, moveValue);
|
||||
}
|
||||
destFolderUri.Append(moveValue);
|
||||
|
|
|
@ -50,12 +50,12 @@
|
|||
#include "nsMsgSearchTerm.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIImportService.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsIMsgFilterService.h"
|
||||
#include "nsMsgSearchScopeTerm.h"
|
||||
#include "nsISupportsObsolete.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsMsgI18N.h"
|
||||
|
||||
// unicode "%s" format string
|
||||
static const PRUnichar unicodeFormatter[] = {
|
||||
|
@ -563,7 +563,6 @@ nsresult nsMsgFilterList::LoadTextFilters(nsIOFileStream *aStream)
|
|||
{
|
||||
nsresult err = NS_OK;
|
||||
nsMsgFilterFileAttribValue attrib;
|
||||
nsCOMPtr<nsIImportService> impSvc;
|
||||
nsCOMPtr<nsIMsgRuleAction> currentFilterAction;
|
||||
// We'd really like to move lot's of these into the objects that they refer to.
|
||||
aStream->seek(PR_SEEK_SET, 0);
|
||||
|
@ -591,11 +590,6 @@ nsresult nsMsgFilterList::LoadTextFilters(nsIOFileStream *aStream)
|
|||
attrib = nsIMsgFilterList::attribNone;
|
||||
NS_ASSERTION(PR_FALSE, "error parsing filter file version");
|
||||
}
|
||||
if (m_fileVersion == k45Version)
|
||||
{
|
||||
impSvc = do_GetService(NS_IMPORTSERVICE_CONTRACTID);
|
||||
NS_ASSERTION(impSvc, "cannot get importService");
|
||||
}
|
||||
break;
|
||||
case nsIMsgFilterList::attribLogging:
|
||||
m_loggingEnabled = StrToBool(value);
|
||||
|
@ -627,10 +621,14 @@ nsresult nsMsgFilterList::LoadTextFilters(nsIOFileStream *aStream)
|
|||
break;
|
||||
}
|
||||
filter->SetFilterList(NS_STATIC_CAST(nsIMsgFilterList*,this));
|
||||
if (m_fileVersion == k45Version && impSvc)
|
||||
if (m_fileVersion == k45Version)
|
||||
{
|
||||
nsAutoString unicodeStr;
|
||||
impSvc->SystemStringToUnicode(value.get(), unicodeStr);
|
||||
err = nsMsgI18NConvertToUnicode(nsMsgI18NFileSystemCharset(),
|
||||
value, unicodeStr);
|
||||
if (NS_FAILED(err))
|
||||
break;
|
||||
|
||||
filter->SetFilterName(unicodeStr.get());
|
||||
}
|
||||
else
|
||||
|
@ -722,10 +720,14 @@ nsresult nsMsgFilterList::LoadTextFilters(nsIOFileStream *aStream)
|
|||
case nsIMsgFilterList::attribCondition:
|
||||
if (m_curFilter)
|
||||
{
|
||||
if ( m_fileVersion == k45Version && impSvc)
|
||||
if (m_fileVersion == k45Version)
|
||||
{
|
||||
nsAutoString unicodeStr;
|
||||
impSvc->SystemStringToUnicode(value.get(), unicodeStr);
|
||||
err = nsMsgI18NConvertToUnicode(nsMsgI18NFileSystemCharset(),
|
||||
value, unicodeStr);
|
||||
if (NS_FAILED(err))
|
||||
break;
|
||||
|
||||
char *utf8 = ToNewUTF8String(unicodeStr);
|
||||
value.Assign(utf8);
|
||||
nsMemory::Free(utf8);
|
||||
|
|
Загрузка…
Ссылка в новой задаче