Bug 945045 - Remove nsISupportsArray in mailnews/import. r=Standard8

CLOSED TREE
This commit is contained in:
Hiroyuki Ikezoe 2013-11-28 07:12:07 +09:00
Родитель b5d2afc5d5
Коммит 85df3a5c78
32 изменённых файлов: 248 добавлений и 232 удалений

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

@ -19,6 +19,7 @@
#include "nsIMsgFolder.h"
#include "nsIMsgHdr.h"
#include "nsIMsgPluggableStore.h"
#include "nsIMutableArray.h"
#include "nsNetUtil.h"
#include "nsMsgUtils.h"
#include "mozilla/Services.h"
@ -180,7 +181,7 @@ NS_IMETHODIMP nsAppleMailImportMail::GetDefaultLocation(nsIFile **aLocation, boo
// this is the method that initiates all searching for mailboxes.
// it will assume that it has a directory like ~/Library/Mail/
NS_IMETHODIMP nsAppleMailImportMail::FindMailboxes(nsIFile *aMailboxFile, nsISupportsArray **aResult)
NS_IMETHODIMP nsAppleMailImportMail::FindMailboxes(nsIFile *aMailboxFile, nsIArray **aResult)
{
NS_ENSURE_ARG_POINTER(aMailboxFile);
NS_ENSURE_ARG_POINTER(aResult);
@ -195,8 +196,7 @@ NS_IMETHODIMP nsAppleMailImportMail::FindMailboxes(nsIFile *aMailboxFile, nsISup
nsCOMPtr<nsIImportService> importService(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISupportsArray> resultsArray;
NS_NewISupportsArray(getter_AddRefs(resultsArray));
nsCOMPtr<nsIMutableArray> resultsArray(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
if (!resultsArray)
return NS_ERROR_OUT_OF_MEMORY;
@ -224,14 +224,14 @@ NS_IMETHODIMP nsAppleMailImportMail::FindMailboxes(nsIFile *aMailboxFile, nsISup
}
if (NS_SUCCEEDED(rv) && resultsArray)
resultsArray.swap(*aResult);
resultsArray.forget(aResult);
return rv;
}
// operates on the Mail/ directory root, trying to find accounts (which are folders named something like "POP-hwaara@gmail.com")
// and add their .mbox dirs
void nsAppleMailImportMail::FindAccountMailDirs(nsIFile *aRoot, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService)
void nsAppleMailImportMail::FindAccountMailDirs(nsIFile *aRoot, nsIMutableArray *aMailboxDescs, nsIImportService *aImportService)
{
nsCOMPtr<nsISimpleEnumerator> directoryEnumerator;
nsresult rv = aRoot->GetDirectoryEntries(getter_AddRefs(directoryEnumerator));
@ -293,7 +293,7 @@ void nsAppleMailImportMail::FindAccountMailDirs(nsIFile *aRoot, nsISupportsArray
mailboxDescFile->InitWithFile(currentEntry);
// add this mailbox descriptor to the list
aMailboxDescs->AppendElement(desc);
aMailboxDescs->AppendElement(desc, false);
// now add all the children mailboxes
mCurDepth++;
@ -305,7 +305,7 @@ void nsAppleMailImportMail::FindAccountMailDirs(nsIFile *aRoot, nsISupportsArray
}
// adds the specified file as a mailboxdescriptor to the array
nsresult nsAppleMailImportMail::AddMboxDir(nsIFile *aFolder, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService)
nsresult nsAppleMailImportMail::AddMboxDir(nsIFile *aFolder, nsIMutableArray *aMailboxDescs, nsIImportService *aImportService)
{
nsAutoString folderName;
aFolder->GetLeafName(folderName);
@ -370,7 +370,7 @@ nsresult nsAppleMailImportMail::AddMboxDir(nsIFile *aFolder, nsISupportsArray *a
mailboxDescFile->InitWithFile(aFolder);
// add this mailbox descriptor to the list
aMailboxDescs->AppendElement(desc);
aMailboxDescs->AppendElement(desc, false);
}
return NS_OK;
@ -386,7 +386,7 @@ nsresult nsAppleMailImportMail::AddMboxDir(nsIFile *aFolder, nsISupportsArray *a
// MyChildMailbox.mbox/
// MyOtherChildMailbox.mbox/
//
nsresult nsAppleMailImportMail::FindMboxDirs(nsIFile *aFolder, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService)
nsresult nsAppleMailImportMail::FindMboxDirs(nsIFile *aFolder, nsIMutableArray *aMailboxDescs, nsIImportService *aImportService)
{
NS_ENSURE_ARG_POINTER(aFolder);
NS_ENSURE_ARG_POINTER(aMailboxDescs);

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

@ -11,7 +11,6 @@
#include "nsCOMPtr.h"
#include "nsIStringBundle.h"
#include "nsIImportMail.h"
#include "nsISupportsArray.h"
// logging facilities
extern PRLogModuleInfo *APPLEMAILLOGMODULE;
@ -32,6 +31,7 @@ extern PRLogModuleInfo *APPLEMAILLOGMODULE;
#define kAppleMailSupportsString "mail"
class nsIImportService;
class nsIMutableArray;
class nsAppleMailImportModule : public nsIImportModule
{
@ -62,9 +62,9 @@ class nsAppleMailImportMail : public nsIImportMail
private:
void FindAccountMailDirs(nsIFile *aRoot, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService);
nsresult FindMboxDirs(nsIFile *aFolder, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService);
nsresult AddMboxDir(nsIFile *aFolder, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService);
void FindAccountMailDirs(nsIFile *aRoot, nsIMutableArray *aMailboxDescs, nsIImportService *aImportService);
nsresult FindMboxDirs(nsIFile *aFolder, nsIMutableArray *aMailboxDescs, nsIImportService *aImportService);
nsresult AddMboxDir(nsIFile *aFolder, nsIMutableArray *aMailboxDescs, nsIImportService *aImportService);
// aInfoString is the format to a "foo %s" string. It may be NULL if the error string needs no such format.
void ReportStatus(int32_t aErrorNum, nsString &aName, nsAString &aStream);

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

@ -11,7 +11,6 @@
#include "nsStringGlue.h"
#include "nsVoidArray.h"
#include "nsIFile.h"
#include "nsISupportsArray.h"
#include "nsCOMPtr.h"
#include "nsIImportService.h"
@ -20,6 +19,7 @@ class nsIAddrDatabase;
class CAliasEntry;
class CAliasData;
class nsIStringBundle;
class nsIMutableArray;
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
@ -34,7 +34,7 @@ public:
// retrieve the mail folder
virtual bool FindAddressFolder(nsIFile **pFolder) { return false;}
// get the list of mailboxes
virtual nsresult FindAddressBooks(nsIFile *pRoot, nsISupportsArray **ppArray) { return NS_ERROR_FAILURE;}
virtual nsresult FindAddressBooks(nsIFile *pRoot, nsIMutableArray *pArray) { return NS_ERROR_FAILURE;}
// Non-platform specific common stuff
// import a mailbox

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

@ -612,7 +612,7 @@ nsresult nsEudoraCompose::SendTheMessage(nsIFile *pMailImportLocation, nsIFile *
nsCOMPtr<nsIArray> pAttach;
GetLocalAttachments(getter_AddRefs(pAttach));
nsEudoraEditor eudoraEditor(m_pBody, pMailImportLocation);
nsCOMPtr<nsISupportsArray> embeddedObjects;
nsCOMPtr<nsIArray> embeddedObjects;
if (eudoraEditor.HasEmbeddedContent())
eudoraEditor.GetEmbeddedObjects(getter_AddRefs(embeddedObjects));

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

@ -5,7 +5,7 @@
#include "nsEudoraEditor.h"
#include "nsISupportsArray.h"
#include "nsIArray.h"
#include "nsComponentManagerUtils.h"
#include "nsStringGlue.h"
#include "nsMsgUtils.h"
@ -57,7 +57,7 @@ nsEudoraEditor::~nsEudoraEditor()
{
}
nsresult nsEudoraEditor::GetEmbeddedObjects(nsISupportsArray ** aNodeList)
nsresult nsEudoraEditor::GetEmbeddedObjects(nsIArray ** aNodeList)
{
NS_ENSURE_ARG_POINTER(aNodeList);
@ -69,7 +69,8 @@ nsresult nsEudoraEditor::GetEmbeddedObjects(nsISupportsArray ** aNodeList)
}
// Create array in m_EmbeddedObjectList
nsresult rv = NS_NewISupportsArray(getter_AddRefs(m_EmbeddedObjectList));
nsresult rv;
m_EmbeddedObjectList = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
// Return m_EmbeddedObjectList in aNodeList and increment ref count - caller
@ -173,7 +174,7 @@ nsresult nsEudoraEditor::GetEmbeddedObjects(nsISupportsArray ** aNodeList)
new nsImportEmbeddedImageData(embeddedFileURI, NS_LossyConvertUTF16toASCII(cid));
// Append the embedded image node to the list
m_EmbeddedObjectList->AppendElement(imageData);
m_EmbeddedObjectList->AppendElement(imageData, false);
int32_t endEmbeddedContentLine = m_body.Find("\r\n", true, startEmbeddedContentLine+1);
if (endEmbeddedContentLine != kNotFound)

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

@ -9,6 +9,7 @@
#include "nsCOMPtr.h"
#include "nsStringGlue.h"
#include "nsIFile.h"
#include "nsIMutableArray.h"
class nsEudoraEditor
@ -19,11 +20,11 @@ class nsEudoraEditor
bool GetEmbeddedImageCID(uint32_t aCIDHash, const nsAString & aOldRef, nsString &aCID);
bool HasEmbeddedContent();
nsresult GetEmbeddedObjects(nsISupportsArray ** aNodeList);
nsresult GetEmbeddedObjects(nsIArray ** aNodeList);
nsresult GetBody(nsAString & _retval) {_retval = m_body; return NS_OK;}
protected:
NS_ConvertASCIItoUTF16 m_body;
nsCOMPtr <nsIFile> m_pMailImportLocation;
nsCOMPtr<nsISupportsArray> m_EmbeddedObjectList; // Initialized when GetEmbeddedObjects is called
nsCOMPtr<nsIMutableArray> m_EmbeddedObjectList; // Initialized when GetEmbeddedObjects is called
};

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

@ -391,11 +391,11 @@ nsresult nsEudoraFilters::LoadServers()
if (m_pServerArray)
rv = m_pServerArray->Clear();
else
rv = NS_NewISupportsArray(getter_AddRefs(m_pServerArray));
m_pServerArray = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
if (!m_pFilterArray)
rv = NS_NewISupportsArray(getter_AddRefs(m_pFilterArray));
m_pFilterArray = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMsgAccountManager> accountMgr = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
@ -431,7 +431,7 @@ nsresult nsEudoraFilters::LoadServers()
rv = server->GetFilterList(nullptr, getter_AddRefs(filterList));
NS_ENSURE_SUCCESS(rv, rv);
m_pServerArray->AppendElement(server);
m_pServerArray->AppendElement(server, false);
}
}
}
@ -446,7 +446,7 @@ nsresult nsEudoraFilters::SaveFilters()
nsresult rv;
uint32_t numServers;
rv = m_pServerArray->Count(&numServers);
rv = m_pServerArray->GetLength(&numServers);
NS_ENSURE_SUCCESS(rv, rv);
for (uint32_t serverIndex = 0; serverIndex < numServers; serverIndex++)
{
@ -474,7 +474,7 @@ nsresult nsEudoraFilters::CreateNewFilter(const char* pName)
nsAutoString unicodeName;
NS_CopyNativeToUnicode(nsCString(pName), unicodeName);
uint32_t numServers;
rv = m_pServerArray->Count(&numServers);
rv = m_pServerArray->GetLength(&numServers);
NS_ENSURE_SUCCESS(rv, rv);
for (uint32_t serverIndex = 0; serverIndex < numServers; serverIndex++)
{
@ -499,7 +499,7 @@ nsresult nsEudoraFilters::CreateNewFilter(const char* pName)
rv = filterList->InsertFilterAt(count, newFilter);
NS_ENSURE_SUCCESS(rv, rv);
m_pFilterArray->AppendElement(newFilter);
m_pFilterArray->AppendElement(newFilter, false);
}
m_isAnd = false;
@ -539,7 +539,7 @@ nsresult nsEudoraFilters::EnableFilter(bool enable)
nsresult rv;
uint32_t numFilters;
rv = m_pFilterArray->Count(&numFilters);
rv = m_pFilterArray->GetLength(&numFilters);
NS_ENSURE_SUCCESS(rv, rv);
for (uint32_t filterIndex = 0; filterIndex < numFilters; filterIndex++)
{
@ -744,7 +744,7 @@ nsresult nsEudoraFilters::AddTerm(const char* pHeader, const char* pVerb, const
}
uint32_t numFilters;
rv = m_pFilterArray->Count(&numFilters);
rv = m_pFilterArray->GetLength(&numFilters);
NS_ENSURE_SUCCESS(rv, rv);
for (uint32_t filterIndex = 0; filterIndex < numFilters; filterIndex++)
{
@ -793,7 +793,7 @@ nsresult nsEudoraFilters::AddAction(nsMsgRuleActionType actionType, int32_t junk
nsresult rv;
uint32_t numFilters;
rv = m_pFilterArray->Count(&numFilters);
rv = m_pFilterArray->GetLength(&numFilters);
NS_ENSURE_SUCCESS(rv, rv);
for (uint32_t filterIndex = 0; filterIndex < numFilters; filterIndex++)
{

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

@ -8,6 +8,7 @@
#include "nsIImportFilters.h"
#include "nsIFile.h"
#include "nsIMutableArray.h"
#include "nsCOMPtr.h"
#include "nsMsgFilterCore.h"
@ -28,8 +29,8 @@ public:
private:
nsCOMPtr<nsIFile> m_pLocation;
nsCOMPtr<nsISupportsArray> m_pServerArray;
nsCOMPtr<nsISupportsArray> m_pFilterArray;
nsCOMPtr<nsIMutableArray> m_pServerArray;
nsCOMPtr<nsIMutableArray> m_pFilterArray;
nsCOMPtr<nsIMsgFolder> m_pMailboxesRoot;
nsString m_errorLog;

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

@ -23,6 +23,7 @@
#include "nsComponentManagerUtils.h"
#include "nsEudoraImport.h"
#include "nsIMemory.h"
#include "nsIMutableArray.h"
#include "nsIImportService.h"
#include "nsIImportMail.h"
#include "nsIImportMailboxDescriptor.h"
@ -75,8 +76,8 @@ public:
/* void GetDefaultLocation (out nsIFile location, out boolean found, out boolean userVerify); */
NS_IMETHOD GetDefaultLocation(nsIFile **location, bool *found, bool *userVerify);
/* nsISupportsArray FindMailboxes (in nsIFile location); */
NS_IMETHOD FindMailboxes(nsIFile *location, nsISupportsArray **_retval);
/* nsIArray FindMailboxes (in nsIFile location); */
NS_IMETHOD FindMailboxes(nsIFile *location, nsIArray **_retval);
NS_IMETHOD ImportMailbox(nsIImportMailboxDescriptor *source,
nsIMsgFolder *dstFolder,
@ -129,7 +130,7 @@ public:
NS_IMETHOD GetDefaultLocation(nsIFile **location, bool *found, bool *userVerify);
NS_IMETHOD FindAddressBooks(nsIFile *location, nsISupportsArray **_retval);
NS_IMETHOD FindAddressBooks(nsIFile *location, nsIArray **_retval);
NS_IMETHOD InitFieldMap(nsIImportFieldMap *fieldMap)
{ return NS_ERROR_FAILURE; }
@ -423,7 +424,7 @@ NS_IMETHODIMP ImportEudoraMailImpl::GetDefaultLocation(nsIFile **ppLoc, bool *fo
}
NS_IMETHODIMP ImportEudoraMailImpl::FindMailboxes(nsIFile *pLoc, nsISupportsArray **ppArray)
NS_IMETHODIMP ImportEudoraMailImpl::FindMailboxes(nsIFile *pLoc, nsIArray **ppArray)
{
NS_PRECONDITION(pLoc != nullptr, "null ptr");
NS_PRECONDITION(ppArray != nullptr, "null ptr");
@ -435,11 +436,19 @@ NS_IMETHODIMP ImportEudoraMailImpl::FindMailboxes(nsIFile *pLoc, nsISupportsArra
if (NS_FAILED(rv) || !exists)
return NS_ERROR_FAILURE;
rv = m_eudora.FindMailboxes(pLoc, ppArray);
if (NS_FAILED(rv) && *ppArray)
NS_RELEASE(*ppArray);
nsCOMPtr<nsIMutableArray> array(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
if (NS_FAILED(rv))
{
IMPORT_LOG0("FAILED to allocate the nsIMutableArray\n");
return rv;
}
rv = m_eudora.FindMailboxes(pLoc, array);
if (NS_FAILED(rv))
return rv;
return rv;
array.forget(ppArray);
return NS_OK;
}
void ImportEudoraMailImpl::AddLinebreak(nsString *pStream)
@ -632,7 +641,7 @@ NS_IMETHODIMP ImportEudoraAddressImpl::GetDefaultLocation(nsIFile **ppLoc, bool
NS_IMETHODIMP ImportEudoraAddressImpl::FindAddressBooks(nsIFile *pLoc, nsISupportsArray **ppArray)
NS_IMETHODIMP ImportEudoraAddressImpl::FindAddressBooks(nsIFile *pLoc, nsIArray **ppArray)
{
NS_PRECONDITION(pLoc != nullptr, "null ptr");
NS_PRECONDITION(ppArray != nullptr, "null ptr");
@ -644,11 +653,19 @@ NS_IMETHODIMP ImportEudoraAddressImpl::FindAddressBooks(nsIFile *pLoc, nsISuppor
if (NS_FAILED(rv) || !exists)
return NS_ERROR_FAILURE;
rv = m_eudora.FindAddressBooks(pLoc, ppArray);
if (NS_FAILED(rv) && *ppArray)
NS_RELEASE(*ppArray);
nsCOMPtr<nsIMutableArray> array(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
if (NS_FAILED(rv))
{
IMPORT_LOG0("FAILED to allocate the nsIMutableArray\n");
return rv;
}
rv = m_eudora.FindAddressBooks(pLoc, array);
if (NS_FAILED(rv))
return rv;
return rv;
array.forget(ppArray);
return NS_OK;
}

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

@ -9,6 +9,7 @@
#include "nsIServiceManager.h"
#include "nsIMsgAccountManager.h"
#include "nsIMsgAccount.h"
#include "nsIMutableArray.h"
#include "nsMsgBaseCID.h"
#include "nsMsgCompCID.h"
#include "nsISmtpService.h"
@ -212,15 +213,9 @@ bool nsEudoraMac::VerifyEudoraLocation(nsIFile **pFolder, bool findIni)
}
nsresult nsEudoraMac::FindMailboxes(nsIFile *pRoot, nsISupportsArray **ppArray)
nsresult nsEudoraMac::FindMailboxes(nsIFile *pRoot, nsIMutableArray *pArray)
{
nsresult rv = NS_NewISupportsArray(ppArray);
if (NS_FAILED(rv))
{
IMPORT_LOG0("FAILED to allocate the nsISupportsArray\n");
return rv;
}
nsresult rv;
nsCOMPtr<nsIImportService> impSvc(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
@ -228,11 +223,11 @@ nsresult nsEudoraMac::FindMailboxes(nsIFile *pRoot, nsISupportsArray **ppArray)
m_depth = 0;
m_mailImportLocation = do_QueryInterface(pRoot);
return ScanMailDir(pRoot, *ppArray, impSvc);
return ScanMailDir(pRoot, pArray, impSvc);
}
nsresult nsEudoraMac::ScanMailDir(nsIFile *pFolder, nsISupportsArray *pArray, nsIImportService *pImport)
nsresult nsEudoraMac::ScanMailDir(nsIFile *pFolder, nsIMutableArray *pArray, nsIImportService *pImport)
{
// On Windows, we look for a descmap file but on Mac we just iterate
@ -247,7 +242,7 @@ nsresult nsEudoraMac::ScanMailDir(nsIFile *pFolder, nsISupportsArray *pArray, ns
return rv;
}
nsresult nsEudoraMac::IterateMailDir(nsIFile *pFolder, nsISupportsArray *pArray, nsIImportService *pImport)
nsresult nsEudoraMac::IterateMailDir(nsIFile *pFolder, nsIMutableArray *pArray, nsIImportService *pImport)
{
bool hasMore;
nsCOMPtr<nsISimpleEnumerator> directoryEnumerator;
@ -312,7 +307,7 @@ nsresult nsEudoraMac::IterateMailDir(nsIFile *pFolder, nsISupportsArray *pArray,
}
nsresult nsEudoraMac::FoundMailbox(nsIFile *mailFile, const char *pName, nsISupportsArray *pArray, nsIImportService *pImport)
nsresult nsEudoraMac::FoundMailbox(nsIFile *mailFile, const char *pName, nsIMutableArray *pArray, nsIImportService *pImport)
{
nsAutoString displayName;
nsCOMPtr<nsIImportMailboxDescriptor> desc;
@ -344,7 +339,7 @@ nsresult nsEudoraMac::FoundMailbox(nsIFile *mailFile, const char *pName, nsISupp
pLocalFile->InitWithFile(mailFile);
}
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
pArray->AppendElement(pInterface);
pArray->AppendElement(pInterface, false);
pInterface->Release();
}
@ -352,7 +347,7 @@ nsresult nsEudoraMac::FoundMailbox(nsIFile *mailFile, const char *pName, nsISupp
}
nsresult nsEudoraMac::FoundMailFolder(nsIFile *mailFolder, const char *pName, nsISupportsArray *pArray, nsIImportService *pImport)
nsresult nsEudoraMac::FoundMailFolder(nsIFile *mailFolder, const char *pName, nsIMutableArray *pArray, nsIImportService *pImport)
{
nsAutoString displayName;
nsCOMPtr<nsIImportMailboxDescriptor> desc;
@ -382,7 +377,7 @@ nsresult nsEudoraMac::FoundMailFolder(nsIFile *mailFolder, const char *pName, ns
if (pFile)
pFile->InitWithFile(mailFolder);
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
pArray->AppendElement(pInterface);
pArray->AppendElement(pInterface, false);
pInterface->Release();
}
@ -1102,7 +1097,7 @@ bool nsEudoraMac::FindAddressFolder(nsIFile **pFolder)
return FindEudoraLocation(pFolder);
}
nsresult nsEudoraMac::FindAddressBooks(nsIFile *pRoot, nsISupportsArray **ppArray)
nsresult nsEudoraMac::FindAddressBooks(nsIFile *pRoot, nsIMutableArray *pArray)
{
// Look for the nicknames file in this folder and then
// additional files in the Nicknames folder
@ -1113,12 +1108,6 @@ nsresult nsEudoraMac::FindAddressBooks(nsIFile *pRoot, nsISupportsArray **ppArra
rv = file->InitWithFile(pRoot);
if (NS_FAILED(rv))
return rv;
rv = NS_NewISupportsArray(ppArray);
if (NS_FAILED(rv))
{
IMPORT_LOG0("FAILED to allocate the nsISupportsArray\n");
return rv;
}
nsCOMPtr<nsIImportService> impSvc(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv))
@ -1153,7 +1142,7 @@ nsresult nsEudoraMac::FindAddressBooks(nsIFile *pRoot, nsISupportsArray **ppArra
// SetAbFile will clone the file we pass to it.
desc->SetAbFile(file);
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
(*ppArray)->AppendElement(pInterface);
pArray->AppendElement(pInterface, false);
pInterface->Release();
}
if (NS_FAILED(rv))
@ -1227,7 +1216,7 @@ nsresult nsEudoraMac::FindAddressBooks(nsIFile *pRoot, nsISupportsArray **ppArra
// SetAbFile will clone the file we pass to it.
desc->SetAbFile(entry);
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
(*ppArray)->AppendElement(pInterface);
pArray->AppendElement(pInterface, false);
pInterface->Release();
}
if (NS_FAILED(rv))

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

@ -11,7 +11,6 @@
#include "nscore.h"
#include "nsStringGlue.h"
#include "nsIFile.h"
#include "nsISupportsArray.h"
#include "nsEudoraMailbox.h"
#include "nsEudoraAddress.h"
@ -20,6 +19,7 @@
class nsIImportService;
class nsIMsgAccountManager;
class nsIMsgAccount;
class nsIMutableArray;
class nsEudoraMac : public nsEudoraMailbox, public nsEudoraAddress {
@ -31,7 +31,7 @@ public:
virtual bool FindMailFolder(nsIFile **pFolder) MOZ_OVERRIDE;
// get the list of mailboxes
virtual nsresult FindMailboxes(nsIFile *pRoot,
nsISupportsArray **ppArray) MOZ_OVERRIDE;
nsIMutableArray *pArray) MOZ_OVERRIDE;
// get a TOC file from a mailbox file
virtual nsresult FindTOCFile(nsIFile *pMailFile,
nsIFile **pTOCFile,
@ -46,7 +46,7 @@ public:
virtual bool FindAddressFolder(nsIFile **pFolder) MOZ_OVERRIDE;
// get the list of mailboxes
virtual nsresult FindAddressBooks(nsIFile *pRoot,
nsISupportsArray **ppArray) MOZ_OVERRIDE;
nsIMutableArray *pArray) MOZ_OVERRIDE;
// import settings
static bool ImportSettings(nsIFile *pIniFile,
@ -66,18 +66,18 @@ private:
nsresult ScanMailDir(nsIFile *pFolder,
nsISupportsArray *pArray,
nsIMutableArray *pArray,
nsIImportService *pImport);
nsresult IterateMailDir(nsIFile *pFolder,
nsISupportsArray *pArray,
nsIMutableArray *pArray,
nsIImportService *pImport);
nsresult FoundMailFolder(nsIFile *mailFolder,
const char *pName,
nsISupportsArray *pArray,
nsIMutableArray *pArray,
nsIImportService *pImport);
nsresult FoundMailbox(nsIFile *mailFile,
const char *pName,
nsISupportsArray *pArray,
nsIMutableArray *pArray,
nsIImportService *pImport);
bool IsValidMailFolderName(nsCString& name);

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

@ -11,10 +11,10 @@
#include "nsStringGlue.h"
#include "nsVoidArray.h"
#include "nsIFile.h"
#include "nsISupportsArray.h"
#include "nsEudoraCompose.h"
class nsIOutputStream;
class nsIMutableArray;
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
@ -141,7 +141,7 @@ public:
// retrieve the mail folder
virtual bool FindMailFolder(nsIFile **pFolder) { return false;}
// get the list of mailboxes
virtual nsresult FindMailboxes(nsIFile *pRoot, nsISupportsArray **ppArray) { return NS_ERROR_FAILURE;}
virtual nsresult FindMailboxes(nsIFile *pRoot, nsIMutableArray *pArray) { return NS_ERROR_FAILURE;}
// get the toc file corresponding to this mailbox
virtual nsresult FindTOCFile(nsIFile *pMailFile, nsIFile **pTOCFile, bool *pDeleteToc) { return NS_ERROR_FAILURE;}
// interpret the attachment line and return the attached file

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

@ -10,6 +10,7 @@
#include "nsIServiceManager.h"
#include "nsIMsgAccountManager.h"
#include "nsIMsgAccount.h"
#include "nsIMutableArray.h"
#include "nsIPop3IncomingServer.h"
#include "nsMsgBaseCID.h"
#include "nsMsgCompCID.h"
@ -150,26 +151,20 @@ bool nsEudoraWin32::FindEudoraLocation(nsIFile **pFolder, bool findIni)
return result;
}
nsresult nsEudoraWin32::FindMailboxes(nsIFile *pRoot, nsISupportsArray **ppArray)
nsresult nsEudoraWin32::FindMailboxes(nsIFile *pRoot, nsIMutableArray *pArray)
{
nsresult rv = NS_NewISupportsArray(ppArray);
if (NS_FAILED(rv))
{
IMPORT_LOG0("FAILED to allocate the nsISupportsArray\n");
return rv;
}
nsresult rv;
nsCOMPtr<nsIImportService> impSvc(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
m_depth = 0;
m_mailImportLocation = do_QueryInterface(pRoot);
return ScanMailDir(pRoot, *ppArray, impSvc);
return ScanMailDir(pRoot, pArray, impSvc);
}
nsresult nsEudoraWin32::ScanMailDir(nsIFile *pFolder, nsISupportsArray *pArray, nsIImportService *pImport)
nsresult nsEudoraWin32::ScanMailDir(nsIFile *pFolder, nsIMutableArray *pArray, nsIImportService *pImport)
{
bool exists = false;
bool isFile = false;
@ -231,7 +226,7 @@ nsresult nsEudoraWin32::ScanMailDir(nsIFile *pFolder, nsISupportsArray *pArray,
return rv;
}
nsresult nsEudoraWin32::IterateMailDir(nsIFile *pFolder, nsISupportsArray *pArray, nsIImportService *pImport)
nsresult nsEudoraWin32::IterateMailDir(nsIFile *pFolder, nsIMutableArray *pArray, nsIImportService *pImport)
{
bool hasMore;
nsCOMPtr<nsISimpleEnumerator> directoryEnumerator;
@ -298,7 +293,7 @@ nsresult nsEudoraWin32::IterateMailDir(nsIFile *pFolder, nsISupportsArray *pArra
return rv;
}
nsresult nsEudoraWin32::ScanDescmap(nsIFile *pFolder, nsISupportsArray *pArray, nsIImportService *pImport, const char *pData, int32_t len)
nsresult nsEudoraWin32::ScanDescmap(nsIFile *pFolder, nsIMutableArray *pArray, nsIImportService *pImport, const char *pData, int32_t len)
{
// use this to find stuff in the directory.
@ -425,7 +420,7 @@ nsresult nsEudoraWin32::ScanDescmap(nsIFile *pFolder, nsISupportsArray *pArray,
}
nsresult nsEudoraWin32::FoundMailbox(nsIFile *mailFile, const char *pName, nsISupportsArray *pArray, nsIImportService *pImport)
nsresult nsEudoraWin32::FoundMailbox(nsIFile *mailFile, const char *pName, nsIMutableArray *pArray, nsIImportService *pImport)
{
nsString displayName;
nsCOMPtr<nsIImportMailboxDescriptor> desc;
@ -458,7 +453,7 @@ nsresult nsEudoraWin32::FoundMailbox(nsIFile *mailFile, const char *pName, nsISu
pFile->InitWithFile(mailFile);
}
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
pArray->AppendElement(pInterface);
pArray->AppendElement(pInterface, false);
pInterface->Release();
}
@ -466,7 +461,7 @@ nsresult nsEudoraWin32::FoundMailbox(nsIFile *mailFile, const char *pName, nsISu
}
nsresult nsEudoraWin32::FoundMailFolder(nsIFile *mailFolder, const char *pName, nsISupportsArray *pArray, nsIImportService *pImport)
nsresult nsEudoraWin32::FoundMailFolder(nsIFile *mailFolder, const char *pName, nsIMutableArray *pArray, nsIImportService *pImport)
{
nsString displayName;
nsCOMPtr<nsIImportMailboxDescriptor> desc;
@ -498,7 +493,7 @@ nsresult nsEudoraWin32::FoundMailFolder(nsIFile *mailFolder, const char *pName,
pFile->InitWithFile(mailFolder);
}
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
pArray->AppendElement(pInterface);
pArray->AppendElement(pInterface, false);
pInterface->Release();
}
@ -1316,7 +1311,7 @@ bool nsEudoraWin32::FindAddressFolder(nsIFile **pFolder)
return FindEudoraLocation(pFolder);
}
nsresult nsEudoraWin32::FindAddressBooks(nsIFile *pRoot, nsISupportsArray **ppArray)
nsresult nsEudoraWin32::FindAddressBooks(nsIFile *pRoot, nsIMutableArray *pArray)
{
nsresult rv;
nsCOMPtr<nsIFile> file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
@ -1324,13 +1319,6 @@ nsresult nsEudoraWin32::FindAddressBooks(nsIFile *pRoot, nsISupportsArray **ppAr
rv = file->InitWithFile(pRoot);
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_NewISupportsArray(ppArray);
if (NS_FAILED(rv))
{
IMPORT_LOG0("FAILED to allocate the nsISupportsArray\n");
return rv;
}
nsCOMPtr<nsIImportService> impSvc(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
@ -1365,7 +1353,7 @@ nsresult nsEudoraWin32::FindAddressBooks(nsIFile *pRoot, nsISupportsArray **ppAr
if (exists && isFile)
{
if (NS_FAILED(rv = FoundAddressBook(file, displayName.get(), *ppArray, impSvc)))
if (NS_FAILED(rv = FoundAddressBook(file, displayName.get(), pArray, impSvc)))
return rv;
}
@ -1382,7 +1370,7 @@ nsresult nsEudoraWin32::FindAddressBooks(nsIFile *pRoot, nsISupportsArray **ppAr
rv = file->IsDirectory(&isDir);
if (exists && isDir)
{
if (NS_FAILED(rv = ScanAddressDir(file, *ppArray, impSvc)))
if (NS_FAILED(rv = ScanAddressDir(file, pArray, impSvc)))
return rv;
}
@ -1440,7 +1428,7 @@ nsresult nsEudoraWin32::FindAddressBooks(nsIFile *pRoot, nsISupportsArray **ppAr
rv = file->IsDirectory(&isDir);
if (exists && isDir)
{
if (NS_FAILED(rv = ScanAddressDir(file, *ppArray, impSvc)))
if (NS_FAILED(rv = ScanAddressDir(file, pArray, impSvc)))
return rv;
}
}
@ -1458,16 +1446,15 @@ nsresult nsEudoraWin32::FindAddressBooks(nsIFile *pRoot, nsISupportsArray **ppAr
rv = file->IsDirectory(&isDir);
if (exists && isDir)
{
if (NS_FAILED(rv = ScanAddressDir(file, *ppArray, impSvc)))
if (NS_FAILED(rv = ScanAddressDir(file, pArray, impSvc)))
return rv;
}
}
return NS_OK;
}
nsresult nsEudoraWin32::ScanAddressDir(nsIFile *pDir, nsISupportsArray *pArray, nsIImportService *impSvc)
nsresult nsEudoraWin32::ScanAddressDir(nsIFile *pDir, nsIMutableArray *pArray, nsIImportService *impSvc)
{
bool hasMore;
nsCOMPtr<nsISimpleEnumerator> directoryEnumerator;
@ -1525,7 +1512,7 @@ nsresult nsEudoraWin32::ScanAddressDir(nsIFile *pDir, nsISupportsArray *pArray,
}
nsresult nsEudoraWin32::FoundAddressBook(nsIFile *file, const PRUnichar *pName, nsISupportsArray *pArray, nsIImportService *impSvc)
nsresult nsEudoraWin32::FoundAddressBook(nsIFile *file, const PRUnichar *pName, nsIMutableArray *pArray, nsIImportService *impSvc)
{
nsCOMPtr<nsIImportABDescriptor> desc;
nsISupports * pInterface;
@ -1556,7 +1543,7 @@ nsresult nsEudoraWin32::FoundAddressBook(nsIFile *file, const PRUnichar *pName,
desc->SetSize((uint32_t) sz);
desc->SetAbFile(file);
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
pArray->AppendElement(pInterface);
pArray->AppendElement(pInterface, false);
pInterface->Release();
}
if (NS_FAILED(rv))

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

@ -11,7 +11,6 @@
#include "nscore.h"
#include "nsStringGlue.h"
#include "nsIFile.h"
#include "nsISupportsArray.h"
#include "nsEudoraMailbox.h"
#include "nsEudoraAddress.h"
@ -20,6 +19,7 @@
class nsIImportService;
class nsIMsgAccountManager;
class nsIMsgAccount;
class nsIMutableArray;
class nsEudoraWin32 : public nsEudoraMailbox, public nsEudoraAddress {
@ -30,7 +30,7 @@ public:
// retrieve the mail folder
virtual bool FindMailFolder(nsIFile **pFolder) MOZ_OVERRIDE;
// get the list of mailboxes
virtual nsresult FindMailboxes(nsIFile *pRoot, nsISupportsArray **ppArray) MOZ_OVERRIDE;
virtual nsresult FindMailboxes(nsIFile *pRoot, nsIMutableArray *pArray) MOZ_OVERRIDE;
// get a TOC file from a mailbox file
virtual nsresult FindTOCFile(nsIFile *pMailFile, nsIFile **pTOCFile, bool *pDeleteToc) MOZ_OVERRIDE;
@ -40,7 +40,7 @@ public:
// retrieve the address book folder
virtual bool FindAddressFolder(nsIFile **pFolder) MOZ_OVERRIDE;
// get the list of address books
virtual nsresult FindAddressBooks(nsIFile *pRoot, nsISupportsArray **ppArray) MOZ_OVERRIDE;
virtual nsresult FindAddressBooks(nsIFile *pRoot, nsIMutableArray *pArray) MOZ_OVERRIDE;
// import settings from Win32 ini file
static bool ImportSettings(nsIFile *pIniFile, nsIMsgAccount **localMailAccount);
@ -51,15 +51,15 @@ public:
static bool GetMailboxNameHierarchy(const nsACString& pEudoraLocation, const char* pEudoraFilePath, nsCString& nameHierarchy);
private:
nsresult ScanMailDir(nsIFile *pFolder, nsISupportsArray *pArray, nsIImportService *pImport);
nsresult IterateMailDir(nsIFile *pFolder, nsISupportsArray *pArray, nsIImportService *pImport);
nsresult ScanDescmap(nsIFile *pFolder, nsISupportsArray *pArray, nsIImportService *pImport, const char *pData, int32_t len);
nsresult FoundMailFolder(nsIFile *mailFolder, const char *pName, nsISupportsArray *pArray, nsIImportService *pImport);
nsresult FoundMailbox(nsIFile *mailFile, const char *pName, nsISupportsArray *pArray, nsIImportService *pImport);
nsresult ScanMailDir(nsIFile *pFolder, nsIMutableArray *pArray, nsIImportService *pImport);
nsresult IterateMailDir(nsIFile *pFolder, nsIMutableArray *pArray, nsIImportService *pImport);
nsresult ScanDescmap(nsIFile *pFolder, nsIMutableArray *pArray, nsIImportService *pImport, const char *pData, int32_t len);
nsresult FoundMailFolder(nsIFile *mailFolder, const char *pName, nsIMutableArray *pArray, nsIImportService *pImport);
nsresult FoundMailbox(nsIFile *mailFile, const char *pName, nsIMutableArray *pArray, nsIImportService *pImport);
bool FindMimeIniFile(nsIFile *pFile);
void GetMimeTypeFromExtension(nsCString& ext, nsCString& mimeType);
nsresult FoundAddressBook(nsIFile *file, const PRUnichar *pName, nsISupportsArray *pArray, nsIImportService *impSvc);
nsresult ScanAddressDir(nsIFile *pDir, nsISupportsArray *pArray, nsIImportService *impSvc);
nsresult FoundAddressBook(nsIFile *file, const PRUnichar *pName, nsIMutableArray *pArray, nsIImportService *impSvc);
nsresult ScanAddressDir(nsIFile *pDir, nsIMutableArray *pArray, nsIImportService *impSvc);
static bool FindEudoraLocation(nsIFile **pFolder, bool findIni = false);

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

@ -30,6 +30,7 @@
#include "nsIImportAddressBooks.h"
#include "nsIImportABDescriptor.h"
#include "nsIImportFieldMap.h"
#include "nsIMutableArray.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "WabObject.h"
@ -66,8 +67,8 @@ public:
/* void GetDefaultLocation (out nsIFile location, out boolean found, out boolean userVerify); */
NS_IMETHOD GetDefaultLocation(nsIFile **location, bool *found, bool *userVerify);
/* nsISupportsArray FindMailboxes (in nsIFile location); */
NS_IMETHOD FindMailboxes(nsIFile *location, nsISupportsArray **_retval);
/* nsIArray FindMailboxes (in nsIFile location); */
NS_IMETHOD FindMailboxes(nsIFile *location, nsIArray **_retval);
NS_IMETHOD ImportMailbox(nsIImportMailboxDescriptor *source,
nsIMsgFolder *dstFolder,
@ -111,7 +112,7 @@ public:
NS_IMETHOD GetDefaultLocation(nsIFile **location, bool *found, bool *userVerify);
NS_IMETHOD FindAddressBooks(nsIFile *location, nsISupportsArray **_retval);
NS_IMETHOD FindAddressBooks(nsIFile *location, nsIArray **_retval);
NS_IMETHOD InitFieldMap(nsIImportFieldMap *fieldMap)
{ return NS_ERROR_FAILURE; }
@ -327,7 +328,7 @@ NS_IMETHODIMP ImportOEMailImpl::GetDefaultLocation(nsIFile **ppLoc, bool *found,
}
NS_IMETHODIMP ImportOEMailImpl::FindMailboxes(nsIFile *pLoc, nsISupportsArray **ppArray)
NS_IMETHODIMP ImportOEMailImpl::FindMailboxes(nsIFile *pLoc, nsIArray **ppArray)
{
NS_PRECONDITION(pLoc != nullptr, "null ptr");
NS_PRECONDITION(ppArray != nullptr, "null ptr");
@ -521,13 +522,14 @@ NS_IMETHODIMP ImportOEAddressImpl::GetAutoFind(PRUnichar **description, bool *_r
NS_IMETHODIMP ImportOEAddressImpl::FindAddressBooks(nsIFile *location, nsISupportsArray **_retval)
NS_IMETHODIMP ImportOEAddressImpl::FindAddressBooks(nsIFile *location, nsIArray **_retval)
{
NS_PRECONDITION(_retval != nullptr, "null ptr");
if (!_retval)
return NS_ERROR_NULL_POINTER;
nsresult rv = NS_NewISupportsArray(_retval);
nsresult rv;
nsCOMPtr<nsIMutableArray> array(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
@ -567,7 +569,7 @@ NS_IMETHODIMP ImportOEAddressImpl::FindAddressBooks(nsIFile *location, nsISuppor
pID->SetSize(100);
pID->SetPreferredName(str);
rv = pID->QueryInterface(kISupportsIID, (void **) &pInterface);
(*_retval)->AppendElement(pInterface);
array->AppendElement(pInterface, false);
pInterface->Release();
pID->Release();
}
@ -578,6 +580,7 @@ NS_IMETHODIMP ImportOEAddressImpl::FindAddressBooks(nsIFile *location, nsISuppor
delete m_pWab;
m_pWab = nullptr;
}
array.forget(_retval);
return NS_OK;
}

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

@ -133,7 +133,7 @@ bool nsOEScanBoxes::FindMail(nsIFile *pWhere)
return isDir;
}
bool nsOEScanBoxes::GetMailboxes(nsIFile *pWhere, nsISupportsArray **pArray)
bool nsOEScanBoxes::GetMailboxes(nsIFile *pWhere, nsIArray **pArray)
{
nsCString path;
pWhere->GetNativePath(path);
@ -680,20 +680,22 @@ uint32_t nsOEScanBoxes::CountMailboxes(MailboxEntry *pBox)
return count;
}
bool nsOEScanBoxes::GetMailboxList(nsIFile * root, nsISupportsArray **pArray)
bool nsOEScanBoxes::GetMailboxList(nsIFile * root, nsIArray **pArray)
{
nsresult rv = NS_NewISupportsArray(pArray);
nsresult rv;
nsCOMPtr<nsIMutableArray> array(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
if (NS_FAILED(rv)) {
IMPORT_LOG0("FAILED to allocate the nsISupportsArray\n");
IMPORT_LOG0("FAILED to allocate the nsIArray\n");
return false;
}
BuildMailboxList(nullptr, root, 1, *pArray);
BuildMailboxList(nullptr, root, 1, array);
array.forget(pArray);
return true;
}
void nsOEScanBoxes::BuildMailboxList(MailboxEntry *pBox, nsIFile * root, int32_t depth, nsISupportsArray *pArray)
void nsOEScanBoxes::BuildMailboxList(MailboxEntry *pBox, nsIFile * root, int32_t depth, nsIMutableArray *pArray)
{
if (pBox == nullptr) {
if (m_pFirst != nullptr) {
@ -740,7 +742,7 @@ void nsOEScanBoxes::BuildMailboxList(MailboxEntry *pBox, nsIFile * root, int32_t
pID->SetSize(size);
}
rv = pID->QueryInterface(kISupportsIID, (void **) &pInterface);
pArray->AppendElement(pInterface);
pArray->AppendElement(pInterface, false);
pInterface->Release();
pID->Release();
}

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

@ -9,7 +9,8 @@
#include "nsStringGlue.h"
#include "nsIImportModule.h"
#include "nsVoidArray.h"
#include "nsISupportsArray.h"
#include "nsIArray.h"
#include "nsIMutableArray.h"
#include "nsIFile.h"
#include "nsIImportService.h"
@ -22,7 +23,7 @@ public:
static bool FindMail(nsIFile *pWhere);
bool GetMailboxes(nsIFile *pWhere, nsISupportsArray **pArray);
bool GetMailboxes(nsIFile *pWhere, nsIArray **pArray);
private:
@ -60,8 +61,8 @@ private:
bool ReadString(nsIInputStream * stream, nsCString& str, uint32_t offset);
uint32_t CountMailboxes(MailboxEntry *pBox);
void BuildMailboxList(MailboxEntry *pBox, nsIFile * root, int32_t depth, nsISupportsArray *pArray);
bool GetMailboxList(nsIFile * root, nsISupportsArray **pArray);
void BuildMailboxList(MailboxEntry *pBox, nsIFile * root, int32_t depth, nsIMutableArray *pArray);
bool GetMailboxList(nsIFile * root, nsIArray **pArray);
private:
MailboxEntry * m_pFirst;

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

@ -25,6 +25,7 @@
#include "nsIMsgCompFields.h"
#include "nsIMsgAccountManager.h"
#include "nsIMsgSend.h"
#include "nsIMutableArray.h"
#include "nsImportEmbeddedImageData.h"
#include "nsNetCID.h"
#include "nsCRT.h"
@ -294,7 +295,7 @@ nsresult nsOutlookCompose::ComposeTheMessage(nsMsgDeliverMode mode, CMapiMessage
bodyW = msg.GetBody();
// End Bug 593907
nsCOMPtr<nsISupportsArray> embeddedObjects;
nsCOMPtr<nsIMutableArray> embeddedObjects;
if (msg.BodyIsHtml()) {
for (unsigned int i = 0; i <msg.EmbeddedAttachmentsCount(); i++) {
@ -303,13 +304,13 @@ nsresult nsOutlookCompose::ComposeTheMessage(nsMsgDeliverMode mode, CMapiMessage
const char* name;
if (msg.GetEmbeddedAttachmentInfo(i, &uri, &cid, &name)) {
if (!embeddedObjects) {
embeddedObjects = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
embeddedObjects = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
}
nsCOMPtr<nsIMsgEmbeddedImageData> imageData =
new nsImportEmbeddedImageData(uri, nsDependentCString(cid),
nsDependentCString(name));
embeddedObjects->AppendElement(imageData);
embeddedObjects->AppendElement(imageData, false);
}
}
}

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

@ -60,8 +60,8 @@ public:
/* void GetDefaultLocation (out nsIFile location, out boolean found, out boolean userVerify); */
NS_IMETHOD GetDefaultLocation(nsIFile **location, bool *found, bool *userVerify);
/* nsISupportsArray FindMailboxes (in nsIFile location); */
NS_IMETHOD FindMailboxes(nsIFile *location, nsISupportsArray **_retval);
/* nsIArray FindMailboxes (in nsIFile location); */
NS_IMETHOD FindMailboxes(nsIFile *location, nsIArray **_retval);
NS_IMETHOD ImportMailbox(nsIImportMailboxDescriptor *source,
nsIMsgFolder *dstFolder,
@ -107,7 +107,7 @@ public:
NS_IMETHOD GetDefaultLocation(nsIFile **location, bool *found, bool *userVerify)
{ return NS_ERROR_FAILURE;}
NS_IMETHOD FindAddressBooks(nsIFile *location, nsISupportsArray **_retval);
NS_IMETHOD FindAddressBooks(nsIFile *location, nsIArray **_retval);
NS_IMETHOD InitFieldMap(nsIImportFieldMap *fieldMap)
{ return NS_ERROR_FAILURE; }
@ -338,7 +338,7 @@ NS_IMETHODIMP ImportOutlookMailImpl::GetDefaultLocation(nsIFile **ppLoc, bool *f
}
NS_IMETHODIMP ImportOutlookMailImpl::FindMailboxes(nsIFile *pLoc, nsISupportsArray **ppArray)
NS_IMETHODIMP ImportOutlookMailImpl::FindMailboxes(nsIFile *pLoc, nsIArray **ppArray)
{
NS_PRECONDITION(pLoc != nullptr, "null ptr");
NS_PRECONDITION(ppArray != nullptr, "null ptr");
@ -501,7 +501,7 @@ NS_IMETHODIMP ImportOutlookAddressImpl::GetAutoFind(PRUnichar **description, boo
return NS_OK;
}
NS_IMETHODIMP ImportOutlookAddressImpl::FindAddressBooks(nsIFile *location, nsISupportsArray **_retval)
NS_IMETHODIMP ImportOutlookAddressImpl::FindAddressBooks(nsIFile *location, nsIArray **_retval)
{
NS_PRECONDITION(_retval != nullptr, "null ptr");
if (!_retval)

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

@ -15,6 +15,7 @@
#include "nsIImportFieldMap.h"
#include "nsIImportMailboxDescriptor.h"
#include "nsIImportABDescriptor.h"
#include "nsIMutableArray.h"
#include "nsOutlookStringBundle.h"
#include "nsABBaseCID.h"
#include "nsIAbCard.h"
@ -108,16 +109,17 @@ nsOutlookMail::~nsOutlookMail()
// EmptyAttachments();
}
nsresult nsOutlookMail::GetMailFolders(nsISupportsArray **pArray)
nsresult nsOutlookMail::GetMailFolders(nsIArray **pArray)
{
if (!m_haveMapi) {
IMPORT_LOG0("GetMailFolders called before Mapi is initialized\n");
return NS_ERROR_FAILURE;
}
nsresult rv = NS_NewISupportsArray(pArray);
nsresult rv;
nsCOMPtr<nsIMutableArray> array(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
if (NS_FAILED(rv)) {
IMPORT_LOG0("FAILED to allocate the nsISupportsArray for the mail folder list\n");
IMPORT_LOG0("FAILED to allocate the nsIMutableArray for the mail folder list\n");
return rv;
}
@ -174,12 +176,12 @@ nsresult nsOutlookMail::GetMailFolders(nsISupportsArray **pArray)
pID->SetSize(1000);
rv = pID->QueryInterface(kISupportsIID, (void **) &pInterface);
(*pArray)->AppendElement(pInterface);
array->AppendElement(pInterface, false);
pInterface->Release();
pID->Release();
}
}
array.forget(pArray);
return NS_OK;
}
@ -212,16 +214,17 @@ void nsOutlookMail::MakeAddressBookNameUnique(nsString& name, nsString& list)
list.AppendLiteral("],");
}
nsresult nsOutlookMail::GetAddressBooks(nsISupportsArray **pArray)
nsresult nsOutlookMail::GetAddressBooks(nsIArray **pArray)
{
if (!m_haveMapi) {
IMPORT_LOG0("GetAddressBooks called before Mapi is initialized\n");
return NS_ERROR_FAILURE;
}
nsresult rv = NS_NewISupportsArray(pArray);
nsresult rv;
nsCOMPtr<nsIMutableArray> array(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
if (NS_FAILED(rv)) {
IMPORT_LOG0("FAILED to allocate the nsISupportsArray for the address book list\n");
IMPORT_LOG0("FAILED to allocate the nsIMutableArray for the address book list\n");
return rv;
}
@ -275,13 +278,13 @@ nsresult nsOutlookMail::GetAddressBooks(nsISupportsArray **pArray)
pID->SetPreferredName(name);
pID->SetSize(100);
rv = pID->QueryInterface(kISupportsIID, (void **) &pInterface);
(*pArray)->AppendElement(pInterface);
array->AppendElement(pInterface, false);
pInterface->Release();
pID->Release();
}
}
}
array.forget(pArray);
return NS_OK;
}

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

@ -6,7 +6,7 @@
#ifndef nsOutlookMail_h___
#define nsOutlookMail_h___
#include "nsISupportsArray.h"
#include "nsIArray.h"
#include "nsStringGlue.h"
#include "nsOutlookCompose.h"
#include "nsIFile.h"
@ -22,8 +22,8 @@ public:
nsOutlookMail();
~nsOutlookMail();
nsresult GetMailFolders(nsISupportsArray **pArray);
nsresult GetAddressBooks(nsISupportsArray **pArray);
nsresult GetMailFolders(nsIArray **pArray);
nsresult GetAddressBooks(nsIArray **pArray);
nsresult ImportMailbox(uint32_t *pDoneSoFar, bool *pAbort, int32_t index,
const PRUnichar *pName, nsIMsgFolder *pDest,
int32_t *pMsgCount);

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

@ -35,13 +35,13 @@
#include "nsISupports.idl"
interface nsIFile;
interface nsISupportsArray;
interface nsIArray;
interface nsIImportABDescriptor;
interface nsIOutputStream;
interface nsIAddrDatabase;
interface nsIImportFieldMap;
[scriptable, uuid(d64a87ba-f87b-6378-5ed1-4025a7474334)]
[scriptable, uuid(6bba48be-331c-41e3-bc9f-c2ea3754d977)]
interface nsIImportAddressBooks : nsISupports
{
@ -80,11 +80,11 @@ interface nsIImportAddressBooks : nsISupports
out boolean found,
out boolean userVerify);
/*
Returns an nsISupportsArray which contains an nsIImportABDescriptor for each
Returns an nsIArray which contains an nsIImportABDescriptor for each
address book. The array is not sorted before display to the user.
location is null if GetAutoFind returned true.
*/
nsISupportsArray FindAddressBooks( in nsIFile location);
nsIArray FindAddressBooks(in nsIFile location);
/*
Fill in defaults (if any) for a field map for importing address

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

@ -13,17 +13,17 @@
interface nsISupportsString;
[scriptable, uuid(d64a87b8-aeb4-da40-fe28-57df1e50c64f)]
[scriptable, uuid(469d7d5f-144c-4f07-9661-e49e40156348)]
interface nsIImportGeneric : nsISupports
{
/* Use these to prepare for the import */
/*
"mailInterface" - nsIImportMail interface
"mailBoxes" - nsISupportsArray of nsIImportMailboxDescriptors
"mailBoxes" - nsIArray of nsIImportMailboxDescriptors
"mailLocation" - nsIFile, source location for mail
"addressInterface" - nsIImportAddressBooks interface
"addressBooks" - nsISupportsArray of nsIImportABDescriptors
"addressBooks" - nsIArray of nsIImportABDescriptors
"addressLocation" - src location of address books (if needed!)
"addressDestination" - uri of destination address book or null if
new address books will be created.

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

@ -36,12 +36,12 @@
#include "nsISupports.idl"
interface nsIFile;
interface nsISupportsArray;
interface nsIArray;
interface nsIImportMailboxDescriptor;
interface nsIOutputStream;
interface nsIMsgFolder;
[scriptable, uuid(306561d3-ed2f-425d-87ee-eb129a84a6af)]
[scriptable, uuid(a14a3308-0849-420b-86d3-13a2948b5504)]
interface nsIImportMail : nsISupports
{
@ -55,10 +55,10 @@ interface nsIImportMail : nsISupports
out boolean found,
out boolean userVerify);
/*
Returns an nsISupportsArray which contains an nsIImportMailboxID for each
Returns an nsIArray which contains an nsIImportMailboxID for each
mailbox. The array is not sorted before display to the user.
*/
nsISupportsArray FindMailboxes( in nsIFile location);
nsIArray FindMailboxes(in nsIFile location);
/*
Import a specific mailbox into the destination folder supplied. If an error

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

@ -22,9 +22,9 @@ interface nsIMsgSendListener;
interface nsIArray;
interface nsIMsgIdentity;
interface nsIMsgCompFields;
interface nsISupportsArray;
interface nsIArray;
[scriptable, uuid(16359964-66e3-4412-84f8-2a8d58be8be0)]
[scriptable, uuid(d0ed4c50-5997-49c9-8a6a-045f0680ed29)]
interface nsIImportService : nsISupports
{
void DiscoverModules();
@ -47,7 +47,7 @@ interface nsIImportService : nsISupports
in ACString aBody,
in boolean aCreateAsDraft,
in nsIArray aLoadedAttachments,
in nsISupportsArray aEmbeddedObjects,
in nsIArray aEmbeddedObjects,
in nsIMsgSendListener aListener);
};

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

@ -27,8 +27,9 @@
#include "ImportDebug.h"
#include "nsIAbMDBDirectory.h"
#include "nsComponentManagerUtils.h"
#include "nsISupportsArray.h"
#include "nsIArray.h"
#include "nsCOMArray.h"
#include "nsArrayUtils.h"
static void ImportAddressThread(void *stuff);
@ -72,7 +73,7 @@ public:
private:
nsIImportAddressBooks * m_pInterface;
nsISupportsArray *m_pBooks;
nsCOMPtr<nsIArray> m_Books;
nsCOMArray<nsIAddrDatabase> m_DBs;
nsCOMPtr <nsIFile> m_pLocation;
nsIImportFieldMap * m_pFieldMap;
@ -98,7 +99,7 @@ public:
bool fatalError;
uint32_t currentTotal;
uint32_t currentSize;
nsISupportsArray * books;
nsIArray *books;
nsCOMArray<nsIAddrDatabase>* dBs;
nsCOMPtr<nsIAbLDIFService> ldifService;
nsIImportAddressBooks * addressImport;
@ -134,7 +135,6 @@ nsresult NS_NewGenericAddressBooks(nsIImportGeneric** aImportGeneric)
nsImportGenericAddressBooks::nsImportGenericAddressBooks()
{
m_pInterface = nullptr;
m_pBooks = nullptr;
m_pSuccessLog = nullptr;
m_pErrorLog = nullptr;
m_totalSize = 0;
@ -163,7 +163,6 @@ nsImportGenericAddressBooks::~nsImportGenericAddressBooks()
NS_IF_RELEASE(m_pFieldMap);
NS_IF_RELEASE(m_pInterface);
NS_IF_RELEASE(m_pBooks);
NS_IF_RELEASE(m_pSuccessLog);
NS_IF_RELEASE(m_pErrorLog);
}
@ -195,10 +194,9 @@ NS_IMETHODIMP nsImportGenericAddressBooks::GetData(const char *dataId, nsISuppor
if (!PL_strcasecmp(dataId, "addressBooks")) {
if (!m_pLocation)
GetDefaultLocation();
if (!m_pBooks)
if (!m_Books)
GetDefaultBooks();
*_retval = m_pBooks;
NS_IF_ADDREF(m_pBooks);
*_retval = m_Books;
}
if (!PL_strcasecmp(dataId, "addressDestination")) {
@ -274,9 +272,8 @@ NS_IMETHODIMP nsImportGenericAddressBooks::SetData(const char *dataId, nsISuppor
item->QueryInterface(NS_GET_IID(nsIImportAddressBooks), (void **) &m_pInterface);
}
if (!PL_strcasecmp(dataId, "addressBooks")) {
NS_IF_RELEASE(m_pBooks);
if (item)
item->QueryInterface(NS_GET_IID(nsISupportsArray), (void **) &m_pBooks);
item->QueryInterface(NS_GET_IID(nsIArray), (void **) &m_Books);
}
if (!PL_strcasecmp(dataId, "addressLocation")) {
@ -384,13 +381,13 @@ void nsImportGenericAddressBooks::GetDefaultLocation(void)
void nsImportGenericAddressBooks::GetDefaultBooks(void)
{
if (!m_pInterface || m_pBooks)
if (!m_pInterface || m_Books)
return;
if (!m_pLocation && !m_autoFind)
return;
nsresult rv = m_pInterface->FindAddressBooks(m_pLocation, &m_pBooks);
nsresult rv = m_pInterface->FindAddressBooks(m_pLocation, getter_AddRefs(m_Books));
if (NS_FAILED(rv)) {
IMPORT_LOG0("*** Error: FindAddressBooks failed\n");
}
@ -437,17 +434,17 @@ NS_IMETHODIMP nsImportGenericAddressBooks::WantsProgress(bool *_retval)
bool result = false;
if (m_pBooks) {
if (m_Books) {
uint32_t count = 0;
uint32_t i;
bool import;
uint32_t size;
uint32_t totalSize = 0;
(void) m_pBooks->Count(&count);
m_Books->GetLength(&count);
for (i = 0; i < count; i++) {
nsCOMPtr<nsIImportABDescriptor> book = do_QueryElementAt(m_pBooks, i);
nsCOMPtr<nsIImportABDescriptor> book = do_QueryElementAt(m_Books, i);
if (book) {
import = false;
size = 0;
@ -609,7 +606,7 @@ NS_IMETHODIMP nsImportGenericAddressBooks::BeginImport(nsISupportsString *succes
return NS_OK;
}
if (!m_pInterface || !m_pBooks) {
if (!m_pInterface || !m_Books) {
nsImportStringBundle::GetStringByID(IMPORT_ERROR_AB_NOTINITIALIZED,
m_stringBundle, error);
SetLogs(success, error, successLog, errorLog);
@ -640,8 +637,8 @@ NS_IMETHODIMP nsImportGenericAddressBooks::BeginImport(nsISupportsString *succes
// not going to create a new thread for this since address books
// don't tend to be large, and import is rare.
m_pThreadData = new AddressThreadData();
m_pThreadData->books = m_pBooks;
NS_ADDREF(m_pBooks);
m_pThreadData->books = m_Books;
NS_ADDREF(m_Books);
m_pThreadData->addressImport = m_pInterface;
NS_ADDREF(m_pInterface);
m_pThreadData->fieldMap = m_pFieldMap;
@ -654,14 +651,14 @@ NS_IMETHODIMP nsImportGenericAddressBooks::BeginImport(nsISupportsString *succes
m_pThreadData->pDestinationUri = strdup(m_pDestinationUri);
uint32_t count = 0;
m_pBooks->Count(&count);
m_Books->GetLength(&count);
// Create/obtain any address books that we need here, so that we don't need
// to do so inside the import thread which would just proxy the create
// operations back to the main thread anyway.
nsCOMPtr<nsIAddrDatabase> db = GetAddressBookFromUri(m_pDestinationUri);
for (uint32_t i = 0; i < count; ++i)
{
nsCOMPtr<nsIImportABDescriptor> book = do_QueryElementAt(m_pBooks, i);
nsCOMPtr<nsIImportABDescriptor> book = do_QueryElementAt(m_Books, i);
if (book)
{
if (!db)
@ -811,7 +808,7 @@ static void ImportAddressThread(void *stuff)
nsString success;
nsString error;
(void) pData->books->Count(&count);
(void) pData->books->GetLength(&count);
for (i = 0; (i < count) && !(pData->abort); i++) {
nsCOMPtr<nsIImportABDescriptor> book =

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

@ -15,7 +15,8 @@
#include "prprf.h"
#include "nscore.h"
#include "nsCOMPtr.h"
#include "nsISupportsArray.h"
#include "nsIArray.h"
#include "nsArrayUtils.h"
#include "nsIImportMail.h"
#include "nsIImportGeneric.h"
@ -96,8 +97,8 @@ private:
bool m_gotLocation;
bool m_found;
bool m_userVerify;
nsIImportMail * m_pInterface;
nsISupportsArray * m_pMailboxes;
nsIImportMail *m_pInterface;
nsIArray * m_pMailboxes;
nsISupportsString *m_pSuccessLog;
nsISupportsString *m_pErrorLog;
uint32_t m_totalSize;
@ -117,7 +118,7 @@ public:
uint32_t currentSize;
nsIMsgFolder * destRoot;
bool ownsDestRoot;
nsISupportsArray * boxes;
nsIArray *boxes;
nsIImportMail * mailImport;
nsISupportsString * successLog;
nsISupportsString * errorLog;
@ -282,7 +283,7 @@ NS_IMETHODIMP nsImportGenericMail::SetData(const char *dataId, nsISupports *item
if (!PL_strcasecmp(dataId, "mailBoxes")) {
NS_IF_RELEASE(m_pMailboxes);
if (item)
item->QueryInterface(NS_GET_IID(nsISupportsArray), (void **) &m_pMailboxes);
item->QueryInterface(NS_GET_IID(nsIArray), (void **) &m_pMailboxes);
}
if (!PL_strcasecmp(dataId, "mailLocation")) {
@ -415,7 +416,7 @@ NS_IMETHODIMP nsImportGenericMail::WantsProgress(bool *_retval)
uint32_t size;
uint32_t totalSize = 0;
(void) m_pMailboxes->Count(&count);
(void) m_pMailboxes->GetLength(&count);
for (i = 0; i < count; i++) {
nsCOMPtr<nsIImportMailboxDescriptor> box =
do_QueryElementAt(m_pMailboxes, i);
@ -714,7 +715,7 @@ ImportMailThread(void *stuff)
nsCOMPtr<nsIMsgFolder> destRoot(pData->destRoot);
uint32_t count = 0;
rv = pData->boxes->Count(&count);
rv = pData->boxes->GetLength(&count);
uint32_t i;
bool import;

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

@ -37,6 +37,7 @@
#include "nsServiceManagerUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsIMutableArray.h"
#include "nsIArray.h"
#include "nsISupportsArray.h"
#include "nsIMsgSend.h"
@ -295,7 +296,7 @@ public:
const nsACString &attachment1_body,
bool aIsDraft,
nsIArray *aLoadedAttachments,
nsISupportsArray *aEmbeddedAttachments,
nsIArray *aEmbeddedAttachments,
nsIMsgSendListener *aListener);
NS_DECL_NSIRUNNABLE
private:
@ -305,7 +306,7 @@ private:
nsCString m_bodyType;
nsCString m_body;
nsCOMPtr<nsIArray> m_loadedAttachments;
nsCOMPtr<nsISupportsArray> m_embeddedAttachments;
nsCOMPtr<nsIArray> m_embeddedAttachments;
nsCOMPtr<nsIMsgSendListener> m_listener;
};
@ -316,7 +317,7 @@ nsProxySendRunnable::nsProxySendRunnable(nsIMsgIdentity *aIdentity,
const nsACString &aBody,
bool aIsDraft,
nsIArray *aLoadedAttachments,
nsISupportsArray *aEmbeddedAttachments,
nsIArray *aEmbeddedAttachments,
nsIMsgSendListener *aListener) :
m_identity(aIdentity), m_compFields(aMsgFields),
m_isDraft(aIsDraft), m_bodyType(aBodyType),
@ -332,10 +333,23 @@ NS_IMETHODIMP nsProxySendRunnable::Run()
nsCOMPtr<nsIMsgSend> msgSend = do_CreateInstance(NS_MSGSEND_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISupportsArray> supportsArray;
NS_NewISupportsArray(getter_AddRefs(supportsArray));
nsCOMPtr<nsISimpleEnumerator> enumerator;
m_embeddedAttachments->Enumerate(getter_AddRefs(enumerator));
bool hasMore;
while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore) {
nsCOMPtr<nsISupports> item;
enumerator->GetNext(getter_AddRefs(item));
supportsArray->AppendElement(item);
}
return msgSend->CreateRFC822Message(m_identity, m_compFields,
m_bodyType.get(), m_body,
m_isDraft, m_loadedAttachments,
m_embeddedAttachments,
supportsArray,
m_listener);
}
@ -347,7 +361,7 @@ nsImportService::CreateRFC822Message(nsIMsgIdentity *aIdentity,
const nsACString &aBody,
bool aIsDraft,
nsIArray *aLoadedAttachments,
nsISupportsArray *aEmbeddedAttachments,
nsIArray *aEmbeddedAttachments,
nsIMsgSendListener *aListener)
{
nsRefPtr<nsProxySendRunnable> runnable =

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

@ -63,7 +63,7 @@ TestMailImpoter.prototype = {
let descriptor = this._createMailboxDescriptor(directory.path,
directory.leafName,
depth);
result.AppendElement(descriptor);
result.AppendElement(descriptor, false);
let entries = directory.directoryEntries;
while (entries.hasMoreElements()) {
let entry = entries.getNext().QueryInterface(Ci.nsIFile);
@ -75,7 +75,7 @@ TestMailImpoter.prototype = {
FindMailboxes: function(location) {
let result;
result = Cc["@mozilla.org/supports-array;1"]
.createInstance(Ci.nsISupportsArray);
.createInstance(Ci.nsIArray);
this._collectMailboxesInDirectory(location, 0, result);
return result;

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

@ -23,6 +23,7 @@
#include "nsIComponentManager.h"
#include "nsTextImport.h"
#include "nsIMemory.h"
#include "nsIMutableArray.h"
#include "nsIImportGeneric.h"
#include "nsIImportAddressBooks.h"
#include "nsIImportABDescriptor.h"
@ -73,7 +74,7 @@ public:
NS_IMETHOD GetDefaultLocation(nsIFile **location, bool *found, bool *userVerify);
NS_IMETHOD FindAddressBooks(nsIFile *location, nsISupportsArray **_retval);
NS_IMETHOD FindAddressBooks(nsIFile *location, nsIArray **_retval);
NS_IMETHOD InitFieldMap(nsIImportFieldMap *fieldMap);
@ -256,7 +257,7 @@ NS_IMETHODIMP ImportAddressImpl::GetDefaultLocation(nsIFile **ppLoc, bool *found
NS_IMETHODIMP ImportAddressImpl::FindAddressBooks(nsIFile *pLoc, nsISupportsArray **ppArray)
NS_IMETHODIMP ImportAddressImpl::FindAddressBooks(nsIFile *pLoc, nsIArray **ppArray)
{
NS_PRECONDITION(pLoc != nullptr, "null ptr");
NS_PRECONDITION(ppArray != nullptr, "null ptr");
@ -288,10 +289,9 @@ NS_IMETHODIMP ImportAddressImpl::FindAddressBooks(nsIFile *pLoc, nsISupportsArra
m_fileLoc = do_QueryInterface(pLoc);
/* Build an address book descriptor based on the file passed in! */
nsCOMPtr<nsISupportsArray> array;
rv = NS_NewISupportsArray(getter_AddRefs(array));
nsCOMPtr<nsIMutableArray> array(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
if (NS_FAILED(rv)) {
IMPORT_LOG0("FAILED to allocate the nsISupportsArray\n");
IMPORT_LOG0("FAILED to allocate the nsIMutableArray\n");
return rv;
}
@ -324,17 +324,15 @@ NS_IMETHODIMP ImportAddressImpl::FindAddressBooks(nsIFile *pLoc, nsISupportsArra
desc->SetSize((uint32_t) sz);
desc->SetAbFile(m_fileLoc);
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
array->AppendElement(pInterface);
array->AppendElement(pInterface, false);
pInterface->Release();
}
if (NS_FAILED(rv)) {
IMPORT_LOG0("*** Error creating address book descriptor for text import\n");
return rv;
}
else {
rv = array->QueryInterface(NS_GET_IID(nsISupportsArray), (void **) ppArray);
}
return rv;
array.forget(ppArray);
return NS_OK;
}
void ImportAddressImpl::ReportSuccess(nsString& name, nsString *pStream,

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

@ -17,6 +17,7 @@
#include "nsIImportAddressBooks.h"
#include "nsIImportFieldMap.h"
#include "nsIImportGeneric.h"
#include "nsIMutableArray.h"
#include "nsCOMPtr.h"
#include "nsIImportService.h"
#include "nsIFile.h"
@ -58,7 +59,7 @@ public:
NS_IMETHOD GetDefaultLocation(
nsIFile **location, bool *found, bool *userVerify);
NS_IMETHOD FindAddressBooks(nsIFile *location, nsISupportsArray **_retval);
NS_IMETHOD FindAddressBooks(nsIFile *location, nsIArray **_retval);
NS_IMETHOD InitFieldMap(nsIImportFieldMap *fieldMap)
{ return NS_ERROR_FAILURE;}
@ -227,7 +228,7 @@ NS_IMETHODIMP ImportVCardAddressImpl::GetDefaultLocation(
}
NS_IMETHODIMP ImportVCardAddressImpl::FindAddressBooks(
nsIFile *pLoc, nsISupportsArray **ppArray)
nsIFile *pLoc, nsIArray **ppArray)
{
NS_ENSURE_ARG_POINTER(pLoc);
NS_ENSURE_ARG_POINTER(ppArray);
@ -246,10 +247,9 @@ NS_IMETHODIMP ImportVCardAddressImpl::FindAddressBooks(
m_fileLoc = do_QueryInterface(pLoc);
/* Build an address book descriptor based on the file passed in! */
nsCOMPtr<nsISupportsArray> array;
rv = NS_NewISupportsArray(getter_AddRefs(array));
nsCOMPtr<nsIMutableArray> array(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
if (NS_FAILED(rv)) {
IMPORT_LOG0("FAILED to allocate the nsISupportsArray\n");
IMPORT_LOG0("FAILED to allocate the nsIMutableArray\n");
return rv;
}
@ -281,16 +281,16 @@ NS_IMETHODIMP ImportVCardAddressImpl::FindAddressBooks(
desc->SetSize((uint32_t) sz);
desc->SetAbFile(m_fileLoc);
nsCOMPtr<nsISupports> pInterface(do_QueryInterface(desc, &rv));
array->AppendElement(pInterface);
array->AppendElement(pInterface, false);
}
if (NS_FAILED(rv)) {
IMPORT_LOG0(
"*** Error creating address book descriptor for vCard import\n");
} else {
array.swap(*ppArray);
return rv;
}
return rv;
array.forget(ppArray);
return NS_OK;
}
void ImportVCardAddressImpl::ReportSuccess(

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

@ -59,8 +59,8 @@ public:
/* void GetDefaultLocation (out nsIFile location, out boolean found, out boolean userVerify); */
NS_IMETHOD GetDefaultLocation(nsIFile **location, bool *found, bool *userVerify);
/* nsISupportsArray FindMailboxes (in nsIFile location); */
NS_IMETHOD FindMailboxes(nsIFile *location, nsISupportsArray **_retval);
/* nsIArray FindMailboxes (in nsIFile location); */
NS_IMETHOD FindMailboxes(nsIFile *location, nsIArray **_retval);
NS_IMETHOD ImportMailbox(nsIImportMailboxDescriptor *source,
nsIMsgFolder *dstFolder,
@ -192,7 +192,7 @@ NS_IMETHODIMP ImportWMMailImpl::GetDefaultLocation(nsIFile **ppLoc, bool *found,
}
NS_IMETHODIMP ImportWMMailImpl::FindMailboxes(nsIFile *pLoc,
nsISupportsArray **ppArray)
nsIArray **ppArray)
{
return NS_ERROR_NOT_IMPLEMENTED;
}