--- a/mailnews/import/applemail/src/nsAppleMailImport.cpp
+++ b/mailnews/import/applemail/src/nsAppleMailImport.cpp
@@ -14,16 +14,17 @@
#include "nsIImportService.h"
#include "nsIImportMailboxDescriptor.h"
#include "nsIImportGeneric.h"
#include "nsIFile.h"
#include "nsIStringBundle.h"
#include "nsIMsgFolder.h"
#include "nsIMsgHdr.h"
#include "nsIMsgPluggableStore.h"
+#include "nsIMutableArray.h"
#include "nsNetUtil.h"
#include "nsMsgUtils.h"
#include "mozilla/Services.h"
#include "nsEmlxHelperUtils.h"
#include "nsAppleMailImport.h"
PRLogModuleInfo *APPLEMAILLOGMODULE = nullptr;
@@ -175,33 +176,32 @@ NS_IMETHODIMP nsAppleMailImportMail::Get
}
}
return NS_OK;
}
// 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);
IMPORT_LOG0("FindMailboxes for Apple mail invoked");
bool exists = false;
nsresult rv = aMailboxFile->Exists(&exists);
if (NS_FAILED(rv) || !exists)
return NS_ERROR_FAILURE;
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;
mCurDepth = 1;
// 1. look for accounts with mailboxes
FindAccountMailDirs(aMailboxFile, resultsArray, importService);
mCurDepth--;
@@ -219,24 +219,24 @@ NS_IMETHODIMP nsAppleMailImportMail::Fin
mCurDepth++;
rv = FindMboxDirs(mailboxesDir, resultsArray, importService);
mCurDepth--;
}
}
}
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));
if (NS_FAILED(rv))
return;
bool hasMore = false;
while (NS_SUCCEEDED(directoryEnumerator->HasMoreElements(&hasMore)) && hasMore) {
@@ -288,29 +288,29 @@ void nsAppleMailImportMail::FindAccountM
nsCOMPtr<nsIFile> mailboxDescFile;
rv = desc->GetFile(getter_AddRefs(mailboxDescFile));
if (!mailboxDescFile)
continue;
mailboxDescFile->InitWithFile(currentEntry);
// add this mailbox descriptor to the list
- aMailboxDescs->AppendElement(desc);
+ aMailboxDescs->AppendElement(desc, false);
// now add all the children mailboxes
mCurDepth++;
FindMboxDirs(currentEntry, aMailboxDescs, aImportService);
mCurDepth--;
}
}
}
}
// 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);
// cut off the suffix, if any, or prefix if this is an account folder.
if (StringEndsWith(folderName, NS_LITERAL_STRING(POP_MBOX_SUFFIX)))
folderName.SetLength(folderName.Length()-5);
else if (StringEndsWith(folderName, NS_LITERAL_STRING(IMAP_MBOX_SUFFIX)))
@@ -365,33 +365,33 @@ nsresult nsAppleMailImportMail::AddMboxD
nsCOMPtr<nsIFile> mailboxDescFile;
rv = desc->GetFile(getter_AddRefs(mailboxDescFile));
NS_ENSURE_SUCCESS(rv, rv);
if (mailboxDescFile)
mailboxDescFile->InitWithFile(aFolder);
// add this mailbox descriptor to the list
- aMailboxDescs->AppendElement(desc);
+ aMailboxDescs->AppendElement(desc, false);
}
return NS_OK;
}
// Starts looking for .mbox dirs in the specified dir. The .mbox dirs contain messages and can be considered leafs in a tree of
// nested mailboxes (subfolders).
//
// If a mailbox has sub-mailboxes, they are contained in a sibling folder with the same name without the ".mbox" part.
// example:
// MyParentMailbox.mbox/
// MyParentMailbox/
// 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);
NS_ENSURE_ARG_POINTER(aImportService);
// make sure this is a directory.
bool isDir = false;
if (NS_FAILED(aFolder->IsDirectory(&isDir)) || !isDir)
--- a/mailnews/import/applemail/src/nsAppleMailImport.h
+++ b/mailnews/import/applemail/src/nsAppleMailImport.h
@@ -6,17 +6,16 @@
#ifndef nsAppleMailImport_h___
#define nsAppleMailImport_h___
#include "prlog.h"
#include "nsIImportModule.h"
#include "nsCOMPtr.h"
#include "nsIStringBundle.h"
#include "nsIImportMail.h"
-#include "nsISupportsArray.h"
// logging facilities
extern PRLogModuleInfo *APPLEMAILLOGMODULE;
#define IMPORT_LOG0(x) PR_LOG(APPLEMAILLOGMODULE, PR_LOG_DEBUG, (x))
#define IMPORT_LOG1(x, y) PR_LOG(APPLEMAILLOGMODULE, PR_LOG_DEBUG, (x, y))
#define IMPORT_LOG2(x, y, z) PR_LOG(APPLEMAILLOGMODULE, PR_LOG_DEBUG, (x, y, z))
#define IMPORT_LOG3(a, b, c, d) PR_LOG(APPLEMAILLOGMODULE, PR_LOG_DEBUG, (a, b, c, d))
@@ -27,16 +26,17 @@ extern PRLogModuleInfo *APPLEMAILLOGMODU
#define NS_APPLEMAILIMPORT_CID \
{ 0x6d3f101c, 0x70ec, 0x4e04, { 0xb6, 0x8d, 0x99, 0x08, 0xd1, 0xae, 0xdd, 0xf3 } }
#define NS_APPLEMAILIMPL_CONTRACTID "@mozilla.org/import/import-appleMailImpl;1"
#define kAppleMailSupportsString "mail"
class nsIImportService;
+class nsIMutableArray;
class nsAppleMailImportModule : public nsIImportModule
{
public:
nsAppleMailImportModule();
virtual ~nsAppleMailImportModule();
@@ -57,19 +57,19 @@ class nsAppleMailImportMail : public nsI
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIIMPORTMAIL
nsresult Initialize();
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);
static void SetLogs(const nsAString& success, const nsAString& error, PRUnichar **aOutErrorLog, PRUnichar **aSuccessLog);
nsCOMPtr<nsIStringBundle> mBundle;
uint32_t mProgress;
uint16_t mCurDepth;
--- a/mailnews/import/eudora/src/nsEudoraAddress.h
+++ b/mailnews/import/eudora/src/nsEudoraAddress.h
@@ -6,40 +6,40 @@
#ifndef nsEudoraAddress_h__
#define nsEudoraAddress_h__
#include "nscore.h"
#include "nsStringGlue.h"
#include "nsVoidArray.h"
#include "nsIFile.h"
-#include "nsISupportsArray.h"
#include "nsCOMPtr.h"
#include "nsIImportService.h"
class nsIAddrDatabase;
class CAliasEntry;
class CAliasData;
class nsIStringBundle;
+class nsIMutableArray;
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
class nsEudoraAddress {
public:
nsEudoraAddress();
virtual ~nsEudoraAddress();
// Things that must be overridden because they are platform specific.
// 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
nsresult ImportAddresses(uint32_t *pBytes, bool *pAbort, const PRUnichar *pName, nsIFile *pSrc, nsIAddrDatabase *pDb, nsString& errors);
private:
void EmptyAliases(void);
--- a/mailnews/import/eudora/src/nsEudoraCompose.cpp
+++ b/mailnews/import/eudora/src/nsEudoraCompose.cpp
@@ -607,17 +607,17 @@ nsresult nsEudoraCompose::SendTheMessage
if (!bodyType.IsEmpty())
pMimeType = ToNewCString(NS_LossyConvertUTF16toASCII(bodyType));
else
pMimeType = ToNewCString(m_bodyType);
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));
nsString uniBody;
NS_CopyNativeToUnicode(nsDependentCString(m_pBody), uniBody);
/*
l10n - I have the body of the message in the system charset,
--- a/mailnews/import/eudora/src/nsEudoraEditor.cpp
+++ b/mailnews/import/eudora/src/nsEudoraEditor.cpp
@@ -1,16 +1,16 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsEudoraEditor.h"
-#include "nsISupportsArray.h"
+#include "nsIArray.h"
#include "nsComponentManagerUtils.h"
#include "nsStringGlue.h"
#include "nsMsgUtils.h"
#include "nsNetUtil.h"
#include "nsImportEmbeddedImageData.h"
static char * sEudoraEmbeddedContentLines[] = {
"Embedded Content: ",
@@ -52,29 +52,30 @@ nsEudoraEditor::nsEudoraEditor(const cha
m_pMailImportLocation = pMailImportLocation;
}
nsEudoraEditor::~nsEudoraEditor()
{
}
-nsresult nsEudoraEditor::GetEmbeddedObjects(nsISupportsArray ** aNodeList)
+nsresult nsEudoraEditor::GetEmbeddedObjects(nsIArray ** aNodeList)
{
NS_ENSURE_ARG_POINTER(aNodeList);
// Check to see if we were already called
if (m_EmbeddedObjectList != nullptr)
{
*aNodeList = m_EmbeddedObjectList;
return NS_OK;
}
// 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
// assumes that we incremented the ref count.
NS_IF_ADDREF(*aNodeList = m_EmbeddedObjectList);
// Create the embedded folder spec
nsCOMPtr<nsIFile> embeddedFolderSpec;
@@ -168,17 +169,17 @@ nsresult nsEudoraEditor::GetEmbeddedObje
nsCOMPtr<nsIURI> embeddedFileURI;
NS_NewFileURI(getter_AddRefs(embeddedFileURI), embeddedImageSpec);
// Create the embedded image node
nsImportEmbeddedImageData *imageData =
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)
{
// We recognized the "Embedded Content" line correctly and found the associated image.
// Remove the Eudora specific line about it now.
m_body.Cut(startEmbeddedContentLine, endEmbeddedContentLine - startEmbeddedContentLine + 2);
--- a/mailnews/import/eudora/src/nsEudoraEditor.h
+++ b/mailnews/import/eudora/src/nsEudoraEditor.h
@@ -4,26 +4,27 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nscore.h"
#include "nsIEditor.h"
#include "nsIEditorMailSupport.h"
#include "nsCOMPtr.h"
#include "nsStringGlue.h"
#include "nsIFile.h"
+#include "nsIMutableArray.h"
class nsEudoraEditor
{
public:
nsEudoraEditor(const char * pBody, nsIFile * pMailImportLocation);
~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
};
--- a/mailnews/import/eudora/src/nsEudoraFilters.cpp
+++ b/mailnews/import/eudora/src/nsEudoraFilters.cpp
@@ -386,21 +386,21 @@ nsresult nsEudoraFilters::Init()
nsresult nsEudoraFilters::LoadServers()
{
nsresult rv;
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);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIArray> allServers;
rv = accountMgr->GetAllServers(getter_AddRefs(allServers));
NS_ENSURE_SUCCESS(rv, rv);
@@ -426,32 +426,32 @@ nsresult nsEudoraFilters::LoadServers()
if (serverType.Equals("none") || serverType.Equals("imap"))
{
// Pre-fetch filters now so that if there's any problem reading up the
// filter file we know about it in advance and can stop importing
nsCOMPtr<nsIMsgFilterList> filterList;
rv = server->GetFilterList(nullptr, getter_AddRefs(filterList));
NS_ENSURE_SUCCESS(rv, rv);
- m_pServerArray->AppendElement(server);
+ m_pServerArray->AppendElement(server, false);
}
}
}
}
}
return NS_OK;
}
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++)
{
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryElementAt(m_pServerArray, serverIndex, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr <nsIMsgFilterList> filterList;
rv = server->GetFilterList(nullptr, getter_AddRefs(filterList));
@@ -469,17 +469,17 @@ nsresult nsEudoraFilters::CreateNewFilte
nsresult rv;
rv = m_pFilterArray->Clear();
NS_ENSURE_SUCCESS(rv, rv);
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++)
{
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryElementAt(m_pServerArray, serverIndex, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr <nsIMsgFilterList> filterList;
rv = server->GetFilterList(nullptr, getter_AddRefs(filterList));
@@ -494,17 +494,17 @@ nsresult nsEudoraFilters::CreateNewFilte
uint32_t count;
rv = filterList->GetFilterCount(&count);
NS_ENSURE_SUCCESS(rv, rv);
rv = filterList->InsertFilterAt(count, newFilter);
NS_ENSURE_SUCCESS(rv, rv);
- m_pFilterArray->AppendElement(newFilter);
+ m_pFilterArray->AppendElement(newFilter, false);
}
m_isAnd = false;
m_isUnless = false;
m_ignoreTerm = false;
m_isIncoming = false;
m_addedAction = false;
m_hasTransfer = false;
@@ -534,17 +534,17 @@ nsresult nsEudoraFilters::FinalizeFilter
return rv;
}
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++)
{
nsCOMPtr<nsIMsgFilter> filter = do_QueryElementAt(m_pFilterArray, filterIndex, &rv);
NS_ENSURE_SUCCESS(rv, rv);
filter->SetEnabled(enable);
}
@@ -739,17 +739,17 @@ nsresult nsEudoraFilters::AddTerm(const
int32_t headerIndex = AddCustomHeader(arbitraryHeader.get());
NS_ENSURE_TRUE(headerIndex >= 0, NS_ERROR_FAILURE);
attrib = nsMsgSearchAttrib::OtherHeader + 1 + headerIndex;
}
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++)
{
nsCOMPtr<nsIMsgFilter> filter = do_QueryElementAt(m_pFilterArray, filterIndex, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISupportsArray> terms;
rv = filter->GetSearchTerms(getter_AddRefs(terms));
@@ -788,17 +788,17 @@ nsresult nsEudoraFilters::AddTerm(const
}
nsresult nsEudoraFilters::AddAction(nsMsgRuleActionType actionType, int32_t junkScore /*= 0*/, nsMsgLabelValue label/*= 0*/,
nsMsgPriorityValue priority/*= 0*/, const char* strValue/*= nullptr*/, const char* targetFolderUri/*= nullptr*/)
{
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++)
{
nsCOMPtr<nsIMsgFilter> filter = do_QueryElementAt(m_pFilterArray, filterIndex, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMsgRuleAction> action;
rv = filter->CreateAction(getter_AddRefs(action));
--- a/mailnews/import/eudora/src/nsEudoraFilters.h
+++ b/mailnews/import/eudora/src/nsEudoraFilters.h
@@ -3,16 +3,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsEudoraFilters_h___
#define nsEudoraFilters_h___
#include "nsIImportFilters.h"
#include "nsIFile.h"
+#include "nsIMutableArray.h"
#include "nsCOMPtr.h"
#include "nsMsgFilterCore.h"
class nsIMsgFolder;
class nsEudoraFilters : public nsIImportFilters {
public:
nsEudoraFilters();
@@ -23,18 +24,18 @@ public:
// nsISupports interface
NS_DECL_ISUPPORTS
// nsIImportFilters interface
NS_DECL_NSIIMPORTFILTERS
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;
bool m_isAnd;
bool m_isUnless;
bool m_ignoreTerm;
bool m_isIncoming;
--- a/mailnews/import/eudora/src/nsEudoraImport.cpp
+++ b/mailnews/import/eudora/src/nsEudoraImport.cpp
@@ -18,16 +18,17 @@
#include "nscore.h"
#include "nsCOMPtr.h"
#include "nsStringGlue.h"
#include "nsServiceManagerUtils.h"
#include "nsIImportService.h"
#include "nsComponentManagerUtils.h"
#include "nsEudoraImport.h"
#include "nsIMemory.h"
+#include "nsIMutableArray.h"
#include "nsIImportService.h"
#include "nsIImportMail.h"
#include "nsIImportMailboxDescriptor.h"
#include "nsIImportGeneric.h"
#include "nsIImportAddressBooks.h"
#include "nsIImportABDescriptor.h"
#include "nsIImportSettings.h"
#include "nsIImportFilters.h"
@@ -70,18 +71,18 @@ public:
// nsISupports interface
NS_DECL_THREADSAFE_ISUPPORTS
// nsIImportmail interface
/* 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,
PRUnichar **pErrorLog, PRUnichar **pSuccessLog,
bool *fatalError);
/* unsigned long GetImportProgress (); */
NS_IMETHOD GetImportProgress(uint32_t *_retval);
@@ -124,17 +125,17 @@ public:
NS_IMETHOD GetSupportsMultiple(bool *_retval) { *_retval = true; return NS_OK;}
NS_IMETHOD GetAutoFind(PRUnichar **description, bool *_retval);
NS_IMETHOD GetNeedsFieldMap(nsIFile *location, bool *_retval) { *_retval = false; return NS_OK;}
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; }
NS_IMETHOD ImportAddressBook(nsIImportABDescriptor *source,
nsIAddrDatabase *destination,
nsIImportFieldMap *fieldMap,
nsISupports *aSupportService,
@@ -418,33 +419,41 @@ NS_IMETHODIMP ImportEudoraMailImpl::GetD
*ppLoc = nullptr;
*found = m_eudora.FindMailFolder(ppLoc);
*userVerify = true;
return NS_OK;
}
-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");
if (!pLoc || !ppArray)
return NS_ERROR_NULL_POINTER;
bool exists = false;
nsresult rv = pLoc->Exists(&exists);
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)
{
if (pStream)
pStream->Append(PRUnichar('\n'));
}
@@ -627,33 +636,41 @@ NS_IMETHODIMP ImportEudoraAddressImpl::G
*found = m_eudora.FindAddressFolder(ppLoc);
*userVerify = true;
return NS_OK;
}
-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");
if (!pLoc || !ppArray)
return NS_ERROR_NULL_POINTER;
bool exists = false;
nsresult rv = pLoc->Exists(&exists);
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;
}
void ImportEudoraAddressImpl::ReportSuccess(nsString& name, nsString *pStream)
{
if (!pStream)
return;
--- a/mailnews/import/eudora/src/nsEudoraMac.cpp
+++ b/mailnews/import/eudora/src/nsEudoraMac.cpp
@@ -4,16 +4,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsCOMPtr.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsIMsgAccountManager.h"
#include "nsIMsgAccount.h"
+#include "nsIMutableArray.h"
#include "nsMsgBaseCID.h"
#include "nsMsgCompCID.h"
#include "nsISmtpService.h"
#include "nsISmtpServer.h"
#include "nsEudoraMac.h"
#include "nsIImportService.h"
#include "nsIImportMailboxDescriptor.h"
#include "nsIImportABDescriptor.h"
@@ -207,52 +208,46 @@ bool nsEudoraMac::VerifyEudoraLocation(n
return false;
NS_IF_ADDREF(*pFolder = prefFile);
return true;
}
-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;
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
// the directory
m_depth++;
nsresult rv = IterateMailDir(pFolder, pArray, pImport);
m_depth--;
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;
nsresult rv = pFolder->GetDirectoryEntries(getter_AddRefs(directoryEnumerator));
NS_ENSURE_SUCCESS(rv, rv);
directoryEnumerator->HasMoreElements(&hasMore);
@@ -307,17 +302,17 @@ nsresult nsEudoraMac::IterateMailDir(nsI
rv = FoundMailbox(entry, fName.get(), pArray, pImport);
}
}
}
return rv;
}
-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;
nsISupports * pInterface;
NS_CopyNativeToUnicode(nsDependentCString(pName), displayName);
#ifdef IMPORT_DEBUG
@@ -339,25 +334,25 @@ nsresult nsEudoraMac::FoundMailbox(nsIFi
desc->SetDepth(m_depth);
nsCOMPtr <nsIFile> pLocalFile;
desc->GetFile(getter_AddRefs(pLocalFile));
if (pLocalFile)
{
pLocalFile->InitWithFile(mailFile);
}
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
- pArray->AppendElement(pInterface);
+ pArray->AppendElement(pInterface, false);
pInterface->Release();
}
return NS_OK;
}
-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;
nsISupports * pInterface;
NS_CopyNativeToUnicode(nsDependentCString(pName), displayName);
#ifdef IMPORT_DEBUG
@@ -377,17 +372,17 @@ nsresult nsEudoraMac::FoundMailFolder(ns
desc->SetDisplayName(displayName.get());
desc->SetDepth(m_depth);
desc->SetSize(sz);
nsCOMPtr <nsIFile> pFile;
desc->GetFile(getter_AddRefs(pFile));
if (pFile)
pFile->InitWithFile(mailFolder);
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
- pArray->AppendElement(pInterface);
+ pArray->AppendElement(pInterface, false);
pInterface->Release();
}
return NS_OK;
}
bool nsEudoraMac::CreateTocFromResource(nsIFile *pMail, nsIFile **pToc)
{
@@ -1097,33 +1092,27 @@ bool nsEudoraMac::IsValidMailboxFile(nsI
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
// Try and find the nickNames file
nsresult rv;
nsCOMPtr<nsIFile> file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
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))
return rv;
nsString displayName;
nsEudoraStringBundle::GetStringByID(EUDORAIMPORT_NICKNAMES_NAME, displayName);
int64_t sz = 0;
@@ -1148,17 +1137,17 @@ nsresult nsEudoraMac::FindAddressBooks(n
{
sz = 0;
file->GetFileSize(&sz);
desc->SetPreferredName(displayName);
desc->SetSize(sz);
// 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))
{
IMPORT_LOG0("*** Error creating address book descriptor for eudora nicknames\n");
return rv;
}
}
@@ -1222,17 +1211,17 @@ nsresult nsEudoraMac::FindAddressBooks(n
{
sz = 0;
entry->GetFileSize(&sz);
desc->SetPreferredName(displayName);
desc->SetSize(sz);
// 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))
{
IMPORT_LOG0("*** Error creating address book descriptor for eudora address book\n");
return rv;
}
}
--- a/mailnews/import/eudora/src/nsEudoraMac.h
+++ b/mailnews/import/eudora/src/nsEudoraMac.h
@@ -6,52 +6,52 @@
#ifndef nsEudoraMac_h__
#define nsEudoraMac_h__
#include "mozilla/Attributes.h"
#include "nscore.h"
#include "nsStringGlue.h"
#include "nsIFile.h"
-#include "nsISupportsArray.h"
#include "nsEudoraMailbox.h"
#include "nsEudoraAddress.h"
#include <CoreServices/CoreServices.h>
class nsIImportService;
class nsIMsgAccountManager;
class nsIMsgAccount;
+class nsIMutableArray;
class nsEudoraMac : public nsEudoraMailbox, public nsEudoraAddress {
public:
nsEudoraMac();
~nsEudoraMac();
// 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;
+ nsIMutableArray *pArray) MOZ_OVERRIDE;
// get a TOC file from a mailbox file
virtual nsresult FindTOCFile(nsIFile *pMailFile,
nsIFile **pTOCFile,
bool *pDeleteToc) MOZ_OVERRIDE;
virtual nsresult GetAttachmentInfo(const char *pFileName,
nsIFile *pFile,
nsCString& mimeType,
nsCString& aAttachment) MOZ_OVERRIDE;
// Address book stuff
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,
nsIMsgAccount **localMailAccount);
static bool FindSettingsFile(nsIFile **pIniFile) { return FindEudoraLocation(pIniFile, true);}
static bool FindFiltersFile(nsIFile **pFiltersFile);
@@ -61,28 +61,28 @@ private:
nsIFile *pLookIn = nullptr);
static bool FindEudoraLocation(nsIFile **pFolder,
bool findIni,
const char *specialDirName);
static bool VerifyEudoraLocation(nsIFile **pFolder, bool findIni);
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);
bool IsValidMailboxName(nsCString& fName);
bool IsValidMailboxFile(nsIFile *pFile);
bool CreateTocFromResource(nsIFile *pMail, nsIFile **pToc);
--- a/mailnews/import/eudora/src/nsEudoraMailbox.h
+++ b/mailnews/import/eudora/src/nsEudoraMailbox.h
@@ -6,20 +6,20 @@
#ifndef nsEudoraMailbox_h__
#define nsEudoraMailbox_h__
#include "nscore.h"
#include "nsStringGlue.h"
#include "nsVoidArray.h"
#include "nsIFile.h"
-#include "nsISupportsArray.h"
#include "nsEudoraCompose.h"
class nsIOutputStream;
+class nsIMutableArray;
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
class EudoraTOCEntry {
public:
uint16_t GetMozillaStatusFlags();
@@ -136,17 +136,17 @@ class nsEudoraMailbox {
public:
nsEudoraMailbox();
virtual ~nsEudoraMailbox();
// Things that must be overridden because they are platform specific.
// 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
virtual nsresult GetAttachmentInfo(const char *pFileName, nsIFile *pFile, nsCString& mimeType, nsCString& aAttachment) { return NS_ERROR_FAILURE;}
// Non-platform specific common stuff
// import a mailbox
nsresult ImportMailbox(uint32_t *pBytes, bool *pAbort, const PRUnichar *pName,
--- a/mailnews/import/eudora/src/nsEudoraWin32.cpp
+++ b/mailnews/import/eudora/src/nsEudoraWin32.cpp
@@ -5,16 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsCOMPtr.h"
#include "nsMsgUtils.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsIMsgAccountManager.h"
#include "nsIMsgAccount.h"
+#include "nsIMutableArray.h"
#include "nsIPop3IncomingServer.h"
#include "nsMsgBaseCID.h"
#include "nsMsgCompCID.h"
#include "nsISmtpService.h"
#include "nsISmtpServer.h"
#include "nsEudoraWin32.h"
#include "nsIImportService.h"
#include "nsIImportMailboxDescriptor.h"
@@ -145,36 +146,30 @@ bool nsEudoraWin32::FindEudoraLocation(n
} // if pBytes
::RegCloseKey(sKey);
}
NS_IF_ADDREF(*pFolder = eudoraPath);
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;
char * pContents = nullptr;
int32_t len = 0;
nsCOMPtr<nsIFile> descMap;
nsresult rv;
@@ -226,17 +221,17 @@ nsresult nsEudoraWin32::ScanMailDir(nsIF
if (NS_FAILED(rv) || !isFile || !exists)
rv = IterateMailDir(pFolder, pArray, pImport);
m_depth--;
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;
nsresult rv = pFolder->GetDirectoryEntries(getter_AddRefs(directoryEnumerator));
NS_ENSURE_SUCCESS(rv, rv);
directoryEnumerator->HasMoreElements(&hasMore);
bool isFolder;
@@ -293,17 +288,17 @@ nsresult nsEudoraWin32::IterateMailDir(n
rv = FoundMailbox(entry, name.get(), pArray, pImport);
}
}
}
}
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.
nsCOMPtr<nsIFile> entry;
nsresult rv;
if (NS_FAILED(rv = pFolder->Clone(getter_AddRefs(entry))))
return rv;
@@ -420,17 +415,17 @@ nsresult nsEudoraWin32::ScanDescmap(nsIF
}
}
}
return NS_OK;
}
-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;
nsISupports * pInterface;
NS_CopyNativeToUnicode(nsDependentCString(pName), displayName);
#ifdef IMPORT_DEBUG
@@ -453,25 +448,25 @@ nsresult nsEudoraWin32::FoundMailbox(nsI
desc->SetSize(sz);
nsCOMPtr <nsIFile> pFile = nullptr;
desc->GetFile(getter_AddRefs(pFile));
if (pFile)
{
pFile->InitWithFile(mailFile);
}
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
- pArray->AppendElement(pInterface);
+ pArray->AppendElement(pInterface, false);
pInterface->Release();
}
return NS_OK;
}
-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;
nsISupports * pInterface;
NS_CopyNativeToUnicode(nsDependentCString(pName), displayName);
#ifdef IMPORT_DEBUG
@@ -493,17 +488,17 @@ nsresult nsEudoraWin32::FoundMailFolder(
desc->SetSize(sz);
nsCOMPtr <nsIFile> pFile = nullptr;
desc->GetFile(getter_AddRefs(pFile));
if (pFile)
{
pFile->InitWithFile(mailFolder);
}
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
- pArray->AppendElement(pInterface);
+ pArray->AppendElement(pInterface, false);
pInterface->Release();
}
return NS_OK;
}
nsresult nsEudoraWin32::FindTOCFile(nsIFile *pMailFile, nsIFile **ppTOCFile, bool *pDeleteToc)
@@ -1311,31 +1306,24 @@ void nsEudoraWin32::GetMimeTypeFromExten
bool nsEudoraWin32::FindAddressFolder(nsIFile **pFolder)
{
IMPORT_LOG0("*** Looking for Eudora address folder\n");
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);
NS_ENSURE_SUCCESS(rv, rv);
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;
m_addressImportFolder = pRoot;
nsString displayName;
nsEudoraStringBundle::GetStringByID(EUDORAIMPORT_NICKNAMES_NAME, displayName);
// First off, get the default nndbase.txt, then scan the default nicknames subdir,
@@ -1360,34 +1348,34 @@ nsresult nsEudoraWin32::FindAddressBooks
// Check for alternate file extension ".nnt" which Windows Eudora uses as an option
// to hide from simple minded viruses that scan ".txt" files for addresses.
rv = file->SetNativeLeafName(NS_LITERAL_CSTRING("nndbase.nnt"));
checkedBoth = true;
} while (NS_SUCCEEDED(rv));
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;
}
// Try the default directory
rv = file->InitWithFile(pRoot);
if (NS_FAILED(rv))
return rv;
rv = file->AppendNative(NS_LITERAL_CSTRING("Nickname"));
bool isDir = false;
exists = false;
if (NS_SUCCEEDED(rv))
rv = file->Exists(&exists);
if (NS_SUCCEEDED(rv) && exists)
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;
}
// Try the ini file to find other directories!
rv = file->InitWithFile(pRoot);
if (NS_FAILED(rv))
return rv;
rv = file->AppendNative(NS_LITERAL_CSTRING("eudora.ini"));
@@ -1435,17 +1423,17 @@ nsresult nsEudoraWin32::FindAddressBooks
exists = false;
isDir = false;
if (NS_SUCCEEDED(rv))
rv = file->Exists(&exists);
if (NS_SUCCEEDED(rv) && exists)
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;
}
}
dirs = Substring(dirs, idx + 1);
dirs.Trim(kWhitespace);
}
if (!dirs.IsEmpty())
{
@@ -1453,26 +1441,25 @@ nsresult nsEudoraWin32::FindAddressBooks
exists = false;
isDir = false;
if (NS_SUCCEEDED(rv))
rv = file->Exists(&exists);
if (NS_SUCCEEDED(rv) && exists)
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;
nsresult rv = pDir->GetDirectoryEntries(getter_AddRefs(directoryEnumerator));
NS_ENSURE_SUCCESS(rv, rv);
directoryEnumerator->HasMoreElements(&hasMore);
bool isFile;
@@ -1520,17 +1507,17 @@ nsresult nsEudoraWin32::ScanAddressDir(n
}
}
}
return rv;
}
-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;
nsString name;
nsresult rv;
if (pName)
name = pName;
@@ -1551,17 +1538,17 @@ nsresult nsEudoraWin32::FoundAddressBook
if (NS_SUCCEEDED(rv))
{
int64_t sz = 0;
file->GetFileSize(&sz);
desc->SetPreferredName(name);
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))
{
IMPORT_LOG0("*** Error creating address book descriptor for eudora\n");
return rv;
}
--- a/mailnews/import/eudora/src/nsEudoraWin32.h
+++ b/mailnews/import/eudora/src/nsEudoraWin32.h
@@ -6,65 +6,65 @@
#ifndef nsEudoraWin32_h__
#define nsEudoraWin32_h__
#include "mozilla/Attributes.h"
#include "nscore.h"
#include "nsStringGlue.h"
#include "nsIFile.h"
-#include "nsISupportsArray.h"
#include "nsEudoraMailbox.h"
#include "nsEudoraAddress.h"
#include <windows.h>
class nsIImportService;
class nsIMsgAccountManager;
class nsIMsgAccount;
+class nsIMutableArray;
class nsEudoraWin32 : public nsEudoraMailbox, public nsEudoraAddress {
public:
nsEudoraWin32();
~nsEudoraWin32();
// 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;
virtual nsresult GetAttachmentInfo(const char *pFileName, nsIFile *pFile, nsCString& mimeType, nsCString& aAttachment) MOZ_OVERRIDE;
// Things that must be overridden because they are platform specific.
// 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);
static bool FindSettingsFile(nsIFile **pIniFile) { return FindEudoraLocation(pIniFile, true);}
static bool FindFiltersFile(nsIFile **pFiltersFile);
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);
// Settings support
static bool BuildPOPAccount(nsIMsgAccountManager *accMgr, const char *pSection, const char *pIni, nsIMsgAccount **ppAccount);
static bool BuildIMAPAccount(nsIMsgAccountManager *accMgr, const char *pSection, const char *pIni, nsIMsgAccount **ppAccount);
static void GetServerAndUserName(const char *pSection, const char *pIni, nsCString& serverName, nsCString& userName, char *pBuff);
--- a/mailnews/import/oexpress/nsOEImport.cpp
+++ b/mailnews/import/oexpress/nsOEImport.cpp
@@ -25,16 +25,17 @@
#include "nsIImportService.h"
#include "nsIImportMail.h"
#include "nsIImportMailboxDescriptor.h"
#include "nsIImportGeneric.h"
#include "nsOEMailbox.h"
#include "nsIImportAddressBooks.h"
#include "nsIImportABDescriptor.h"
#include "nsIImportFieldMap.h"
+#include "nsIMutableArray.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "WabObject.h"
#include "nsOEAddressIterator.h"
#include "nsIOutputStream.h"
#include "nsOE5File.h"
#include "nsIAddrDatabase.h"
#include "nsOESettings.h"
@@ -61,18 +62,18 @@ public:
// nsISupports interface
NS_DECL_THREADSAFE_ISUPPORTS
// nsIImportmail interface
/* 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,
PRUnichar **pErrorLog, PRUnichar **pSuccessLog,
bool *fatalError);
/* unsigned long GetImportProgress (); */
NS_IMETHOD GetImportProgress(uint32_t *_retval);
@@ -106,17 +107,17 @@ public:
NS_IMETHOD GetSupportsMultiple(bool *_retval) { *_retval = false; return NS_OK;}
NS_IMETHOD GetAutoFind(PRUnichar **description, bool *_retval);
NS_IMETHOD GetNeedsFieldMap(nsIFile *pLoc, bool *_retval) { *_retval = false; return NS_OK;}
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; }
NS_IMETHOD ImportAddressBook(nsIImportABDescriptor *source,
nsIAddrDatabase *destination,
nsIImportFieldMap *fieldMap,
nsISupports *aSupportService,
@@ -322,17 +323,17 @@ NS_IMETHODIMP ImportOEMailImpl::GetDefau
*found = false;
*ppLoc = nullptr;
}
*userVerify = true;
return NS_OK;
}
-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");
if (!pLoc || !ppArray)
return NS_ERROR_NULL_POINTER;
bool exists = false;
nsresult rv = pLoc->Exists(&exists);
@@ -516,23 +517,24 @@ NS_IMETHODIMP ImportOEAddressImpl::GetAu
nsString str;
str.Append(nsOEStringBundle::GetStringByID(OEIMPORT_AUTOFIND));
*description = ToNewUnicode(str);
return NS_OK;
}
-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;
// Make sure we can load up the windows address book...
rv = NS_ERROR_FAILURE;
if (m_pWab)
delete m_pWab;
@@ -562,27 +564,28 @@ NS_IMETHODIMP ImportOEAddressImpl::FindA
if (NS_SUCCEEDED(rv)) {
rv = impSvc->CreateNewABDescriptor(&pID);
if (NS_SUCCEEDED(rv)) {
pID->SetIdentifier(0x4F453334);
pID->SetRef(1);
pID->SetSize(100);
pID->SetPreferredName(str);
rv = pID->QueryInterface(kISupportsIID, (void **) &pInterface);
- (*_retval)->AppendElement(pInterface);
+ array->AppendElement(pInterface, false);
pInterface->Release();
pID->Release();
}
}
}
if (NS_FAILED(rv)) {
delete m_pWab;
m_pWab = nullptr;
}
+ array.forget(_retval);
return NS_OK;
}
NS_IMETHODIMP ImportOEAddressImpl::ImportAddressBook(nsIImportABDescriptor *source,
nsIAddrDatabase *destination,
nsIImportFieldMap *fieldMap,
--- a/mailnews/import/oexpress/nsOEScanBoxes.cpp
+++ b/mailnews/import/oexpress/nsOEScanBoxes.cpp
@@ -128,17 +128,17 @@ bool nsOEScanBoxes::FindMail(nsIFile *pW
localWhere->AppendNative(NS_LITERAL_CSTRING("Mail"));
bool isDir = false;
localWhere->IsDirectory(&isDir);
return isDir;
}
-bool nsOEScanBoxes::GetMailboxes(nsIFile *pWhere, nsISupportsArray **pArray)
+bool nsOEScanBoxes::GetMailboxes(nsIFile *pWhere, nsIArray **pArray)
{
nsCString path;
pWhere->GetNativePath(path);
if (!path.IsEmpty()) {
IMPORT_LOG1("Looking for mail in: %s\n", path.get());
}
else {
pWhere->GetNativeLeafName(path);
@@ -675,30 +675,32 @@ uint32_t nsOEScanBoxes::CountMailboxes(M
}
else
pBox = nullptr;
}
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) {
pBox = m_pFirst;
IMPORT_LOG0("Assigning start of mailbox list to m_pFirst\n");
}
else {
@@ -735,17 +737,17 @@ void nsOEScanBoxes::BuildMailboxList(Mai
pID->GetFile(getter_AddRefs(file));
file->InitWithFile(root);
file->AppendNative(pBox->fileName);
size = 0;
file->GetFileSize(&size);
pID->SetSize(size);
}
rv = pID->QueryInterface(kISupportsIID, (void **) &pInterface);
- pArray->AppendElement(pInterface);
+ pArray->AppendElement(pInterface, false);
pInterface->Release();
pID->Release();
}
if (pBox->child) {
pChild = GetIndexEntry(pBox->child);
if (pChild != nullptr)
BuildMailboxList(pChild, root, depth + 1, pArray);
--- a/mailnews/import/oexpress/nsOEScanBoxes.h
+++ b/mailnews/import/oexpress/nsOEScanBoxes.h
@@ -4,30 +4,31 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsOEScanBoxes_h___
#define nsOEScanBoxes_h___
#include "nsStringGlue.h"
#include "nsIImportModule.h"
#include "nsVoidArray.h"
-#include "nsISupportsArray.h"
+#include "nsIArray.h"
+#include "nsIMutableArray.h"
#include "nsIFile.h"
#include "nsIImportService.h"
class nsIInputStream;
class nsOEScanBoxes {
public:
nsOEScanBoxes();
~nsOEScanBoxes();
static bool FindMail(nsIFile *pWhere);
- bool GetMailboxes(nsIFile *pWhere, nsISupportsArray **pArray);
+ bool GetMailboxes(nsIFile *pWhere, nsIArray **pArray);
private:
typedef struct {
uint32_t index;
uint32_t parent;
int32_t child;
int32_t sibling;
@@ -55,18 +56,18 @@ private:
bool ReadLong(nsIInputStream * stream, int32_t& val, uint32_t offset);
bool ReadLong(nsIInputStream * stream, uint32_t& val, uint32_t offset);
bool ReadString(nsIInputStream * stream, nsString& str, uint32_t offset);
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;
nsVoidArray m_entryArray;
nsVoidArray m_pendingChildArray; // contains child folders whose parent folders have not showed up.
nsCOMPtr<nsIImportService> mService;
};
--- a/mailnews/import/outlook/src/nsOutlookCompose.cpp
+++ b/mailnews/import/outlook/src/nsOutlookCompose.cpp
@@ -20,16 +20,17 @@
#include "nsMsgAttachmentData.h"
#include "nsMsgBaseCID.h"
#include "nsMsgCompCID.h"
#include "nsIArray.h"
#include "nsIMsgCompose.h"
#include "nsIMsgCompFields.h"
#include "nsIMsgAccountManager.h"
#include "nsIMsgSend.h"
+#include "nsIMutableArray.h"
#include "nsImportEmbeddedImageData.h"
#include "nsNetCID.h"
#include "nsCRT.h"
#include "nsOutlookCompose.h"
#include "OutlookDebugLog.h"
#include "nsMimeTypes.h"
@@ -289,32 +290,32 @@ nsresult nsOutlookCompose::ComposeTheMes
nsString bodyW;
// Bug 593907
if (GenerateHackSequence(msg.GetBody(), msg.GetBodyLen()))
HackBody(msg.GetBody(), msg.GetBodyLen(), bodyW);
else
bodyW = msg.GetBody();
// End Bug 593907
- nsCOMPtr<nsISupportsArray> embeddedObjects;
+ nsCOMPtr<nsIMutableArray> embeddedObjects;
if (msg.BodyIsHtml()) {
for (unsigned int i = 0; i <msg.EmbeddedAttachmentsCount(); i++) {
nsIURI *uri;
const char* cid;
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);
}
}
}
nsCString bodyA;
nsMsgI18NConvertFromUnicode(msg.GetBodyCharset(), bodyW, bodyA);
nsCOMPtr<nsIImportService> impService(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv));
--- a/mailnews/import/outlook/src/nsOutlookImport.cpp
+++ b/mailnews/import/outlook/src/nsOutlookImport.cpp
@@ -55,18 +55,18 @@ public:
// nsISupports interface
NS_DECL_THREADSAFE_ISUPPORTS
// nsIImportmail interface
/* 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,
PRUnichar **pErrorLog, PRUnichar **pSuccessLog,
bool *fatalError);
/* unsigned long GetImportProgress (); */
NS_IMETHOD GetImportProgress(uint32_t *_retval);
@@ -102,17 +102,17 @@ public:
NS_IMETHOD GetAutoFind(PRUnichar **description, bool *_retval);
NS_IMETHOD GetNeedsFieldMap(nsIFile *location, bool *_retval) { *_retval = false; return NS_OK;}
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; }
NS_IMETHOD ImportAddressBook(nsIImportABDescriptor *source,
nsIAddrDatabase *destination,
nsIImportFieldMap *fieldMap,
nsISupports *aSupportService,
@@ -333,17 +333,17 @@ NS_IMETHODIMP ImportOutlookMailImpl::Get
*found = true;
NS_IF_ADDREF(*ppLoc = resultFile);
*userVerify = false;
return NS_OK;
}
-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");
if (!pLoc || !ppArray)
return NS_ERROR_NULL_POINTER;
return m_mail.GetMailFolders(ppArray);
}
@@ -496,17 +496,17 @@ NS_IMETHODIMP ImportOutlookAddressImpl::
*_retval = true;
nsString str;
nsOutlookStringBundle::GetStringByID(OUTLOOKIMPORT_ADDRNAME, str);
*description = ToNewUnicode(str);
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)
return NS_ERROR_NULL_POINTER;
return m_address.GetAddressBooks(_retval);
}
--- a/mailnews/import/outlook/src/nsOutlookMail.cpp
+++ b/mailnews/import/outlook/src/nsOutlookMail.cpp
@@ -10,16 +10,17 @@
#include "nsCOMPtr.h"
#include "nscore.h"
#include "nsMsgUtils.h"
#include "nsIServiceManager.h"
#include "nsIImportService.h"
#include "nsIImportFieldMap.h"
#include "nsIImportMailboxDescriptor.h"
#include "nsIImportABDescriptor.h"
+#include "nsIMutableArray.h"
#include "nsOutlookStringBundle.h"
#include "nsABBaseCID.h"
#include "nsIAbCard.h"
#include "mdb.h"
#include "OutlookDebugLog.h"
#include "nsOutlookMail.h"
#include "nsUnicharUtils.h"
#include "nsIOutputStream.h"
@@ -103,26 +104,27 @@ nsOutlookMail::nsOutlookMail()
m_lpMdb = NULL;
}
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;
}
nsCOMPtr<nsIImportService> impSvc(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
m_gotFolders = true;
@@ -169,22 +171,22 @@ nsresult nsOutlookMail::GetMailFolders(n
pID->SetDepth(pFolder->GetDepth());
pID->SetIdentifier(i);
pFolder->GetDisplayName(name);
pID->SetDisplayName(name.get());
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;
}
bool nsOutlookMail::IsAddressBookNameUnique(nsString& name, nsString& list)
{
nsString usedName;
usedName.AppendLiteral("[");
usedName.Append(name);
@@ -207,26 +209,27 @@ void nsOutlookMail::MakeAddressBookNameU
}
name = newName;
list.AppendLiteral("[");
list.Append(name);
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;
}
nsCOMPtr<nsIImportService> impSvc(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
m_gotAddresses = true;
@@ -270,23 +273,23 @@ nsresult nsOutlookMail::GetAddressBooks(
rv = impSvc->CreateNewABDescriptor(&pID);
if (NS_SUCCEEDED(rv)) {
pID->SetIdentifier(i);
pFolder->GetDisplayName(name);
MakeAddressBookNameUnique(name, list);
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;
}
void nsOutlookMail::OpenMessageStore(CMapiFolder *pNextFolder)
{
// Open the store specified
if (pNextFolder->IsStore()) {
if (!m_mapi.OpenStore(pNextFolder->GetCBEntryID(), pNextFolder->GetEntryID(), &m_lpMdb)) {
--- a/mailnews/import/outlook/src/nsOutlookMail.h
+++ b/mailnews/import/outlook/src/nsOutlookMail.h
@@ -1,34 +1,34 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsOutlookMail_h___
#define nsOutlookMail_h___
-#include "nsISupportsArray.h"
+#include "nsIArray.h"
#include "nsStringGlue.h"
#include "nsOutlookCompose.h"
#include "nsIFile.h"
#include "MapiApi.h"
#include "MapiMessage.h"
#include "nsIAddrDatabase.h"
class nsIAddrDatabase;
class nsIImportFieldMap;
class nsOutlookMail {
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);
static nsresult ImportMessage(LPMESSAGE lpMsg, nsIOutputStream *destOutputStream, nsMsgDeliverMode mode);
nsresult ImportAddresses(uint32_t *pCount, uint32_t *pTotal, const PRUnichar *pName, uint32_t id, nsIAddrDatabase *pDb, nsString& errors);
private:
void OpenMessageStore(CMapiFolder *pNextFolder);
static BOOL WriteData(nsIOutputStream *pDest, const char *pData, int32_t len);
--- a/mailnews/import/public/nsIImportAddressBooks.idl
+++ b/mailnews/import/public/nsIImportAddressBooks.idl
@@ -30,23 +30,23 @@
3) Show the progress dialog for the import - this could be per address book if
mapping is required? what to do, what to doooooo.....
4) All done, maybe a what was done panel??
*/
#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
{
/*
Does this interface supports 1 or 1..n address books. You only
get to choose 1 location so for formats where 1..n address books
are imported from a directory, then return true. For a 1 to 1 relationship
between location and address books return false.
@@ -75,21 +75,21 @@ interface nsIImportAddressBooks : nsISup
means an error - address book cannot be found on this machine.
If userVerify is true, the user will have an opportunity to specify
a different location to import address book from.
*/
void GetDefaultLocation( out nsIFile location,
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
books from this location.
*/
void InitFieldMap(in nsIImportFieldMap fieldMap);
/**
--- a/mailnews/import/public/nsIImportGeneric.idl
+++ b/mailnews/import/public/nsIImportGeneric.idl
@@ -8,27 +8,27 @@
up UI and doing all of the work to make it happen.
*/
#include "nsISupports.idl"
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.
*/
nsISupports GetData( in string dataId);
void SetData( in string dataId, in nsISupports pData);
--- a/mailnews/import/public/nsIImportMail.idl
+++ b/mailnews/import/public/nsIImportMail.idl
@@ -31,39 +31,39 @@
is used for progress bar updating and MAY BE CALLED FROM ANOTHER
THREAD!
*/
#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
{
/*
If found and userVerify BOTH return false, then it is assumed that this
means an error - mail cannot be found on this machine.
If userVerify is true, the user will have an opportunity to specify
a different location to import mail from.
*/
void GetDefaultLocation( out nsIFile location,
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
occurs that is non-fatal, the destination will be deleted and other mailboxes
will be imported. If a fatal error occurs, the destination will be deleted
and the import operation will abort.
*/
void ImportMailbox(in nsIImportMailboxDescriptor source,
--- a/mailnews/import/public/nsIImportService.idl
+++ b/mailnews/import/public/nsIImportService.idl
@@ -17,19 +17,19 @@ interface nsIImportABDescriptor;
interface nsIImportGeneric;
interface nsIImportFieldMap;
interface nsIMsgSendListener;
interface nsIMsgCompFields;
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();
long GetModuleCount( in string filter);
void GetModuleInfo( in string filter, in long index, out wstring name, out wstring description);
wstring GetModuleName( in string filter, in long index);
wstring GetModuleDescription( in string filter, in long index);
@@ -42,17 +42,17 @@ interface nsIImportService : nsISupports
nsIImportGeneric CreateNewGenericMail();
nsIImportGeneric CreateNewGenericAddressBooks();
void CreateRFC822Message(in nsIMsgIdentity aIdentity,
in nsIMsgCompFields aMsgFields,
in string aBodytype,
in ACString aBody,
in boolean aCreateAsDraft,
in nsIArray aLoadedAttachments,
- in nsISupportsArray aEmbeddedObjects,
+ in nsIArray aEmbeddedObjects,
in nsIMsgSendListener aListener);
};
%{ C++
#define NS_IMPORTSERVICE_CID \
{ /* 5df96d60-1726-11d3-a206-00a0cc26da63 */ \
0x5df96d60, 0x1726, 0x11d3, \
--- a/mailnews/import/src/nsImportAddressBooks.cpp
+++ b/mailnews/import/src/nsImportAddressBooks.cpp
@@ -22,18 +22,19 @@
#include "nsIStringBundle.h"
#include "nsImportStringBundle.h"
#include "nsTextFormatter.h"
#include "nsServiceManagerUtils.h"
#include "msgCore.h"
#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);
class AddressThreadData;
class nsImportGenericAddressBooks : public nsIImportGeneric
{
public:
@@ -67,17 +68,17 @@ private:
public:
static void SetLogs(nsString& success, nsString& error, nsISupportsString *pSuccess, nsISupportsString *pError);
static void ReportError(const PRUnichar *pName, nsString *pStream,
nsIStringBundle *aBundle);
private:
nsIImportAddressBooks * m_pInterface;
- nsISupportsArray *m_pBooks;
+ nsCOMPtr<nsIArray> m_Books;
nsCOMArray<nsIAddrDatabase> m_DBs;
nsCOMPtr <nsIFile> m_pLocation;
nsIImportFieldMap * m_pFieldMap;
bool m_autoFind;
PRUnichar * m_description;
bool m_gotLocation;
bool m_found;
bool m_userVerify;
@@ -93,17 +94,17 @@ private:
class AddressThreadData {
public:
bool driverAlive;
bool threadAlive;
bool abort;
bool fatalError;
uint32_t currentTotal;
uint32_t currentSize;
- nsISupportsArray * books;
+ nsIArray *books;
nsCOMArray<nsIAddrDatabase>* dBs;
nsCOMPtr<nsIAbLDIFService> ldifService;
nsIImportAddressBooks * addressImport;
nsIImportFieldMap * fieldMap;
nsISupportsString * successLog;
nsISupportsString * errorLog;
char * pDestinationUri;
nsIStringBundle* stringBundle;
@@ -129,17 +130,16 @@ nsresult NS_NewGenericAddressBooks(nsIIm
NS_RELEASE(pGen);
return rv;
}
nsImportGenericAddressBooks::nsImportGenericAddressBooks()
{
m_pInterface = nullptr;
- m_pBooks = nullptr;
m_pSuccessLog = nullptr;
m_pErrorLog = nullptr;
m_totalSize = 0;
m_doImport = false;
m_pThreadData = nullptr;
m_pDestinationUri = nullptr;
m_pFieldMap = nullptr;
@@ -158,17 +158,16 @@ nsImportGenericAddressBooks::~nsImportGe
if (m_pDestinationUri)
NS_Free(m_pDestinationUri);
if (m_description)
NS_Free(m_description);
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);
}
NS_IMPL_ISUPPORTS1(nsImportGenericAddressBooks, nsIImportGeneric)
@@ -190,20 +189,19 @@ NS_IMETHODIMP nsImportGenericAddressBook
if (!m_pLocation)
GetDefaultLocation();
NS_IF_ADDREF(*_retval = m_pLocation);
}
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")) {
if (m_pDestinationUri) {
nsCOMPtr<nsISupportsCString> abString = do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
abString->SetData(nsDependentCString(m_pDestinationUri));
NS_IF_ADDREF(*_retval = abString);
@@ -269,19 +267,18 @@ NS_IMETHODIMP nsImportGenericAddressBook
return NS_ERROR_NULL_POINTER;
if (!PL_strcasecmp(dataId, "addressInterface")) {
NS_IF_RELEASE(m_pInterface);
if (item)
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")) {
m_pLocation = nullptr;
if (item) {
nsresult rv;
m_pLocation = do_QueryInterface(item, &rv);
@@ -379,23 +376,23 @@ void nsImportGenericAddressBooks::GetDef
nsCOMPtr <nsIFile> pLoc;
m_pInterface->GetDefaultLocation(getter_AddRefs(pLoc), &m_found, &m_userVerify);
if (!m_pLocation)
m_pLocation = pLoc;
}
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");
}
}
void nsImportGenericAddressBooks::GetDefaultFieldMap(void)
{
if (!m_pInterface || !m_pLocation)
@@ -432,27 +429,27 @@ NS_IMETHODIMP nsImportGenericAddressBook
NS_PRECONDITION(_retval != nullptr, "null ptr");
NS_ENSURE_ARG_POINTER(_retval);
GetDefaultLocation();
GetDefaultBooks();
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;
nsresult rv = book->GetImport(&import);
if (NS_SUCCEEDED(rv) && import) {
(void) book->GetSize(&size);
result = true;
}
@@ -604,17 +601,17 @@ NS_IMETHODIMP nsImportGenericAddressBook
if (!m_doImport) {
*_retval = true;
nsImportStringBundle::GetStringByID(IMPORT_NO_ADDRBOOKS, m_stringBundle,
success);
SetLogs(success, error, successLog, errorLog);
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);
*_retval = false;
return NS_OK;
}
bool needsFieldMap = false;
@@ -635,38 +632,38 @@ NS_IMETHODIMP nsImportGenericAddressBook
NS_IF_ADDREF(m_pSuccessLog);
NS_IF_ADDREF(m_pErrorLog);
// create the info need to drive address book import. We're
// 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;
NS_IF_ADDREF(m_pFieldMap);
m_pThreadData->errorLog = m_pErrorLog;
NS_IF_ADDREF(m_pErrorLog);
m_pThreadData->successLog = m_pSuccessLog;
NS_IF_ADDREF(m_pSuccessLog);
if (m_pDestinationUri)
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)
{
nsString name;
book->GetPreferredName(name);
db = GetAddressBook(name.get(), true);
}
@@ -806,17 +803,17 @@ static void ImportAddressThread(void *st
uint32_t count = 0;
uint32_t i;
bool import;
uint32_t size;
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 =
do_QueryElementAt(pData->books, i);
if (book) {
import = false;
size = 0;
--- a/mailnews/import/src/nsImportMail.cpp
+++ b/mailnews/import/src/nsImportMail.cpp
@@ -10,17 +10,18 @@
// sorry, this has to be before the pre-compiled header
#define FORCE_PR_LOG /* Allow logging in the release build */
#endif
#include "prthread.h"
#include "prprf.h"
#include "nscore.h"
#include "nsCOMPtr.h"
-#include "nsISupportsArray.h"
+#include "nsIArray.h"
+#include "nsArrayUtils.h"
#include "nsIImportMail.h"
#include "nsIImportGeneric.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsIImportMailboxDescriptor.h"
#include "nsStringGlue.h"
@@ -91,18 +92,18 @@ private:
nsString m_pName; // module name that created this interface
nsIMsgFolder * m_pDestFolder;
bool m_deleteDestFolder;
bool m_createdFolder;
nsCOMPtr <nsIFile> m_pSrcLocation;
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;
bool m_doImport;
ImportThreadData * m_pThreadData;
bool m_performingMigration;
nsCOMPtr<nsIStringBundle> m_stringBundle;
};
@@ -112,17 +113,17 @@ public:
bool driverAlive;
bool threadAlive;
bool abort;
bool fatalError;
uint32_t currentTotal;
uint32_t currentSize;
nsIMsgFolder * destRoot;
bool ownsDestRoot;
- nsISupportsArray * boxes;
+ nsIArray *boxes;
nsIImportMail * mailImport;
nsISupportsString * successLog;
nsISupportsString * errorLog;
uint32_t currentMailbox;
bool performingMigration;
nsIStringBundle *stringBundle;
ImportThreadData();
@@ -277,17 +278,17 @@ NS_IMETHODIMP nsImportGenericMail::SetDa
if (!PL_strcasecmp(dataId, "mailInterface")) {
NS_IF_RELEASE(m_pInterface);
if (item)
item->QueryInterface(NS_GET_IID(nsIImportMail), (void **) &m_pInterface);
}
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")) {
NS_IF_RELEASE(m_pMailboxes);
m_pSrcLocation = nullptr;
if (item) {
nsresult rv;
nsCOMPtr <nsIFile> location = do_QueryInterface(item, &rv);
@@ -410,17 +411,17 @@ NS_IMETHODIMP nsImportGenericMail::Wants
if (m_pMailboxes) {
uint32_t i;
bool import;
uint32_t count = 0;
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);
if (box) {
import = false;
size = 0;
nsresult rv = box->GetImport(&import);
if (NS_SUCCEEDED(rv) && import) {
@@ -709,17 +710,17 @@ ImportMailThread(void *stuff)
IMPORT_LOG0("ImportMailThread: Starting...");
nsresult rv = NS_OK;
nsCOMPtr<nsIMsgFolder> destRoot(pData->destRoot);
uint32_t count = 0;
- rv = pData->boxes->Count(&count);
+ rv = pData->boxes->GetLength(&count);
uint32_t i;
bool import;
uint32_t size;
uint32_t depth = 1;
uint32_t newDepth;
nsString lastName;
PRUnichar * pName;
--- a/mailnews/import/src/nsImportService.cpp
+++ b/mailnews/import/src/nsImportService.cpp
@@ -32,16 +32,17 @@
#include "nsIEditor.h"
#include "ImportDebug.h"
#include "nsImportService.h"
#include "nsImportStringBundle.h"
#include "nsCRTGlue.h"
#include "nsServiceManagerUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsIMutableArray.h"
+#include "nsIArray.h"
#include "nsISupportsArray.h"
#include "nsIMsgSend.h"
PRLogModuleInfo *IMPORTLOGMODULE = nullptr;
static nsIImportService * gImportService = nullptr;
static const char * kWhitespace = "\b\t\r\n ";
@@ -290,69 +291,82 @@ class nsProxySendRunnable : public nsRun
{
public:
nsProxySendRunnable(nsIMsgIdentity *aIdentity,
nsIMsgCompFields *aMsgFields,
const char *attachment1_type,
const nsACString &attachment1_body,
bool aIsDraft,
nsIArray *aLoadedAttachments,
- nsISupportsArray *aEmbeddedAttachments,
+ nsIArray *aEmbeddedAttachments,
nsIMsgSendListener *aListener);
NS_DECL_NSIRUNNABLE
private:
nsCOMPtr<nsIMsgIdentity> m_identity;
nsCOMPtr<nsIMsgCompFields> m_compFields;
bool m_isDraft;
nsCString m_bodyType;
nsCString m_body;
nsCOMPtr<nsIArray> m_loadedAttachments;
- nsCOMPtr<nsISupportsArray> m_embeddedAttachments;
+ nsCOMPtr<nsIArray> m_embeddedAttachments;
nsCOMPtr<nsIMsgSendListener> m_listener;
};
nsProxySendRunnable::nsProxySendRunnable(nsIMsgIdentity *aIdentity,
nsIMsgCompFields *aMsgFields,
const char *aBodyType,
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),
m_body(aBody), m_loadedAttachments(aLoadedAttachments),
m_embeddedAttachments(aEmbeddedAttachments),
m_listener(aListener)
{
}
NS_IMETHODIMP nsProxySendRunnable::Run()
{
nsresult rv;
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);
}
NS_IMETHODIMP
nsImportService::CreateRFC822Message(nsIMsgIdentity *aIdentity,
nsIMsgCompFields *aMsgFields,
const char *aBodyType,
const nsACString &aBody,
bool aIsDraft,
nsIArray *aLoadedAttachments,
- nsISupportsArray *aEmbeddedAttachments,
+ nsIArray *aEmbeddedAttachments,
nsIMsgSendListener *aListener)
{
nsRefPtr<nsProxySendRunnable> runnable =
new nsProxySendRunnable(aIdentity,
aMsgFields,
aBodyType,
aBody,
aIsDraft,
--- a/mailnews/import/test/unit/resources/TestMailImporter.js
+++ b/mailnews/import/test/unit/resources/TestMailImporter.js
@@ -58,29 +58,29 @@ TestMailImpoter.prototype = {
return descriptor;
},
_collectMailboxesInDirectory: function(directory, depth, result) {
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);
if (entry.isDirectory())
this._collectMailboxesInDirectory(entry, depth + 1, result);
}
},
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;
},
ImportMailbox: function(source,
destination,
errorLog,
--- a/mailnews/import/text/src/nsTextImport.cpp
+++ b/mailnews/import/text/src/nsTextImport.cpp
@@ -18,16 +18,17 @@
#include "nscore.h"
#include "nsIServiceManager.h"
#include "nsCOMPtr.h"
#include "nsIImportService.h"
#include "nsMsgI18N.h"
#include "nsIComponentManager.h"
#include "nsTextImport.h"
#include "nsIMemory.h"
+#include "nsIMutableArray.h"
#include "nsIImportGeneric.h"
#include "nsIImportAddressBooks.h"
#include "nsIImportABDescriptor.h"
#include "nsIImportFieldMap.h"
#include "nsIOutputStream.h"
#include "nsIAddrDatabase.h"
#include "nsIAbLDIFService.h"
#include "nsAbBaseCID.h"
@@ -68,17 +69,17 @@ public:
NS_IMETHOD GetSupportsMultiple(bool *_retval) { *_retval = false; return NS_OK;}
NS_IMETHOD GetAutoFind(PRUnichar **description, bool *_retval);
NS_IMETHOD GetNeedsFieldMap(nsIFile *location, bool *_retval);
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);
NS_IMETHOD ImportAddressBook(nsIImportABDescriptor *source,
nsIAddrDatabase *destination,
nsIImportFieldMap *fieldMap,
nsISupports *aSupportService,
PRUnichar **errorLog,
@@ -251,17 +252,17 @@ NS_IMETHODIMP ImportAddressImpl::GetDefa
*ppLoc = nullptr;
*found = false;
*userVerify = true;
return NS_OK;
}
-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");
if (!pLoc || !ppArray)
return NS_ERROR_NULL_POINTER;
ClearSampleFile();
@@ -283,20 +284,19 @@ NS_IMETHODIMP ImportAddressImpl::FindAdd
return rv;
}
m_haveDelim = true;
m_delim = m_text.GetDelim();
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;
}
nsString name;
m_fileLoc->GetLeafName(name);
if (NS_FAILED(rv)) {
IMPORT_LOG0("*** Failed getting leaf name of file\n");
return rv;
@@ -319,27 +319,25 @@ NS_IMETHODIMP ImportAddressImpl::FindAdd
rv = impSvc->CreateNewABDescriptor(getter_AddRefs(desc));
if (NS_SUCCEEDED(rv)) {
int64_t sz = 0;
pLoc->GetFileSize(&sz);
desc->SetPreferredName(name);
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,
nsIStringBundle* pBundle)
{
if (!pStream)
return;
--- a/mailnews/import/vcard/src/nsVCardImport.cpp
+++ b/mailnews/import/vcard/src/nsVCardImport.cpp
@@ -12,16 +12,17 @@
#include "nscore.h"
#include "nsIAddrDatabase.h"
#include "nsIFile.h"
#include "nsIImportABDescriptor.h"
#include "nsIImportAddressBooks.h"
#include "nsIImportFieldMap.h"
#include "nsIImportGeneric.h"
+#include "nsIMutableArray.h"
#include "nsCOMPtr.h"
#include "nsIImportService.h"
#include "nsIFile.h"
#include "nsImportStringBundle.h"
#include "nsMsgUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsTextFormatter.h"
@@ -53,17 +54,17 @@ public:
NS_IMETHOD GetAutoFind(PRUnichar **description, bool *_retval);
NS_IMETHOD GetNeedsFieldMap(nsIFile *location, bool *_retval)
{ *_retval = false; return NS_OK;}
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;}
NS_IMETHOD ImportAddressBook(nsIImportABDescriptor *source,
nsIAddrDatabase *destination,
nsIImportFieldMap *fieldMap,
nsISupports *aSupportService,
@@ -222,17 +223,17 @@ NS_IMETHODIMP ImportVCardAddressImpl::Ge
*ppLoc = nullptr;
*found = false;
*userVerify = true;
return NS_OK;
}
NS_IMETHODIMP ImportVCardAddressImpl::FindAddressBooks(
- nsIFile *pLoc, nsISupportsArray **ppArray)
+ nsIFile *pLoc, nsIArray **ppArray)
{
NS_ENSURE_ARG_POINTER(pLoc);
NS_ENSURE_ARG_POINTER(ppArray);
*ppArray = nullptr;
bool exists = false;
nsresult rv = pLoc->Exists(&exists);
if (NS_FAILED(rv) || !exists)
@@ -241,20 +242,19 @@ NS_IMETHODIMP ImportVCardAddressImpl::Fi
bool isFile = false;
rv = pLoc->IsFile(&isFile);
if (NS_FAILED(rv) || !isFile)
return NS_ERROR_FAILURE;
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;
}
nsString name;
m_fileLoc->GetLeafName(name);
if (NS_FAILED(rv)) {
IMPORT_LOG0("*** Failed getting leaf name of file\n");
return rv;
@@ -276,26 +276,26 @@ NS_IMETHODIMP ImportVCardAddressImpl::Fi
rv = impSvc->CreateNewABDescriptor(getter_AddRefs(desc));
if (NS_SUCCEEDED(rv)) {
int64_t sz = 0;
pLoc->GetFileSize(&sz);
desc->SetPreferredName(name);
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(
nsString& name, nsString *pStream, nsIStringBundle* pBundle)
{
if (!pStream)
return;
--- a/mailnews/import/winlivemail/nsWMImport.cpp
+++ b/mailnews/import/winlivemail/nsWMImport.cpp
@@ -54,18 +54,18 @@ public:
// nsISupports interface
NS_DECL_THREADSAFE_ISUPPORTS
// nsIImportmail interface
/* 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,
PRUnichar **pErrorLog, PRUnichar **pSuccessLog,
bool *fatalError);
/* unsigned long GetImportProgress (); */
NS_IMETHOD GetImportProgress(uint32_t *_retval);
@@ -187,17 +187,17 @@ NS_IMETHODIMP ImportWMMailImpl::Translat
NS_IMETHODIMP ImportWMMailImpl::GetDefaultLocation(nsIFile **ppLoc, bool *found,
bool *userVerify)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP ImportWMMailImpl::FindMailboxes(nsIFile *pLoc,
- nsISupportsArray **ppArray)
+ nsIArray **ppArray)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void ImportWMMailImpl::AddLinebreak(nsString *pStream)
{
if (pStream)
pStream->Append(PRUnichar('\n'));