зеркало из https://github.com/mozilla/pjs.git
Bug 420614 Drop nsAdapterEnumerator. r=Neil,sr=dmose
This commit is contained in:
Родитель
edebfaee2a
Коммит
5913303b05
|
@ -742,7 +742,7 @@ function deleteAllInFolder(commandName)
|
|||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
|
||||
// Delete sub-folders.
|
||||
var iter = folder.GetSubFolders();
|
||||
var iter = folder.subFoldersObsolete;
|
||||
while (true) {
|
||||
try {
|
||||
children.AppendElement(iter.currentItem());
|
||||
|
|
|
@ -446,7 +446,7 @@ function OpenMessageByHeader(messageHeader, openInNewWindow)
|
|||
function SearchForMessageIdInSubFolder(folder, messageId)
|
||||
{
|
||||
var messageHeader;
|
||||
var subFolders = folder.GetSubFolders();
|
||||
var subFolders = folder.subFoldersObsolete;
|
||||
|
||||
// search in folder
|
||||
if (!folder.isServer)
|
||||
|
|
|
@ -357,7 +357,7 @@ var gFeedSubscriptionsWindow = {
|
|||
// if a feed has any sub folders, we should add them to the list of children
|
||||
if (aFolder.hasSubFolders)
|
||||
{
|
||||
var folderEnumerator = aFolder.GetSubFolders();
|
||||
var folderEnumerator = aFolder.subFoldersObsolete;
|
||||
var done = false;
|
||||
|
||||
while (!done)
|
||||
|
@ -432,7 +432,7 @@ var gFeedSubscriptionsWindow = {
|
|||
|
||||
if (this.mRSSServer.rootFolder.hasSubFolders)
|
||||
{
|
||||
var folderEnumerator = this.mRSSServer.rootFolder.GetSubFolders();
|
||||
var folderEnumerator = this.mRSSServer.rootFolder.subFoldersObsolete;
|
||||
var done = false;
|
||||
|
||||
while (!done)
|
||||
|
@ -942,7 +942,7 @@ var gFeedSubscriptionsWindow = {
|
|||
|
||||
generateOutline: function(baseFolder, parent, indentLevel)
|
||||
{
|
||||
var folderEnumerator = baseFolder.GetSubFolders();
|
||||
var folderEnumerator = baseFolder.subFoldersObsolete;
|
||||
var done = false;
|
||||
|
||||
// pretty printing
|
||||
|
|
|
@ -68,7 +68,7 @@ typedef long nsMsgBiffState;
|
|||
// enumerated type for determining if a message has been replied to, forwarded, etc.
|
||||
typedef long nsMsgDispositionState;
|
||||
|
||||
[scriptable, uuid(F80B5683-0891-4cf9-9ED1-11F1C89A5674)]
|
||||
[scriptable, uuid(8e052b65-b073-4b3b-af84-cfe1921c3a0f)]
|
||||
interface nsIMsgFolder : nsICollection {
|
||||
|
||||
const nsMsgBiffState nsMsgBiffState_NewMail = 0; // User has new mail waiting.
|
||||
|
@ -419,7 +419,19 @@ interface nsIMsgFolder : nsICollection {
|
|||
nsISupports getChildNamed(in AString name);
|
||||
attribute nsIMsgFolder parent;
|
||||
|
||||
nsIEnumerator GetSubFolders();
|
||||
// OBSOLETE, don't use this, use subFolders instead, this interface will
|
||||
// be going away soon.
|
||||
[deprecated] readonly attribute nsIEnumerator subFoldersObsolete;
|
||||
|
||||
/**
|
||||
* Returns an enumerator containing a list of nsIMsgFolder items that are
|
||||
* subfolders of the instance this is called on.
|
||||
*/
|
||||
readonly attribute nsISimpleEnumerator subFolders;
|
||||
|
||||
/**
|
||||
* Returns true if this folder has sub folders.
|
||||
*/
|
||||
readonly attribute boolean hasSubFolders;
|
||||
|
||||
void AddFolderListener(in nsIFolderListener listener);
|
||||
|
|
|
@ -750,7 +750,7 @@ function deleteAllInFolder(commandName)
|
|||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
|
||||
// Delete sub-folders.
|
||||
var iter = folder.GetSubFolders();
|
||||
var iter = folder.subFoldersObsolete;
|
||||
while (true) {
|
||||
try {
|
||||
children.AppendElement(iter.currentItem());
|
||||
|
|
|
@ -734,7 +734,7 @@ function OpenMessageByHeader(messageHeader, openInNewWindow)
|
|||
function SearchForMessageIdInSubFolder(folder, messageId)
|
||||
{
|
||||
var messageHeader;
|
||||
var subFolders = folder.GetSubFolders();
|
||||
var subFolders = folder.subFoldersObsolete;
|
||||
|
||||
// search in folder
|
||||
if (!folder.isServer)
|
||||
|
|
|
@ -96,7 +96,7 @@ function compareFolderSortKey(folder1, folder2)
|
|||
|
||||
function GetSubFoldersInFolderPaneOrder(folder)
|
||||
{
|
||||
var subFolderEnumerator = folder.GetSubFolders();
|
||||
var subFolderEnumerator = folder.subFoldersObsolete;
|
||||
var done = false;
|
||||
var msgFolders = Array();
|
||||
|
||||
|
|
|
@ -439,7 +439,7 @@ function onSearch()
|
|||
function AddSubFolders(folder) {
|
||||
if (folder.hasSubFolders)
|
||||
{
|
||||
var subFolderEnumerator = folder.GetSubFolders();
|
||||
var subFolderEnumerator = folder.subFoldersObsolete;
|
||||
var done = false;
|
||||
while (!done)
|
||||
{
|
||||
|
@ -471,7 +471,7 @@ function AddSubFoldersToURI(folder)
|
|||
var returnString = "";
|
||||
if (folder.hasSubFolders)
|
||||
{
|
||||
var subFolderEnumerator = folder.GetSubFolders();
|
||||
var subFolderEnumerator = folder.subFoldersObsolete;
|
||||
var done = false;
|
||||
while (!done)
|
||||
{
|
||||
|
|
|
@ -254,7 +254,7 @@ nsresult nsMessengerBootstrap::DiscoverFoldersIfNeeded(nsIMsgFolder *folder)
|
|||
folder->GetServer(getter_AddRefs(server));
|
||||
nsresult rv = server->GetRootFolder(getter_AddRefs(parent));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
parent->GetSubFolders(getter_AddRefs(enumerator));
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
@ -929,7 +929,7 @@ hashCleanupOnExit(nsCStringHashKey::KeyType aKey, nsCOMPtr<nsIMsgIncomingServer>
|
|||
if (isImap && cleanupInboxOnExit)
|
||||
{
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
folder->GetSubFolders(getter_AddRefs(enumerator));
|
||||
folder->GetSubFoldersObsolete(getter_AddRefs(enumerator));
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
rv = enumerator->First();
|
||||
while (NS_SUCCEEDED(rv))
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include "nsRDFCID.h"
|
||||
#include "nsIRDFNode.h"
|
||||
#include "nsEnumeratorUtils.h"
|
||||
#include "nsAdapterEnumerator.h"
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
@ -452,18 +451,7 @@ NS_IMETHODIMP nsMsgFolderDataSource::GetTargets(nsIRDFResource* source,
|
|||
{
|
||||
if ((kNC_Child == property))
|
||||
{
|
||||
nsCOMPtr<nsIEnumerator> subFolders;
|
||||
rv = folder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsAdapterEnumerator* cursor =
|
||||
new nsAdapterEnumerator(subFolders);
|
||||
if (cursor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(cursor);
|
||||
*targets = cursor;
|
||||
rv = NS_OK;
|
||||
}
|
||||
rv = folder->GetSubFolders(targets);
|
||||
}
|
||||
else if ((kNC_Name == property) ||
|
||||
(kNC_Open == property) ||
|
||||
|
@ -1372,7 +1360,7 @@ nsMsgFolderDataSource::createFolderOpenNode(nsIMsgFolder *folder, nsIRDFNode **t
|
|||
|
||||
// call GetSubFolders() to ensure mFlags is set correctly
|
||||
// from the folder cache on startup
|
||||
nsCOMPtr<nsIEnumerator> subFolders;
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
nsresult rv = folder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
if (NS_FAILED(rv))
|
||||
return NS_RDF_NO_VALUE;
|
||||
|
@ -1896,7 +1884,7 @@ nsMsgFolderDataSource::createFolderChildNode(nsIMsgFolder *folder,
|
|||
nsIRDFNode **target)
|
||||
{
|
||||
nsCOMPtr<nsIEnumerator> subFolders;
|
||||
nsresult rv = folder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
nsresult rv = folder->GetSubFoldersObsolete(getter_AddRefs(subFolders));
|
||||
if (NS_FAILED(rv))
|
||||
return NS_RDF_NO_VALUE;
|
||||
|
||||
|
@ -2256,7 +2244,7 @@ NS_IMETHODIMP nsMsgFlatFolderDataSource::GetTargets(nsIRDFResource* source,
|
|||
server->GetRootFolder(getter_AddRefs(rootFolder));
|
||||
if (rootFolder)
|
||||
{
|
||||
nsCOMPtr<nsIEnumerator> subFolders;
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
rv = rootFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
|
||||
PRUint32 lastEntry;
|
||||
|
@ -2462,7 +2450,7 @@ PRBool nsMsgRecentFoldersDataSource::WantsThisFolder(nsIMsgFolder *folder)
|
|||
server->GetRootFolder(getter_AddRefs(rootFolder));
|
||||
if (rootFolder)
|
||||
{
|
||||
nsCOMPtr<nsIEnumerator> subFolders;
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
rv = rootFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
|
||||
PRUint32 lastEntry;
|
||||
|
|
|
@ -100,7 +100,6 @@ CPPSRCS = \
|
|||
nsMsgMailNewsUrl.cpp \
|
||||
nsMsgTxn.cpp \
|
||||
nsMsgI18N.cpp \
|
||||
nsAdapterEnumerator.cpp \
|
||||
nsImapMoveCoalescer.cpp \
|
||||
nsMsgFileStream.cpp \
|
||||
$(NULL)
|
||||
|
@ -116,7 +115,6 @@ EXPORTS = \
|
|||
nsMsgMailNewsUrl.h \
|
||||
nsMsgTxn.h \
|
||||
nsMsgI18N.h \
|
||||
nsAdapterEnumerator.h \
|
||||
nsImapMoveCoalescer.h \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -1135,7 +1135,7 @@ NS_IMETHODIMP nsMsgDBFolder::WriteToFolderCache(nsIMsgFolderCache *folderCache,
|
|||
if (!deep)
|
||||
return rv;
|
||||
|
||||
rv = GetSubFolders(getter_AddRefs(aEnumerator));
|
||||
rv = GetSubFoldersObsolete(getter_AddRefs(aEnumerator));
|
||||
if(NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -2258,11 +2258,17 @@ typedef PRBool
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBFolder::GetSubFolders(nsIEnumerator* *result)
|
||||
nsMsgDBFolder::GetSubFoldersObsolete(nsIEnumerator* *result)
|
||||
{
|
||||
return mSubFolders->Enumerate(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBFolder::GetSubFolders(nsISimpleEnumerator **aResult)
|
||||
{
|
||||
return NS_NewArrayEnumerator(aResult, mSubFolders);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBFolder::FindSubFolder(const nsACString& aEscapedSubFolderName, nsIMsgFolder **aFolder)
|
||||
{
|
||||
|
@ -2784,7 +2790,7 @@ NS_IMETHODIMP nsMsgDBFolder::GetChildWithURI(const nsACString& uri, PRBool deep,
|
|||
// will return nsnull if we can't find it
|
||||
*child = nsnull;
|
||||
nsCOMPtr <nsIEnumerator> enumerator;
|
||||
nsresult rv = GetSubFolders(getter_AddRefs(enumerator));
|
||||
nsresult rv = GetSubFoldersObsolete(getter_AddRefs(enumerator));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -3104,7 +3110,7 @@ nsMsgDBFolder::CheckIfFolderExists(const nsAString& newFolderName, nsIMsgFolder
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(parentFolder);
|
||||
nsCOMPtr<nsIEnumerator> subfolders;
|
||||
nsresult rv = parentFolder->GetSubFolders(getter_AddRefs(subfolders));
|
||||
nsresult rv = parentFolder->GetSubFoldersObsolete(getter_AddRefs(subfolders));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = subfolders->First(); //will fail if no subfolders
|
||||
while (NS_SUCCEEDED(rv))
|
||||
|
@ -3652,7 +3658,7 @@ nsresult nsMsgDBFolder::ListFoldersWithFlag(PRUint32 flag, nsISupportsArray *arr
|
|||
|
||||
// call GetSubFolders() to ensure that mSubFolders is initialized
|
||||
nsCOMPtr <nsIEnumerator> enumerator;
|
||||
rv = GetSubFolders(getter_AddRefs(enumerator));
|
||||
rv = GetSubFoldersObsolete(getter_AddRefs(enumerator));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mSubFolders->Count(&cnt);
|
||||
|
@ -3690,7 +3696,7 @@ NS_IMETHODIMP nsMsgDBFolder::GetFoldersWithFlag(PRUint32 flags, PRUint32 results
|
|||
|
||||
// call GetSubFolders() to ensure that mSubFolders is initialized
|
||||
nsCOMPtr <nsIEnumerator> enumerator;
|
||||
rv = GetSubFolders(getter_AddRefs(enumerator));
|
||||
rv = GetSubFoldersObsolete(getter_AddRefs(enumerator));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mSubFolders->Count(&cnt);
|
||||
|
|
|
@ -1573,20 +1573,17 @@ nsresult nsImapIncomingServer::DeleteNonVerifiedFolders(nsIMsgFolder *curFolder)
|
|||
if (NS_SUCCEEDED(rv))
|
||||
prefBranch->GetBoolPref("mail.imap.auto_unsubscribe_from_noselect_folders", &autoUnsubscribeFromNoSelectFolders);
|
||||
|
||||
nsCOMPtr<nsIEnumerator> subFolders;
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
|
||||
rv = curFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsAdapterEnumerator *simpleEnumerator = new nsAdapterEnumerator(subFolders);
|
||||
if (simpleEnumerator == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
PRBool moreFolders;
|
||||
|
||||
while (NS_SUCCEEDED(simpleEnumerator->HasMoreElements(&moreFolders)) && moreFolders)
|
||||
while (NS_SUCCEEDED(subFolders->HasMoreElements(&moreFolders)) && moreFolders)
|
||||
{
|
||||
nsCOMPtr<nsISupports> child;
|
||||
rv = simpleEnumerator->GetNext(getter_AddRefs(child));
|
||||
rv = subFolders->GetNext(getter_AddRefs(child));
|
||||
if (NS_SUCCEEDED(rv) && child)
|
||||
{
|
||||
PRBool childVerified = PR_FALSE;
|
||||
|
@ -1620,7 +1617,6 @@ nsresult nsImapIncomingServer::DeleteNonVerifiedFolders(nsIMsgFolder *curFolder)
|
|||
}
|
||||
}
|
||||
}
|
||||
delete simpleEnumerator;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> parent;
|
||||
|
@ -1639,19 +1635,16 @@ nsresult nsImapIncomingServer::DeleteNonVerifiedFolders(nsIMsgFolder *curFolder)
|
|||
PRBool nsImapIncomingServer::NoDescendentsAreVerified(nsIMsgFolder *parentFolder)
|
||||
{
|
||||
PRBool nobodyIsVerified = PR_TRUE;
|
||||
nsCOMPtr<nsIEnumerator> subFolders;
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
nsresult rv = parentFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsAdapterEnumerator *simpleEnumerator = new nsAdapterEnumerator(subFolders);
|
||||
if (simpleEnumerator == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PRBool moreFolders;
|
||||
while (NS_SUCCEEDED(simpleEnumerator->HasMoreElements(&moreFolders)) && moreFolders && nobodyIsVerified)
|
||||
while (NS_SUCCEEDED(subFolders->HasMoreElements(&moreFolders)) &&
|
||||
moreFolders && nobodyIsVerified)
|
||||
{
|
||||
nsCOMPtr<nsISupports> child;
|
||||
rv = simpleEnumerator->GetNext(getter_AddRefs(child));
|
||||
rv = subFolders->GetNext(getter_AddRefs(child));
|
||||
if (NS_SUCCEEDED(rv) && child)
|
||||
{
|
||||
PRBool childVerified = PR_FALSE;
|
||||
|
@ -1664,7 +1657,6 @@ PRBool nsImapIncomingServer::NoDescendentsAreVerified(nsIMsgFolder *parentFolder
|
|||
}
|
||||
}
|
||||
}
|
||||
delete simpleEnumerator;
|
||||
}
|
||||
return nobodyIsVerified;
|
||||
}
|
||||
|
@ -1673,19 +1665,16 @@ PRBool nsImapIncomingServer::NoDescendentsAreVerified(nsIMsgFolder *parentFolder
|
|||
PRBool nsImapIncomingServer::AllDescendentsAreNoSelect(nsIMsgFolder *parentFolder)
|
||||
{
|
||||
PRBool allDescendentsAreNoSelect = PR_TRUE;
|
||||
nsCOMPtr<nsIEnumerator> subFolders;
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
nsresult rv = parentFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsAdapterEnumerator *simpleEnumerator = new nsAdapterEnumerator(subFolders);
|
||||
if (simpleEnumerator == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PRBool moreFolders;
|
||||
while (NS_SUCCEEDED(simpleEnumerator->HasMoreElements(&moreFolders)) && moreFolders && allDescendentsAreNoSelect)
|
||||
while (NS_SUCCEEDED(subFolders->HasMoreElements(&moreFolders)) &&
|
||||
moreFolders && allDescendentsAreNoSelect)
|
||||
{
|
||||
nsCOMPtr<nsISupports> child;
|
||||
rv = simpleEnumerator->GetNext(getter_AddRefs(child));
|
||||
rv = subFolders->GetNext(getter_AddRefs(child));
|
||||
if (NS_SUCCEEDED(rv) && child)
|
||||
{
|
||||
PRBool childIsNoSelect = PR_FALSE;
|
||||
|
@ -1700,7 +1689,6 @@ PRBool nsImapIncomingServer::AllDescendentsAreNoSelect(nsIMsgFolder *parentFolde
|
|||
}
|
||||
}
|
||||
}
|
||||
delete simpleEnumerator;
|
||||
}
|
||||
#if 0
|
||||
int numberOfSubfolders = parentFolder->GetNumSubFolders();
|
||||
|
@ -1868,19 +1856,18 @@ nsresult nsImapIncomingServer::ResetFoldersToUnverified(nsIMsgFolder *parentFold
|
|||
}
|
||||
else
|
||||
{
|
||||
nsCOMPtr<nsIEnumerator> subFolders;
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
nsCOMPtr<nsIMsgImapMailFolder> imapFolder = do_QueryInterface(parentFolder, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = imapFolder->SetVerifiedAsOnlineFolder(PR_FALSE);
|
||||
rv = parentFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsAdapterEnumerator *simpleEnumerator = new nsAdapterEnumerator(subFolders);
|
||||
NS_ENSURE_TRUE(simpleEnumerator, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
PRBool moreFolders = PR_FALSE;
|
||||
while (NS_SUCCEEDED(simpleEnumerator->HasMoreElements(&moreFolders)) && moreFolders)
|
||||
while (NS_SUCCEEDED(subFolders->HasMoreElements(&moreFolders)) && moreFolders)
|
||||
{
|
||||
nsCOMPtr<nsISupports> child;
|
||||
rv = simpleEnumerator->GetNext(getter_AddRefs(child));
|
||||
rv = subFolders->GetNext(getter_AddRefs(child));
|
||||
if (NS_SUCCEEDED(rv) && child)
|
||||
{
|
||||
nsCOMPtr<nsIMsgFolder> childFolder = do_QueryInterface(child, &rv);
|
||||
|
@ -1892,7 +1879,6 @@ nsresult nsImapIncomingServer::ResetFoldersToUnverified(nsIMsgFolder *parentFold
|
|||
}
|
||||
}
|
||||
}
|
||||
delete simpleEnumerator;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -1942,20 +1928,17 @@ nsresult nsImapIncomingServer::GetUnverifiedSubFolders(nsIMsgFolder *parentFolde
|
|||
(*aNumUnverifiedFolders)++;
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIEnumerator> subFolders;
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
rv = parentFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsAdapterEnumerator *simpleEnumerator = new nsAdapterEnumerator(subFolders);
|
||||
if (!simpleEnumerator)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
PRBool moreFolders;
|
||||
|
||||
while (NS_SUCCEEDED(simpleEnumerator->HasMoreElements(&moreFolders)) && moreFolders)
|
||||
while (NS_SUCCEEDED(subFolders->HasMoreElements(&moreFolders)) && moreFolders)
|
||||
{
|
||||
nsCOMPtr<nsISupports> child;
|
||||
rv = simpleEnumerator->GetNext(getter_AddRefs(child));
|
||||
rv = subFolders->GetNext(getter_AddRefs(child));
|
||||
if (NS_SUCCEEDED(rv) && child)
|
||||
{
|
||||
nsCOMPtr <nsIMsgFolder> childFolder = do_QueryInterface(child, &rv);
|
||||
|
@ -1967,7 +1950,6 @@ nsresult nsImapIncomingServer::GetUnverifiedSubFolders(nsIMsgFolder *parentFolde
|
|||
}
|
||||
}
|
||||
}
|
||||
delete simpleEnumerator;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -2851,22 +2833,22 @@ nsImapIncomingServer::GetNewMessagesForNonInboxFolders(nsIMsgFolder *aFolder,
|
|||
}
|
||||
|
||||
// Loop through all subfolders to get new messages for them.
|
||||
nsCOMPtr<nsIEnumerator> aEnumerator;
|
||||
retval = aFolder->GetSubFolders(getter_AddRefs(aEnumerator));
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
retval = aFolder->GetSubFoldersObsolete(getter_AddRefs(enumerator));
|
||||
if (NS_FAILED(retval))
|
||||
return retval;
|
||||
|
||||
nsresult more = aEnumerator->First();
|
||||
nsresult more = enumerator->First();
|
||||
|
||||
while (NS_SUCCEEDED(more))
|
||||
{
|
||||
nsCOMPtr<nsISupports> aSupport;
|
||||
nsresult rv = aEnumerator->CurrentItem(getter_AddRefs(aSupport));
|
||||
nsresult rv = enumerator->CurrentItem(getter_AddRefs(aSupport));
|
||||
NS_ASSERTION((NS_SUCCEEDED(rv) && aSupport), "CurrentItem() failed.");
|
||||
nsCOMPtr<nsIMsgFolder> msgFolder = do_QueryInterface(aSupport, &rv);
|
||||
NS_ASSERTION((NS_SUCCEEDED(rv) && msgFolder), "nsIMsgFolder service not found.");
|
||||
retval = GetNewMessagesForNonInboxFolders(msgFolder, aWindow, forceAllFolders, performingBiff);
|
||||
more = aEnumerator->Next();
|
||||
more = enumerator->Next();
|
||||
}
|
||||
|
||||
if (isServer)
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "nsIStringBundle.h"
|
||||
#include "nsISubscribableServer.h"
|
||||
#include "nsIUrlListener.h"
|
||||
#include "nsAdapterEnumerator.h"
|
||||
#include "nsIMsgImapMailFolder.h"
|
||||
#include "nsCOMArray.h"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -569,10 +569,13 @@ nsresult nsImapMailFolder::CreateSubFolders(nsILocalFile *path)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::GetSubFolders(nsIEnumerator* *result)
|
||||
// XXX When GetSubFoldersObsolete goes away (bug 420614), this can be merged
|
||||
// into GetSubFolders (see also note at return statement).
|
||||
nsresult nsImapMailFolder::GetSubFoldersMain()
|
||||
{
|
||||
PRBool isServer;
|
||||
nsresult rv = GetIsServer(&isServer);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!m_initialized)
|
||||
{
|
||||
|
@ -616,7 +619,28 @@ NS_IMETHODIMP nsImapMailFolder::GetSubFolders(nsIEnumerator* *result)
|
|||
UpdateSummaryTotals(PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
return mSubFolders->Enumerate(result);
|
||||
// XXX When GetSubFoldersObsolete goes away, this return can be replaced by:
|
||||
// return NS_NewArrayEnumerator(aResult, mSubFolders);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::GetSubFolders(nsISimpleEnumerator **aResult)
|
||||
{
|
||||
nsresult rv = GetSubFoldersMain();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return NS_NewArrayEnumerator(aResult, mSubFolders);
|
||||
}
|
||||
|
||||
// XXX GetSubFoldersObsolete will be going away soon (bug 420614)
|
||||
NS_IMETHODIMP nsImapMailFolder::GetSubFoldersObsolete(nsIEnumerator **aResult)
|
||||
{
|
||||
nsresult rv = GetSubFoldersMain();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return mSubFolders->Enumerate(aResult);
|
||||
}
|
||||
|
||||
//Makes sure the database is open and exists. If the database is valid then
|
||||
|
@ -1285,12 +1309,12 @@ NS_IMETHODIMP nsImapMailFolder::EmptyTrash(nsIMsgWindow *aMsgWindow, nsIUrlListe
|
|||
rv = trashFolder->GetHasSubFolders(&hasSubfolders);
|
||||
if (hasSubfolders)
|
||||
{
|
||||
nsCOMPtr<nsIEnumerator> aEnumerator;
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
nsCOMPtr<nsISupports> aSupport;
|
||||
nsCOMPtr<nsIMsgFolder> aFolder;
|
||||
nsCOMPtr<nsISupportsArray> aSupportsArray = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
NS_ENSURE_TRUE(aSupportsArray, rv);
|
||||
rv = trashFolder->GetSubFolders(getter_AddRefs(aEnumerator));
|
||||
rv = trashFolder->GetSubFoldersObsolete(getter_AddRefs(enumerator));
|
||||
PRBool confirmDeletion;
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -1311,11 +1335,11 @@ NS_IMETHODIMP nsImapMailFolder::EmptyTrash(nsIMsgWindow *aMsgWindow, nsIUrlListe
|
|||
}
|
||||
rv = IMAPGetStringBundle(getter_AddRefs(bundle));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aEnumerator->First();
|
||||
rv = enumerator->First();
|
||||
while(NS_SUCCEEDED(rv))
|
||||
{
|
||||
PRInt32 dlgResult = -1;
|
||||
rv = aEnumerator->CurrentItem(getter_AddRefs(aSupport));
|
||||
rv = enumerator->CurrentItem(getter_AddRefs(aSupport));
|
||||
if (confirmDeletion)
|
||||
{
|
||||
nsString confirmText;
|
||||
|
@ -1336,7 +1360,7 @@ NS_IMETHODIMP nsImapMailFolder::EmptyTrash(nsIMsgWindow *aMsgWindow, nsIUrlListe
|
|||
{
|
||||
if (dlgResult == 1)
|
||||
return NS_BINDING_ABORTED;
|
||||
rv = aEnumerator->Next();
|
||||
rv = enumerator->Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1354,18 +1378,18 @@ NS_IMETHODIMP nsImapMailFolder::EmptyTrash(nsIMsgWindow *aMsgWindow, nsIUrlListe
|
|||
return rv;
|
||||
if (hasSubfolders)
|
||||
{
|
||||
nsCOMPtr<nsIEnumerator> aEnumerator;
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
nsCOMPtr<nsISupports> aSupport;
|
||||
nsCOMPtr<nsIMsgFolder> aFolder;
|
||||
nsCOMPtr<nsISupportsArray> aSupportsArray = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
NS_ENSURE_TRUE(aSupportsArray, rv);
|
||||
rv = trashFolder->GetSubFolders(getter_AddRefs(aEnumerator));
|
||||
rv = aEnumerator->First();
|
||||
rv = trashFolder->GetSubFoldersObsolete(getter_AddRefs(enumerator));
|
||||
rv = enumerator->First();
|
||||
while(NS_SUCCEEDED(rv))
|
||||
{
|
||||
aEnumerator->CurrentItem(getter_AddRefs(aSupport));
|
||||
enumerator->CurrentItem(getter_AddRefs(aSupport));
|
||||
aSupportsArray->AppendElement(aSupport);
|
||||
rv = aEnumerator->Next();
|
||||
rv = enumerator->Next();
|
||||
}
|
||||
PRUint32 cnt = 0;
|
||||
aSupportsArray->Count(&cnt);
|
||||
|
@ -2000,7 +2024,6 @@ NS_IMETHODIMP nsImapMailFolder::DeleteMessages(nsISupportsArray *messages,
|
|||
PRBool allowUndo)
|
||||
{
|
||||
// *** jt - assuming delete is move to the trash folder for now
|
||||
nsCOMPtr<nsIEnumerator> aEnumerator;
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
nsCAutoString uri;
|
||||
PRBool deleteImmediatelyNoTrash = PR_FALSE;
|
||||
|
@ -7072,19 +7095,19 @@ NS_IMETHODIMP nsImapMailFolder::ResetNamespaceReferences()
|
|||
m_folderIsNamespace = m_namespace ? nsIMAPNamespaceList::GetFolderIsNamespace(serverKey.get(), onlineName.get(),
|
||||
(char) hierarchyDelimiter, m_namespace) : PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIEnumerator> aEnumerator;
|
||||
GetSubFolders(getter_AddRefs(aEnumerator));
|
||||
if (!aEnumerator)
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
GetSubFoldersObsolete(getter_AddRefs(enumerator));
|
||||
if (!enumerator)
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsISupports> aSupport;
|
||||
nsresult rv = aEnumerator->First();
|
||||
nsresult rv = enumerator->First();
|
||||
while (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = aEnumerator->CurrentItem(getter_AddRefs(aSupport));
|
||||
rv = enumerator->CurrentItem(getter_AddRefs(aSupport));
|
||||
nsCOMPtr<nsIMsgImapMailFolder> folder = do_QueryInterface(aSupport, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
folder->ResetNamespaceReferences();
|
||||
rv = aEnumerator->Next();
|
||||
rv = enumerator->Next();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -7098,21 +7121,21 @@ NS_IMETHODIMP nsImapMailFolder::FindOnlineSubFolder(const nsACString& targetOnli
|
|||
|
||||
if (onlineName.Equals(targetOnlineName))
|
||||
return QueryInterface(NS_GET_IID(nsIMsgImapMailFolder), (void **) aResultFolder);
|
||||
nsCOMPtr<nsIEnumerator> aEnumerator;
|
||||
GetSubFolders(getter_AddRefs(aEnumerator));
|
||||
if (!aEnumerator)
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
GetSubFoldersObsolete(getter_AddRefs(enumerator));
|
||||
if (!enumerator)
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsISupports> aSupport;
|
||||
rv = aEnumerator->First();
|
||||
rv = enumerator->First();
|
||||
while (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = aEnumerator->CurrentItem(getter_AddRefs(aSupport));
|
||||
rv = enumerator->CurrentItem(getter_AddRefs(aSupport));
|
||||
nsCOMPtr<nsIMsgImapMailFolder> folder = do_QueryInterface(aSupport, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = folder->FindOnlineSubFolder(targetOnlineName, aResultFolder);
|
||||
if (*aResultFolder)
|
||||
return rv;
|
||||
rv = aEnumerator->Next();
|
||||
rv = enumerator->Next();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -7298,13 +7321,13 @@ NS_IMETHODIMP nsImapMailFolder::RenameSubFolders(nsIMsgWindow *msgWindow, nsIMsg
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
m_initialized = PR_TRUE;
|
||||
nsCOMPtr<nsIEnumerator> aEnumerator;
|
||||
oldFolder->GetSubFolders(getter_AddRefs(aEnumerator));
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
oldFolder->GetSubFoldersObsolete(getter_AddRefs(enumerator));
|
||||
nsCOMPtr<nsISupports> aSupport;
|
||||
rv = aEnumerator->First();
|
||||
rv = enumerator->First();
|
||||
while (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = aEnumerator->CurrentItem(getter_AddRefs(aSupport));
|
||||
rv = enumerator->CurrentItem(getter_AddRefs(aSupport));
|
||||
|
||||
nsCOMPtr<nsIMsgFolder>msgFolder = do_QueryInterface(aSupport);
|
||||
nsCOMPtr<nsIMsgImapMailFolder> folder = do_QueryInterface(msgFolder, &rv);
|
||||
|
@ -7378,7 +7401,7 @@ NS_IMETHODIMP nsImapMailFolder::RenameSubFolders(nsIMsgWindow *msgWindow, nsIMsg
|
|||
msgFolder->AlertFilterChanged(msgWindow);
|
||||
child->RenameSubFolders(msgWindow, msgFolder);
|
||||
}
|
||||
rv = aEnumerator->Next();
|
||||
rv = enumerator->Next();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -213,7 +213,8 @@ public:
|
|||
NS_IMETHOD Enumerate(nsIEnumerator **result);
|
||||
|
||||
// nsIMsgFolder methods:
|
||||
NS_IMETHOD GetSubFolders(nsIEnumerator* *result);
|
||||
NS_IMETHOD GetSubFolders(nsISimpleEnumerator **aResult);
|
||||
NS_IMETHOD GetSubFoldersObsolete(nsIEnumerator* *result);
|
||||
|
||||
NS_IMETHOD GetMessages(nsIMsgWindow *aMsgWindow, nsISimpleEnumerator* *result);
|
||||
NS_IMETHOD UpdateFolder(nsIMsgWindow *aWindow);
|
||||
|
@ -329,6 +330,9 @@ public:
|
|||
nsresult SetSupportedUserFlags(PRUint32 userFlags);
|
||||
nsresult GetSupportedUserFlags(PRUint32 *userFlags);
|
||||
protected:
|
||||
// XXX Bug 420614 Temporary function.
|
||||
nsresult GetSubFoldersMain();
|
||||
|
||||
// Helper methods
|
||||
|
||||
void FindKeysToAdd(const nsTArray<nsMsgKey> &existingKeys, nsTArray<nsMsgKey>
|
||||
|
|
|
@ -367,8 +367,8 @@ nsresult nsEudoraFilters::Init()
|
|||
|
||||
// we need to call GetSubFolders() so that the folders get initialized
|
||||
// if they are not initialized yet.
|
||||
nsCOMPtr <nsIEnumerator> aEnumerator;
|
||||
rv = localRootFolder->GetSubFolders(getter_AddRefs(aEnumerator));
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
rv = localRootFolder->GetSubFolders(getter_AddRefs(enumerator));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsISupports> subFolder;
|
||||
|
|
|
@ -757,7 +757,7 @@ ImportMailThread( void *stuff)
|
|||
nsCOMPtr<nsIMsgFolder> newFolder;
|
||||
nsCOMPtr<nsILocalFile> outBox;
|
||||
nsCOMPtr<nsISupports> subFolder;
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
|
||||
PRBool exists;
|
||||
|
||||
|
@ -1042,7 +1042,7 @@ PRBool nsImportGenericMail::CreateFolder( nsIMsgFolder **ppFolder)
|
|||
if (localRootFolder) {
|
||||
// we need to call GetSubFolders() so that the folders get initialized
|
||||
// if they are not initialized yet.
|
||||
nsCOMPtr <nsIEnumerator> aEnumerator;
|
||||
nsCOMPtr<nsISimpleEnumerator> aEnumerator;
|
||||
rv = localRootFolder->GetSubFolders(getter_AddRefs(aEnumerator));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// check if the folder name we picked already exists.
|
||||
|
|
|
@ -344,8 +344,10 @@ nsMsgLocalMailFolder::Enumerate(nsIEnumerator* *result)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgLocalMailFolder::GetSubFolders(nsIEnumerator* *result)
|
||||
// XXX When GetSubFoldersObsolete goes away (bug 420614), this can be merged
|
||||
// into GetSubFolders.
|
||||
nsresult
|
||||
nsMsgLocalMailFolder::GetSubFoldersMain()
|
||||
{
|
||||
PRBool isServer;
|
||||
nsresult rv = GetIsServer(&isServer);
|
||||
|
@ -418,7 +420,7 @@ nsMsgLocalMailFolder::GetSubFolders(nsIEnumerator* *result)
|
|||
rv = mSubFolders->Count(&cnt);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
for (PRUint32 i = 0; i < cnt; i++)
|
||||
{
|
||||
nsCOMPtr<nsIMsgFolder> folder = do_QueryElementAt(mSubFolders, i, &rv);
|
||||
|
@ -432,6 +434,27 @@ nsMsgLocalMailFolder::GetSubFolders(nsIEnumerator* *result)
|
|||
}
|
||||
UpdateSummaryTotals(PR_FALSE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgLocalMailFolder::GetSubFolders(nsISimpleEnumerator **aResult)
|
||||
{
|
||||
nsresult rv = GetSubFoldersMain();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return NS_NewArrayEnumerator(aResult, mSubFolders);
|
||||
}
|
||||
|
||||
// XXX GetSubFoldersObsolete will be going away soon (bug 420614)
|
||||
NS_IMETHODIMP
|
||||
nsMsgLocalMailFolder::GetSubFoldersObsolete(nsIEnumerator* *result)
|
||||
{
|
||||
nsresult rv = GetSubFoldersMain();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return mSubFolders->Enumerate(result);
|
||||
}
|
||||
|
||||
|
@ -862,10 +885,10 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EmptyTrash(nsIMsgWindow *msgWindow,
|
|||
|
||||
if (totalMessages <= 0)
|
||||
{
|
||||
nsCOMPtr<nsIEnumerator> aEnumerator;
|
||||
rv =trashFolder->GetSubFolders(getter_AddRefs(aEnumerator));
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
rv = trashFolder->GetSubFoldersObsolete(getter_AddRefs(enumerator));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = aEnumerator->First(); //will fail if no subfolders
|
||||
rv = enumerator->First(); //will fail if no subfolders
|
||||
if (NS_FAILED(rv))
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1166,13 +1189,13 @@ NS_IMETHODIMP nsMsgLocalMailFolder::RenameSubFolders(nsIMsgWindow *msgWindow, ns
|
|||
oldFolder->GetFlags(&flags);
|
||||
SetFlags(flags);
|
||||
|
||||
nsCOMPtr<nsIEnumerator> aEnumerator;
|
||||
oldFolder->GetSubFolders(getter_AddRefs(aEnumerator));
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
oldFolder->GetSubFoldersObsolete(getter_AddRefs(enumerator));
|
||||
nsCOMPtr<nsISupports> aSupport;
|
||||
rv = aEnumerator->First();
|
||||
rv = enumerator->First();
|
||||
while (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = aEnumerator->CurrentItem(getter_AddRefs(aSupport));
|
||||
rv = enumerator->CurrentItem(getter_AddRefs(aSupport));
|
||||
nsCOMPtr<nsIMsgFolder>msgFolder = do_QueryInterface(aSupport);
|
||||
nsString folderName;
|
||||
rv = msgFolder->GetName(folderName);
|
||||
|
@ -1187,7 +1210,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::RenameSubFolders(nsIMsgWindow *msgWindow, ns
|
|||
msgFolder->AlertFilterChanged(msgWindow);
|
||||
newFolder->RenameSubFolders(msgWindow, msgFolder);
|
||||
}
|
||||
rv = aEnumerator->Next();
|
||||
rv = enumerator->Next();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1785,16 +1808,16 @@ nsMsgLocalMailFolder::CopyAllSubFolders(nsIMsgFolder *srcFolder,
|
|||
nsIMsgCopyServiceListener *listener )
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIEnumerator> aEnumerator;
|
||||
srcFolder->GetSubFolders(getter_AddRefs(aEnumerator));
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
srcFolder->GetSubFoldersObsolete(getter_AddRefs(enumerator));
|
||||
nsCOMPtr<nsIMsgFolder>folder;
|
||||
nsCOMPtr<nsISupports> aSupports;
|
||||
rv = aEnumerator->First();
|
||||
rv = enumerator->First();
|
||||
while (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = aEnumerator->CurrentItem(getter_AddRefs(aSupports));
|
||||
rv = enumerator->CurrentItem(getter_AddRefs(aSupports));
|
||||
folder = do_QueryInterface(aSupports);
|
||||
rv = aEnumerator->Next();
|
||||
rv = enumerator->Next();
|
||||
if (folder)
|
||||
CopyFolderAcrossServer(folder, msgWindow, listener);
|
||||
}
|
||||
|
@ -1935,17 +1958,17 @@ nsMsgLocalMailFolder::CopyFolderLocal(nsIMsgFolder *srcFolder,
|
|||
if (changed)
|
||||
srcFolder->AlertFilterChanged(msgWindow);
|
||||
|
||||
nsCOMPtr<nsIEnumerator> aEnumerator;
|
||||
srcFolder->GetSubFolders(getter_AddRefs(aEnumerator));
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
srcFolder->GetSubFoldersObsolete(getter_AddRefs(enumerator));
|
||||
nsCOMPtr<nsIMsgFolder>folder;
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
rv = aEnumerator->First();
|
||||
rv = enumerator->First();
|
||||
nsresult copyStatus = NS_OK;
|
||||
while (NS_SUCCEEDED(rv) && NS_SUCCEEDED(copyStatus))
|
||||
{
|
||||
rv = aEnumerator->CurrentItem(getter_AddRefs(supports));
|
||||
rv = enumerator->CurrentItem(getter_AddRefs(supports));
|
||||
folder = do_QueryInterface(supports);
|
||||
rv = aEnumerator->Next();
|
||||
rv = enumerator->Next();
|
||||
if (folder)
|
||||
{
|
||||
nsCOMPtr <nsIMsgLocalMailFolder> localFolder = do_QueryInterface(newMsgFolder);
|
||||
|
|
|
@ -132,7 +132,8 @@ public:
|
|||
NS_IMETHOD OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode);
|
||||
|
||||
// nsIMsgFolder methods:
|
||||
NS_IMETHOD GetSubFolders(nsIEnumerator* *result);
|
||||
NS_IMETHOD GetSubFolders(nsISimpleEnumerator* *aResult);
|
||||
NS_IMETHOD GetSubFoldersObsolete(nsIEnumerator* *result);
|
||||
NS_IMETHOD GetMsgDatabase(nsIMsgWindow *aMsgWindow,
|
||||
nsIMsgDatabase** aMsgDatabase);
|
||||
|
||||
|
@ -199,6 +200,9 @@ public:
|
|||
NS_IMETHOD RemoveKeywordsFromMessages(nsISupportsArray *aMessages, const nsACString& aKeywords);
|
||||
|
||||
protected:
|
||||
// XXX Bug 420614 Temporary function.
|
||||
nsresult GetSubFoldersMain();
|
||||
|
||||
nsresult CopyFolderAcrossServer(nsIMsgFolder *srcFolder, nsIMsgWindow *msgWindow,nsIMsgCopyServiceListener* listener);
|
||||
|
||||
nsresult CreateSubFolders(nsIFile *path);
|
||||
|
|
|
@ -265,11 +265,11 @@ nsMsgNewsFolder::AddDirectorySeparator(nsILocalFile *path)
|
|||
nsMsgDBFolder::AddDirectorySeparator(path);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgNewsFolder::GetSubFolders(nsIEnumerator* *result)
|
||||
// XXX When GetSubFoldersObsolete goes away (bug 420614), this can be merged
|
||||
// into GetSubFolders (see also note at return statement).
|
||||
nsresult
|
||||
nsMsgNewsFolder::GetSubFoldersMain()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (!mInitialized)
|
||||
{
|
||||
// do this first, so we make sure to do it, even on failure.
|
||||
|
@ -277,7 +277,7 @@ nsMsgNewsFolder::GetSubFolders(nsIEnumerator* *result)
|
|||
mInitialized = PR_TRUE;
|
||||
|
||||
nsCOMPtr<nsILocalFile> path;
|
||||
rv = GetFilePath(getter_AddRefs(path));
|
||||
nsresult rv = GetFilePath(getter_AddRefs(path));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = CreateSubFolders(path);
|
||||
|
@ -288,9 +288,30 @@ nsMsgNewsFolder::GetSubFolders(nsIEnumerator* *result)
|
|||
// migration, but we continue on. see #66018
|
||||
(void)UpdateSummaryTotals(PR_FALSE);
|
||||
}
|
||||
// XXX When GetSubFoldersObsolete goes away, this return can be replaced by:
|
||||
// return NS_NewArrayEnumerator(aResult, mSubFolders);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
rv = mSubFolders->Enumerate(result);
|
||||
NS_IMETHODIMP
|
||||
nsMsgNewsFolder::GetSubFolders(nsISimpleEnumerator **aResult)
|
||||
{
|
||||
nsresult rv = GetSubFoldersMain();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return NS_NewArrayEnumerator(aResult, mSubFolders);
|
||||
}
|
||||
|
||||
// XXX GetSubFoldersObsolete will be going away soon (bug 420614)
|
||||
NS_IMETHODIMP
|
||||
nsMsgNewsFolder::GetSubFoldersObsolete(nsIEnumerator **aResult)
|
||||
{
|
||||
nsresult rv = GetSubFoldersMain();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return mSubFolders->Enumerate(aResult);
|
||||
}
|
||||
|
||||
//Makes sure the database is open and exists. If the database is valid then
|
||||
|
|
|
@ -66,7 +66,8 @@ public:
|
|||
// nsIUrlListener method
|
||||
NS_IMETHOD OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode);
|
||||
// nsIMsgFolder methods:
|
||||
NS_IMETHOD GetSubFolders(nsIEnumerator* *result);
|
||||
NS_IMETHOD GetSubFolders(nsISimpleEnumerator **aResult);
|
||||
NS_IMETHOD GetSubFoldersObsolete(nsIEnumerator **aResult);
|
||||
|
||||
NS_IMETHOD GetMessages(nsIMsgWindow *aMsgWindow, nsISimpleEnumerator* *result);
|
||||
NS_IMETHOD UpdateFolder(nsIMsgWindow *aWindow);
|
||||
|
@ -158,6 +159,10 @@ protected:
|
|||
PRInt32 mSortOrder;
|
||||
|
||||
private:
|
||||
// XXX Bug 420614 Temporary function.
|
||||
nsresult GetSubFoldersMain();
|
||||
|
||||
|
||||
nsresult CreateNewsgroupUsernameUrlForSignon(const nsACString& inUriStr, nsACString& result);
|
||||
nsresult CreateNewsgroupPasswordUrlForSignon(const nsACString& inUriStr, nsACString& result);
|
||||
nsresult CreateNewsgroupUrlForSignon(const nsACString& inUriStr, const char * ref, nsACString& result);
|
||||
|
|
|
@ -135,11 +135,6 @@ nsNntpIncomingServer::~nsNntpIncomingServer()
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
if (mGroupsEnumerator) {
|
||||
delete mGroupsEnumerator;
|
||||
mGroupsEnumerator = nsnull;
|
||||
}
|
||||
|
||||
if (mNewsrcSaveTimer) {
|
||||
mNewsrcSaveTimer->Cancel();
|
||||
mNewsrcSaveTimer = nsnull;
|
||||
|
@ -330,7 +325,7 @@ nsNntpIncomingServer::WriteNewsrcFile()
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIEnumerator> subFolders;
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
nsCOMPtr<nsIMsgFolder> rootFolder;
|
||||
rv = GetRootFolder(getter_AddRefs(rootFolder));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -370,14 +365,12 @@ nsNntpIncomingServer::WriteNewsrcFile()
|
|||
rv = rootFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAdapterEnumerator *simpleEnumerator = new nsAdapterEnumerator(subFolders);
|
||||
if (simpleEnumerator == nsnull) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PRBool moreFolders;
|
||||
|
||||
while (NS_SUCCEEDED(simpleEnumerator->HasMoreElements(&moreFolders)) && moreFolders) {
|
||||
while (NS_SUCCEEDED(subFolders->HasMoreElements(&moreFolders)) &&
|
||||
moreFolders) {
|
||||
nsCOMPtr<nsISupports> child;
|
||||
rv = simpleEnumerator->GetNext(getter_AddRefs(child));
|
||||
rv = subFolders->GetNext(getter_AddRefs(child));
|
||||
if (NS_SUCCEEDED(rv) && child) {
|
||||
newsFolder = do_QueryInterface(child, &rv);
|
||||
if (NS_SUCCEEDED(rv) && newsFolder) {
|
||||
|
@ -390,7 +383,6 @@ nsNntpIncomingServer::WriteNewsrcFile()
|
|||
}
|
||||
}
|
||||
}
|
||||
delete simpleEnumerator;
|
||||
|
||||
newsrcStream->Close();
|
||||
|
||||
|
@ -633,15 +625,7 @@ nsNntpIncomingServer::GetNumGroupsNeedingCounts(PRInt32 *aNumGroupsNeedingCounts
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
rv = rootFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (mGroupsEnumerator) {
|
||||
delete mGroupsEnumerator;
|
||||
mGroupsEnumerator = nsnull;
|
||||
}
|
||||
mGroupsEnumerator = new nsAdapterEnumerator(subFolders);
|
||||
if (mGroupsEnumerator == nsnull) return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = rootFolder->GetSubFolders(getter_AddRefs(mGroupsEnumerator));
|
||||
|
||||
PRUint32 count = 0;
|
||||
rv = rootFolder->Count(&count);
|
||||
|
@ -667,7 +651,6 @@ nsNntpIncomingServer::GetFirstGroupNeedingCounts(nsISupports **aFirstGroupNeedin
|
|||
if (!moreFolders)
|
||||
{
|
||||
*aFirstGroupNeedingCounts = nsnull;
|
||||
delete mGroupsEnumerator;
|
||||
mGroupsEnumerator = nsnull;
|
||||
return NS_OK; // this is not an error - it just means we reached the end of the groups.
|
||||
}
|
||||
|
@ -1407,21 +1390,19 @@ nsNntpIncomingServer::ForgetPassword()
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// clear password of all child folders
|
||||
nsCOMPtr<nsIEnumerator> subFolders;
|
||||
nsCOMPtr<nsISimpleEnumerator> subFolders;
|
||||
|
||||
rv = rootFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsAdapterEnumerator *simpleEnumerator = new nsAdapterEnumerator(subFolders);
|
||||
if (!simpleEnumerator) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PRBool moreFolders = PR_FALSE;
|
||||
|
||||
nsresult return_rv = NS_OK;
|
||||
|
||||
while (NS_SUCCEEDED(simpleEnumerator->HasMoreElements(&moreFolders)) && moreFolders) {
|
||||
while (NS_SUCCEEDED(subFolders->HasMoreElements(&moreFolders)) &&
|
||||
moreFolders) {
|
||||
nsCOMPtr<nsISupports> child;
|
||||
rv = simpleEnumerator->GetNext(getter_AddRefs(child));
|
||||
rv = subFolders->GetNext(getter_AddRefs(child));
|
||||
if (NS_SUCCEEDED(rv) && child) {
|
||||
newsFolder = do_QueryInterface(child, &rv);
|
||||
if (NS_SUCCEEDED(rv) && newsFolder) {
|
||||
|
@ -1435,7 +1416,6 @@ nsNntpIncomingServer::ForgetPassword()
|
|||
}
|
||||
}
|
||||
}
|
||||
delete simpleEnumerator;
|
||||
|
||||
return return_rv;
|
||||
}
|
||||
|
@ -2093,7 +2073,7 @@ nsNntpIncomingServer::OnUserOrHostNameChanged(const nsACString& oldName, const n
|
|||
rv = GetRootMsgFolder(getter_AddRefs(serverFolder));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = serverFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
rv = serverFolder->GetSubFoldersObsolete(getter_AddRefs(subFolders));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsStringArray groupList;
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "plstr.h"
|
||||
#include "prprf.h"
|
||||
|
||||
#include "nsAdapterEnumerator.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
#include "nsISubscribableServer.h"
|
||||
#include "nsITimer.h"
|
||||
|
@ -134,7 +133,7 @@ private:
|
|||
nsresult AddGroupOnServer(const nsACString &name);
|
||||
|
||||
PRBool mNewsrcHasChanged;
|
||||
nsAdapterEnumerator *mGroupsEnumerator;
|
||||
nsCOMPtr<nsISimpleEnumerator> mGroupsEnumerator;
|
||||
PRBool mHostInfoLoaded;
|
||||
PRBool mHostInfoHasChanged;
|
||||
nsCOMPtr <nsILocalFile> mHostInfoFile;
|
||||
|
|
Загрузка…
Ссылка в новой задаче