зеркало из https://github.com/mozilla/pjs.git
Bug 413413 Replace nsMsgKey/UInt32Array with nsTArray r=dwitte sr=bienvenu
This commit is contained in:
Родитель
62fd0301fc
Коммит
702224fff3
|
@ -48,10 +48,11 @@ interface nsIMsgDBHdr;
|
|||
interface nsIStreamConverter;
|
||||
|
||||
%{C++
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsTArray.h"
|
||||
%}
|
||||
|
||||
[ref] native nsMsgKeyArrayRef(nsMsgKeyArray);
|
||||
[ref] native nsMsgKeyArrayRef(nsTArray<nsMsgKey>);
|
||||
|
||||
|
||||
[scriptable, uuid(e39c2eab-ad6c-4560-b642-7f98ba2c0c35)]
|
||||
|
|
|
@ -295,7 +295,7 @@ protected:
|
|||
PRUint32 m_curFolderIndex;
|
||||
PRUint32 m_numFilters;
|
||||
PRUint32 m_numFolders;
|
||||
nsMsgKeyArray m_searchHits;
|
||||
nsTArray<nsMsgKey> m_searchHits;
|
||||
nsCOMPtr <nsISupportsArray> m_searchHitHdrs;
|
||||
nsCOMPtr <nsIMsgSearchSession> m_searchSession;
|
||||
};
|
||||
|
@ -410,7 +410,7 @@ NS_IMETHODIMP nsMsgFilterAfterTheFact::OnSearchHit(nsIMsgDBHdr *header, nsIMsgFo
|
|||
NS_ENSURE_ARG_POINTER(header);
|
||||
nsMsgKey msgKey;
|
||||
header->GetMessageKey(&msgKey);
|
||||
m_searchHits.Add(msgKey);
|
||||
m_searchHits.AppendElement(msgKey);
|
||||
m_searchHitHdrs->AppendElement(header);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -423,14 +423,14 @@ NS_IMETHODIMP nsMsgFilterAfterTheFact::OnSearchDone(nsresult status)
|
|||
continueExecution = ContinueExecutionPrompt();
|
||||
|
||||
if (continueExecution)
|
||||
return (m_searchHits.GetSize() > 0) ? ApplyFilter() : RunNextFilter();
|
||||
return m_searchHits.IsEmpty() ? RunNextFilter() : ApplyFilter();
|
||||
else
|
||||
return OnEndExecution(rv);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFilterAfterTheFact::OnNewSearch()
|
||||
{
|
||||
m_searchHits.RemoveAll();
|
||||
m_searchHits.Clear();
|
||||
m_searchHitHdrs->Clear();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ nsresult nsMsgFilterAfterTheFact::ApplyFilter()
|
|||
|
||||
if (loggingEnabled)
|
||||
{
|
||||
for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.GetSize(); msgIndex++)
|
||||
for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.Length(); msgIndex++)
|
||||
{
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
m_searchHitHdrs->QueryElementAt(msgIndex, NS_GET_IID(nsIMsgDBHdr), getter_AddRefs(msgHdr));
|
||||
|
@ -560,7 +560,7 @@ nsresult nsMsgFilterAfterTheFact::ApplyFilter()
|
|||
case nsMsgFilterAction::KillThread:
|
||||
case nsMsgFilterAction::WatchThread:
|
||||
{
|
||||
for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.GetSize(); msgIndex++)
|
||||
for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.Length(); msgIndex++)
|
||||
{
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
m_searchHitHdrs->QueryElementAt(msgIndex, NS_GET_IID(nsIMsgDBHdr), getter_AddRefs(msgHdr));
|
||||
|
@ -585,7 +585,7 @@ nsresult nsMsgFilterAfterTheFact::ApplyFilter()
|
|||
{
|
||||
nsMsgPriorityValue filterPriority;
|
||||
filterAction->GetPriority(&filterPriority);
|
||||
for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.GetSize(); msgIndex++)
|
||||
for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.Length(); msgIndex++)
|
||||
{
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
m_searchHitHdrs->QueryElementAt(msgIndex, NS_GET_IID(nsIMsgDBHdr), getter_AddRefs(msgHdr));
|
||||
|
@ -629,7 +629,7 @@ nsresult nsMsgFilterAfterTheFact::ApplyFilter()
|
|||
nsCOMPtr <nsIMsgComposeService> compService = do_GetService (NS_MSGCOMPOSESERVICE_CONTRACTID) ;
|
||||
if (compService)
|
||||
{
|
||||
for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.GetSize(); msgIndex++)
|
||||
for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.Length(); msgIndex++)
|
||||
{
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
m_searchHitHdrs->QueryElementAt(msgIndex, NS_GET_IID(nsIMsgDBHdr), getter_AddRefs(msgHdr));
|
||||
|
@ -654,7 +654,7 @@ nsresult nsMsgFilterAfterTheFact::ApplyFilter()
|
|||
nsCOMPtr <nsIMsgComposeService> compService = do_GetService (NS_MSGCOMPOSESERVICE_CONTRACTID) ;
|
||||
if (compService)
|
||||
{
|
||||
for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.GetSize(); msgIndex++)
|
||||
for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.Length(); msgIndex++)
|
||||
{
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
m_searchHitHdrs->QueryElementAt(msgIndex, NS_GET_IID(nsIMsgDBHdr), getter_AddRefs(msgHdr));
|
||||
|
@ -676,7 +676,7 @@ nsresult nsMsgFilterAfterTheFact::ApplyFilter()
|
|||
nsCOMPtr <nsISupportsArray> partialMsgs;
|
||||
// Delete the partial headers. They're useless now
|
||||
// that the server copy is being deleted.
|
||||
for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.GetSize(); msgIndex++)
|
||||
for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.Length(); msgIndex++)
|
||||
{
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
m_searchHitHdrs->QueryElementAt(msgIndex, NS_GET_IID(nsIMsgDBHdr), getter_AddRefs(msgHdr));
|
||||
|
@ -705,7 +705,7 @@ nsresult nsMsgFilterAfterTheFact::ApplyFilter()
|
|||
{
|
||||
nsCOMPtr<nsISupportsArray> messages = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.GetSize(); msgIndex++)
|
||||
for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.Length(); msgIndex++)
|
||||
{
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
m_searchHitHdrs->QueryElementAt(msgIndex, NS_GET_IID(nsIMsgDBHdr), getter_AddRefs(msgHdr));
|
||||
|
|
|
@ -322,7 +322,7 @@ nsresult nsMsgSearchNews::Encode (nsCString *outEncoding)
|
|||
|
||||
NS_IMETHODIMP nsMsgSearchNews::AddHit(nsMsgKey key)
|
||||
{
|
||||
m_candidateHits.Add (key);
|
||||
m_candidateHits.AppendElement(key);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -363,13 +363,13 @@ void nsMsgSearchNews::CollateHits()
|
|||
// entire query is the intersection of results for each XPAT command if an AND search,
|
||||
// otherwise we want the union of all the search hits (minus the duplicates of course).
|
||||
|
||||
PRUint32 size = m_candidateHits.GetSize();
|
||||
PRUint32 size = m_candidateHits.Length();
|
||||
if (!size)
|
||||
return;
|
||||
|
||||
// Sort the article numbers first, so it's easy to tell how many hits
|
||||
// on a given article we got
|
||||
m_candidateHits.QuickSort(CompareArticleNumbers);
|
||||
m_candidateHits.Sort();
|
||||
|
||||
// For an OR search we only need to count the first occurrence of a candidate.
|
||||
PRUint32 termCount = 1;
|
||||
|
@ -397,7 +397,7 @@ void nsMsgSearchNews::CollateHits()
|
|||
candidate = possibleCandidate;
|
||||
}
|
||||
if (candidateCount == termCount)
|
||||
m_hits.Add(candidate);
|
||||
m_hits.AppendElement(candidate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -415,7 +415,7 @@ void nsMsgSearchNews::ReportHits ()
|
|||
|
||||
if (db)
|
||||
{
|
||||
PRUint32 size = m_hits.GetSize();
|
||||
PRUint32 size = m_hits.Length();
|
||||
for (PRUint32 i = 0; i < size; ++i)
|
||||
{
|
||||
nsCOMPtr <nsIMsgDBHdr> header;
|
||||
|
@ -442,17 +442,6 @@ void nsMsgSearchNews::ReportHit (nsIMsgDBHdr *pHeaders, nsIMsgFolder *folder)
|
|||
session->AddSearchHit (pHeaders, scopeFolder);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int PR_CALLBACK nsMsgSearchNews::CompareArticleNumbers (const void *v1, const void *v2, void *data)
|
||||
{
|
||||
// QuickSort callback to compare article numbers
|
||||
|
||||
uint32 i1 = *(uint32*) v1;
|
||||
uint32 i2 = *(uint32*) v2;
|
||||
return i1 - i2;
|
||||
}
|
||||
|
||||
nsresult nsMsgSearchValidityManager::InitNewsTable()
|
||||
{
|
||||
NS_ASSERTION (nsnull == m_newsTable,"don't call this twice!");
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
|
||||
#ifndef _nsMsgSearchNews_h__
|
||||
#include "nsMsgSearchAdapter.h"
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//---------- Adapter class for searching online (news) folders ----------------
|
||||
|
@ -62,14 +63,13 @@ public:
|
|||
void ReportHits ();
|
||||
void CollateHits ();
|
||||
void ReportHit (nsIMsgDBHdr *pHeaders, nsIMsgFolder *folder);
|
||||
static int PR_CALLBACK CompareArticleNumbers (const void *v1, const void *v2, void *data);
|
||||
|
||||
protected:
|
||||
nsCString m_encoding;
|
||||
PRBool m_ORSearch; // set to true if any of the search terms contains an OR for a boolean operator.
|
||||
|
||||
nsMsgKeyArray m_candidateHits;
|
||||
nsMsgKeyArray m_hits;
|
||||
nsTArray<nsMsgKey> m_candidateHits;
|
||||
nsTArray<nsMsgKey> m_hits;
|
||||
|
||||
static const char *m_kNntpFrom;
|
||||
static const char *m_kNntpSubject;
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsMsgCopyService.h"
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nspr.h"
|
||||
#include "nsIFile.h"
|
||||
|
|
|
@ -737,7 +737,7 @@ nsresult nsMsgDBView::FetchLabel(nsIMsgDBHdr *aHdr, nsAString &aLabelString)
|
|||
/*if you call SaveAndClearSelection make sure to call RestoreSelection otherwise
|
||||
m_saveRestoreSelectionDepth will be incorrect and will lead to selection msg problems*/
|
||||
|
||||
nsresult nsMsgDBView::SaveAndClearSelection(nsMsgKey *aCurrentMsgKey, nsMsgKeyArray &aMsgKeyArray)
|
||||
nsresult nsMsgDBView::SaveAndClearSelection(nsMsgKey *aCurrentMsgKey, nsTArray<nsMsgKey> &aMsgKeyArray)
|
||||
{
|
||||
// we don't do anything on nested Save / Restore calls.
|
||||
m_saveRestoreSelectionDepth++;
|
||||
|
@ -764,7 +764,7 @@ nsresult nsMsgDBView::SaveAndClearSelection(nsMsgKey *aCurrentMsgKey, nsMsgKeyAr
|
|||
nsMsgViewIndexArray selection;
|
||||
GetSelectedIndices(selection);
|
||||
PRInt32 numIndices = selection.Length();
|
||||
aMsgKeyArray.SetSize(numIndices);
|
||||
aMsgKeyArray.SetLength(numIndices);
|
||||
|
||||
// now store the msg key for each selected item.
|
||||
nsMsgKey msgKey;
|
||||
|
@ -781,7 +781,7 @@ nsresult nsMsgDBView::SaveAndClearSelection(nsMsgKey *aCurrentMsgKey, nsMsgKeyAr
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMsgDBView::RestoreSelection(nsMsgKey aCurrentMsgKey, nsMsgKeyArray &aMsgKeyArray)
|
||||
nsresult nsMsgDBView::RestoreSelection(nsMsgKey aCurrentMsgKey, nsTArray<nsMsgKey> &aMsgKeyArray)
|
||||
{
|
||||
// we don't do anything on nested Save / Restore calls.
|
||||
m_saveRestoreSelectionDepth--;
|
||||
|
@ -792,7 +792,7 @@ nsresult nsMsgDBView::RestoreSelection(nsMsgKey aCurrentMsgKey, nsMsgKeyArray &a
|
|||
return NS_OK;
|
||||
|
||||
// turn our message keys into corresponding view indices
|
||||
PRInt32 arraySize = aMsgKeyArray.GetSize();
|
||||
PRInt32 arraySize = aMsgKeyArray.Length();
|
||||
nsMsgViewIndex currentViewPosition = nsMsgViewIndex_None;
|
||||
nsMsgViewIndex newViewPosition = nsMsgViewIndex_None;
|
||||
|
||||
|
@ -2023,7 +2023,7 @@ NS_IMETHODIMP nsMsgDBView::Close()
|
|||
PRInt32 oldSize = GetSize();
|
||||
// this is important, because the tree will ask us for our
|
||||
// row count, which get determine from the number of keys.
|
||||
m_keys.RemoveAll();
|
||||
m_keys.Clear();
|
||||
// be consistent
|
||||
m_flags.Clear();
|
||||
m_levels.Clear();
|
||||
|
@ -2491,7 +2491,7 @@ nsMsgDBView::ApplyCommandToIndices(nsMsgViewCommandTypeValue command, nsMsgViewI
|
|||
if (command == nsMsgViewCommandType::deleteNoTrash)
|
||||
return DeleteMessages(msgWindow, indices, numIndices, PR_TRUE);
|
||||
|
||||
nsMsgKeyArray imapUids;
|
||||
nsTArray<nsMsgKey> imapUids;
|
||||
nsCOMPtr <nsIMsgImapMailFolder> imapFolder = do_QueryInterface(folder);
|
||||
PRBool thisIsImapFolder = (imapFolder != nsnull);
|
||||
nsCOMPtr<nsIJunkMailPlugin> junkPlugin;
|
||||
|
@ -2544,7 +2544,7 @@ nsMsgDBView::ApplyCommandToIndices(nsMsgViewCommandTypeValue command, nsMsgViewI
|
|||
|
||||
folder->EnableNotifications(nsIMsgFolder::allMessageCountNotifications, PR_FALSE, PR_TRUE /*dbBatching*/);
|
||||
if (thisIsImapFolder && command != nsMsgViewCommandType::markThreadRead)
|
||||
imapUids.SetSize(numIndices);
|
||||
imapUids.SetLength(numIndices);
|
||||
|
||||
for (int32 i = 0; i < numIndices; i++)
|
||||
{
|
||||
|
@ -2632,13 +2632,13 @@ nsMsgDBView::ApplyCommandToIndices(nsMsgViewCommandTypeValue command, nsMsgViewI
|
|||
return imapFolder->StoreCustomKeywords(msgWindow,
|
||||
NS_LITERAL_CSTRING("Junk"),
|
||||
NS_LITERAL_CSTRING("NonJunk"),
|
||||
imapUids.GetArray(), imapUids.GetSize(),
|
||||
imapUids.Elements(), imapUids.Length(),
|
||||
nsnull);
|
||||
case nsMsgViewCommandType::unjunk:
|
||||
return imapFolder->StoreCustomKeywords(msgWindow,
|
||||
NS_LITERAL_CSTRING("NonJunk"),
|
||||
NS_LITERAL_CSTRING("Junk"),
|
||||
imapUids.GetArray(), imapUids.GetSize(),
|
||||
imapUids.Elements(), imapUids.Length(),
|
||||
nsnull);
|
||||
|
||||
default:
|
||||
|
@ -2646,7 +2646,7 @@ nsMsgDBView::ApplyCommandToIndices(nsMsgViewCommandTypeValue command, nsMsgViewI
|
|||
}
|
||||
|
||||
if (flags != kNoImapMsgFlag) // can't get here without thisIsImapThreadPane == TRUE
|
||||
imapFolder->StoreImapFlags(flags, addFlags, imapUids.GetArray(), imapUids.GetSize(), nsnull);
|
||||
imapFolder->StoreImapFlags(flags, addFlags, imapUids.Elements(), imapUids.Length(), nsnull);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2661,7 +2661,7 @@ nsresult nsMsgDBView::RemoveByIndex(nsMsgViewIndex index)
|
|||
{
|
||||
if (!IsValidIndex(index))
|
||||
return NS_MSG_INVALID_DBVIEW_INDEX;
|
||||
m_keys.RemoveAt(index);
|
||||
m_keys.RemoveElementAt(index);
|
||||
m_flags.RemoveElementAt(index);
|
||||
m_levels.RemoveElementAt(index);
|
||||
|
||||
|
@ -2806,7 +2806,7 @@ nsresult nsMsgDBView::SetReadByIndex(nsMsgViewIndex index, PRBool read)
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsMsgDBView::SetThreadOfMsgReadByIndex(nsMsgViewIndex index, nsMsgKeyArray &keysMarkedRead, PRBool /*read*/)
|
||||
nsresult nsMsgDBView::SetThreadOfMsgReadByIndex(nsMsgViewIndex index, nsTArray<nsMsgKey> &keysMarkedRead, PRBool /*read*/)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -3138,13 +3138,13 @@ nsMsgDBView::DetermineActionsForJunkMsgs(PRBool* movingJunkMessages, PRBool* mar
|
|||
nsresult nsMsgDBView::ReverseThreads()
|
||||
{
|
||||
nsTArray<PRUint32> newFlagArray;
|
||||
nsMsgKeyArray newKeyArray;
|
||||
nsTArray<nsMsgKey> newKeyArray;
|
||||
nsTArray<PRUint8> newLevelArray;
|
||||
|
||||
PRInt32 sourceIndex, destIndex;
|
||||
PRInt32 viewSize = GetSize();
|
||||
|
||||
newKeyArray.SetSize(m_keys.GetSize());
|
||||
newKeyArray.SetLength(m_keys.Length());
|
||||
newFlagArray.SetLength(m_flags.Length());
|
||||
newLevelArray.SetLength(m_levels.Length());
|
||||
|
||||
|
@ -3178,10 +3178,7 @@ nsresult nsMsgDBView::ReverseThreads()
|
|||
}
|
||||
sourceIndex = saveEndThread + 1;
|
||||
}
|
||||
// this copies the contents of both arrays - it would be cheaper to
|
||||
// just assign the new data ptrs to the old arrays and "forget" the new
|
||||
// arrays' data ptrs, so they won't be freed when the arrays are deleted.
|
||||
m_keys.CopyArray(newKeyArray);
|
||||
m_keys.SwapElements(newKeyArray);
|
||||
m_flags.SwapElements(newFlagArray);
|
||||
m_levels.SwapElements(newLevelArray);
|
||||
|
||||
|
@ -4170,22 +4167,14 @@ nsMsgViewIndex nsMsgDBView::FindHdr(nsIMsgDBHdr *msgHdr)
|
|||
return FindViewIndex(msgKey);
|
||||
}
|
||||
|
||||
nsMsgKey nsMsgDBView::GetAt(nsMsgViewIndex index)
|
||||
{
|
||||
if (index >= m_keys.GetSize() || index == nsMsgViewIndex_None)
|
||||
return nsMsgKey_None;
|
||||
else
|
||||
return(m_keys[index]);
|
||||
}
|
||||
|
||||
nsMsgViewIndex nsMsgDBView::FindKey(nsMsgKey key, PRBool expand)
|
||||
{
|
||||
nsMsgViewIndex retIndex = nsMsgViewIndex_None;
|
||||
retIndex = (nsMsgViewIndex) (m_keys.FindIndex(key));
|
||||
retIndex = (nsMsgViewIndex) (m_keys.IndexOf(key));
|
||||
// for dummy headers, try to expand if the caller says so. And if the thread is
|
||||
// expanded, ignore the dummy header and return the real header index.
|
||||
if (retIndex != nsMsgViewIndex_None && m_flags[retIndex] & MSG_VIEW_FLAG_DUMMY && !(m_flags[retIndex] & MSG_FLAG_ELIDED))
|
||||
return (nsMsgViewIndex) m_keys.FindIndex(key, retIndex + 1);
|
||||
return (nsMsgViewIndex) m_keys.IndexOf(key, retIndex + 1);
|
||||
if (key != nsMsgKey_None && (retIndex == nsMsgViewIndex_None || m_flags[retIndex] & MSG_VIEW_FLAG_DUMMY)
|
||||
&& expand && m_db)
|
||||
{
|
||||
|
@ -4198,7 +4187,7 @@ nsMsgViewIndex nsMsgDBView::FindKey(nsMsgKey key, PRBool expand)
|
|||
PRUint32 flags = m_flags[threadIndex];
|
||||
if ((flags & MSG_FLAG_ELIDED) && NS_SUCCEEDED(ExpandByIndex(threadIndex, nsnull))
|
||||
|| (flags & MSG_VIEW_FLAG_DUMMY))
|
||||
retIndex = (nsMsgViewIndex) m_keys.FindIndex(key, threadIndex + 1);
|
||||
retIndex = (nsMsgViewIndex) m_keys.IndexOf(key, threadIndex + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4245,7 +4234,7 @@ nsresult nsMsgDBView::ExpansionDelta(nsMsgViewIndex index, PRInt32 *expansionDel
|
|||
nsresult rv;
|
||||
|
||||
*expansionDelta = 0;
|
||||
if ( index > ((nsMsgViewIndex) m_keys.GetSize()))
|
||||
if (index >= ((nsMsgViewIndex) m_keys.Length()))
|
||||
return NS_MSG_MESSAGE_NOT_FOUND;
|
||||
char flags = m_flags[index];
|
||||
|
||||
|
@ -4399,7 +4388,7 @@ nsresult nsMsgDBView::ExpandByIndex(nsMsgViewIndex index, PRUint32 *pNumExpanded
|
|||
NS_ASSERTION(flags & MSG_FLAG_ELIDED, "can't expand an already expanded thread");
|
||||
flags &= ~MSG_FLAG_ELIDED;
|
||||
|
||||
if ((PRUint32) index > m_keys.GetSize())
|
||||
if ((PRUint32) index > m_keys.Length())
|
||||
return NS_MSG_MESSAGE_NOT_FOUND;
|
||||
|
||||
firstIdInThread = m_keys[index];
|
||||
|
@ -4455,7 +4444,7 @@ nsresult nsMsgDBView::CollapseByIndex(nsMsgViewIndex index, PRUint32 *pNumCollap
|
|||
return NS_OK;
|
||||
flags |= MSG_FLAG_ELIDED;
|
||||
|
||||
if (index > m_keys.GetSize())
|
||||
if (index > m_keys.Length())
|
||||
return NS_MSG_MESSAGE_NOT_FOUND;
|
||||
|
||||
firstIdInThread = m_keys[index];
|
||||
|
@ -4476,10 +4465,7 @@ nsresult nsMsgDBView::CollapseByIndex(nsMsgViewIndex index, PRUint32 *pNumCollap
|
|||
PRInt32 numRemoved = threadCount; // don't count first header in thread
|
||||
NoteStartChange(index + 1, -numRemoved, nsMsgViewNotificationCode::insertOrDelete);
|
||||
// start at first id after thread.
|
||||
for (int i = 1; i <= threadCount && index + 1 < m_keys.GetSize(); i++)
|
||||
{
|
||||
m_keys.RemoveAt(index + 1);
|
||||
}
|
||||
m_keys.RemoveElementsAt(index + 1, threadCount);
|
||||
m_flags.RemoveElementsAt(index + 1, threadCount);
|
||||
m_levels.RemoveElementsAt(index + 1, threadCount);
|
||||
if (pNumCollapsed != nsnull)
|
||||
|
@ -4568,10 +4554,10 @@ nsMsgViewIndex nsMsgDBView::GetIndexForThread(nsIMsgDBHdr *hdr)
|
|||
return retIndex;
|
||||
}
|
||||
|
||||
nsMsgViewIndex nsMsgDBView::GetInsertIndexHelper(nsIMsgDBHdr *msgHdr, nsMsgKeyArray &keys,
|
||||
nsMsgViewIndex nsMsgDBView::GetInsertIndexHelper(nsIMsgDBHdr *msgHdr, nsTArray<nsMsgKey> &keys,
|
||||
nsMsgViewSortOrderValue sortOrder, nsMsgViewSortTypeValue sortType)
|
||||
{
|
||||
nsMsgViewIndex highIndex = keys.GetSize();
|
||||
nsMsgViewIndex highIndex = keys.Length();
|
||||
nsMsgViewIndex lowIndex = 0;
|
||||
IdKeyPtr EntryInfo1, EntryInfo2;
|
||||
EntryInfo1.key = nsnull;
|
||||
|
@ -4691,7 +4677,7 @@ nsresult nsMsgDBView::AddHdr(nsIMsgDBHdr *msgHdr)
|
|||
{
|
||||
PRUint32 flags = 0;
|
||||
#ifdef DEBUG_bienvenu
|
||||
NS_ASSERTION(m_keys.GetSize() == m_flags.Length() && m_keys.GetSize() == m_levels.Length(), "view arrays out of sync!");
|
||||
NS_ASSERTION(m_keys.Length() == m_flags.Length() && (int) m_keys.Length() == m_levels.Length(), "view arrays out of sync!");
|
||||
#endif
|
||||
|
||||
if (!GetShowingIgnored())
|
||||
|
@ -4724,7 +4710,7 @@ nsresult nsMsgDBView::AddHdr(nsIMsgDBHdr *msgHdr)
|
|||
|
||||
if (m_sortOrder == nsMsgViewSortOrder::ascending)
|
||||
{
|
||||
m_keys.Add(msgKey);
|
||||
m_keys.AppendElement(msgKey);
|
||||
m_flags.AppendElement(flags);
|
||||
m_levels.AppendElement(levelToAdd);
|
||||
|
||||
|
@ -4734,7 +4720,7 @@ nsresult nsMsgDBView::AddHdr(nsIMsgDBHdr *msgHdr)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_keys.InsertAt(0, msgKey);
|
||||
m_keys.InsertElementAt(0, msgKey);
|
||||
m_flags.InsertElementAt(0, flags);
|
||||
m_levels.InsertElementAt(0, levelToAdd);
|
||||
|
||||
|
@ -4746,7 +4732,7 @@ nsresult nsMsgDBView::AddHdr(nsIMsgDBHdr *msgHdr)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_keys.InsertAt(insertIndex, msgKey);
|
||||
m_keys.InsertElementAt(insertIndex, msgKey);
|
||||
m_flags.InsertElementAt(insertIndex, flags);
|
||||
PRInt32 level = 0;
|
||||
m_levels.InsertElementAt(insertIndex, level);
|
||||
|
@ -4769,7 +4755,7 @@ nsMsgViewIndex nsMsgDBView::FindParentInThread(nsMsgKey parentKey, nsMsgViewInde
|
|||
nsCOMPtr<nsIMsgDBHdr> msgHdr;
|
||||
while (parentKey != nsMsgKey_None)
|
||||
{
|
||||
nsMsgViewIndex parentIndex = m_keys.FindIndex(parentKey, startOfThreadViewIndex);
|
||||
nsMsgViewIndex parentIndex = m_keys.IndexOf(parentKey, startOfThreadViewIndex);
|
||||
if (parentIndex != nsMsgViewIndex_None)
|
||||
return parentIndex;
|
||||
|
||||
|
@ -4844,7 +4830,7 @@ nsresult nsMsgDBView::ListIdsInThread(nsIMsgThread *threadHdr, nsMsgViewIndex st
|
|||
PRUint32 numChildren;
|
||||
threadHdr->GetNumChildren(&numChildren);
|
||||
numChildren--; // account for the existing thread root
|
||||
m_keys.InsertAt(viewIndex, 0, numChildren);
|
||||
m_keys.InsertElementsAt(viewIndex, numChildren, 0);
|
||||
m_flags.InsertElementsAt(viewIndex, numChildren, 0);
|
||||
m_levels.InsertElementsAt(viewIndex, numChildren, 1); // default unthreaded level
|
||||
|
||||
|
@ -4882,7 +4868,7 @@ nsresult nsMsgDBView::ListIdsInThread(nsIMsgThread *threadHdr, nsMsgViewIndex st
|
|||
if (*pNumListed < numChildren)
|
||||
{
|
||||
NS_NOTREACHED("thread corrupt in db");
|
||||
m_keys.RemoveAt(viewIndex, numChildren - *pNumListed);
|
||||
m_keys.RemoveElementsAt(viewIndex, numChildren - *pNumListed);
|
||||
m_flags.RemoveElementsAt(viewIndex, numChildren - *pNumListed);
|
||||
m_levels.RemoveElementsAt(viewIndex, numChildren - *pNumListed);
|
||||
// if we've listed fewer messages than are in the thread, then the db
|
||||
|
@ -4967,7 +4953,7 @@ nsresult nsMsgDBView::ListUnreadIdsInThread(nsIMsgThread *threadHdr, nsMsgViewIn
|
|||
m_db->MarkHdrRead(msgHdr, PR_FALSE, nsnull);
|
||||
if (msgKey != topLevelMsgKey)
|
||||
{
|
||||
m_keys.InsertAt(viewIndex, msgKey);
|
||||
m_keys.InsertElementAt(viewIndex, msgKey);
|
||||
m_flags.InsertElementAt(viewIndex, msgFlags);
|
||||
levelToAdd = FindLevelInThread(msgHdr, startOfThreadViewIndex, viewIndex);
|
||||
m_levels.InsertElementAt(viewIndex, levelToAdd);
|
||||
|
@ -5052,7 +5038,7 @@ NS_IMETHODIMP nsMsgDBView::OnAnnouncerGoingAway(nsIDBChangeAnnouncer *instigator
|
|||
|
||||
// this is important, because the tree will ask us for our
|
||||
// row count, which get determine from the number of keys.
|
||||
m_keys.RemoveAll();
|
||||
m_keys.Clear();
|
||||
// be consistent
|
||||
m_flags.Clear();
|
||||
m_levels.Clear();
|
||||
|
@ -5198,7 +5184,7 @@ NS_IMETHODIMP nsMsgDBView::SetViewFlags(nsMsgViewFlagsTypeValue aViewFlags)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMsgDBView::MarkThreadOfMsgRead(nsMsgKey msgId, nsMsgViewIndex msgIndex, nsMsgKeyArray &idsMarkedRead, PRBool bRead)
|
||||
nsresult nsMsgDBView::MarkThreadOfMsgRead(nsMsgKey msgId, nsMsgViewIndex msgIndex, nsTArray<nsMsgKey> &idsMarkedRead, PRBool bRead)
|
||||
{
|
||||
nsCOMPtr <nsIMsgThread> threadHdr;
|
||||
nsresult rv = GetThreadContainingIndex(msgIndex, getter_AddRefs(threadHdr));
|
||||
|
@ -5221,7 +5207,7 @@ nsresult nsMsgDBView::MarkThreadOfMsgRead(nsMsgKey msgId, nsMsgViewIndex msgInde
|
|||
return MarkThreadRead(threadHdr, threadIndex, idsMarkedRead, bRead);
|
||||
}
|
||||
|
||||
nsresult nsMsgDBView::MarkThreadRead(nsIMsgThread *threadHdr, nsMsgViewIndex threadIndex, nsMsgKeyArray &idsMarkedRead, PRBool bRead)
|
||||
nsresult nsMsgDBView::MarkThreadRead(nsIMsgThread *threadHdr, nsMsgViewIndex threadIndex, nsTArray<nsMsgKey> &idsMarkedRead, PRBool bRead)
|
||||
{
|
||||
PRBool threadElided = PR_TRUE;
|
||||
if (threadIndex != nsMsgViewIndex_None)
|
||||
|
@ -5229,7 +5215,7 @@ nsresult nsMsgDBView::MarkThreadRead(nsIMsgThread *threadHdr, nsMsgViewIndex thr
|
|||
|
||||
PRUint32 numChildren;
|
||||
threadHdr->GetNumChildren(&numChildren);
|
||||
idsMarkedRead.AllocateSpace(numChildren);
|
||||
idsMarkedRead.SetCapacity(numChildren);
|
||||
for (PRInt32 childIndex = 0; childIndex < (PRInt32) numChildren ; childIndex++)
|
||||
{
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
|
@ -5249,7 +5235,7 @@ nsresult nsMsgDBView::MarkThreadRead(nsIMsgThread *threadHdr, nsMsgViewIndex thr
|
|||
// MarkHdrRead will change the unread count on the thread
|
||||
m_db->MarkHdrRead(msgHdr, bRead, nsnull);
|
||||
// insert at the front. should we insert at the end?
|
||||
idsMarkedRead.InsertAt(0, hdrMsgId);
|
||||
idsMarkedRead.InsertElementAt(0, hdrMsgId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5724,7 +5710,7 @@ nsresult nsMsgDBView::FindPrevFlagged(nsMsgViewIndex startIndex, nsMsgViewIndex
|
|||
|
||||
PRBool nsMsgDBView::IsValidIndex(nsMsgViewIndex index)
|
||||
{
|
||||
return ((index >=0) && (index < (nsMsgViewIndex) m_keys.GetSize()));
|
||||
return ((index >=0) && (index < (nsMsgViewIndex) m_keys.Length()));
|
||||
}
|
||||
|
||||
nsresult nsMsgDBView::OrExtraFlag(nsMsgViewIndex index, PRUint32 orflag)
|
||||
|
@ -5852,7 +5838,7 @@ nsresult nsMsgDBView::SetThreadIgnored(nsIMsgThread *thread, nsMsgViewIndex thre
|
|||
NoteChange(threadIndex, 1, nsMsgViewNotificationCode::changed);
|
||||
if (ignored)
|
||||
{
|
||||
nsMsgKeyArray idsMarkedRead;
|
||||
nsTArray<nsMsgKey> idsMarkedRead;
|
||||
|
||||
MarkThreadRead(thread, threadIndex, idsMarkedRead, PR_TRUE);
|
||||
CollapseByIndex(threadIndex, nsnull);
|
||||
|
@ -6256,13 +6242,13 @@ NS_IMETHODIMP nsMsgDBView::SelectMsgByKey(nsMsgKey aKey)
|
|||
// but pass in a different key array so that we'll
|
||||
// select (and load) the desired message
|
||||
|
||||
nsMsgKeyArray preservedSelection;
|
||||
nsAutoTArray<nsMsgKey, 1> preservedSelection;
|
||||
nsresult rv = SaveAndClearSelection(nsnull, preservedSelection);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// now, restore our desired selection
|
||||
nsMsgKeyArray keyArray;
|
||||
keyArray.Add(aKey);
|
||||
nsAutoTArray<nsMsgKey, 1> keyArray;
|
||||
keyArray.AppendElement(aKey);
|
||||
|
||||
// if the key was not found
|
||||
// (this can happen with "remember last selected message")
|
||||
|
@ -6312,7 +6298,7 @@ nsresult nsMsgDBView::CopyDBView(nsMsgDBView *aNewMsgDBView, nsIMessenger *aMess
|
|||
aNewMsgDBView->mDeleteModel = mDeleteModel;
|
||||
aNewMsgDBView->m_flags = m_flags;
|
||||
aNewMsgDBView->m_levels = m_levels;
|
||||
aNewMsgDBView->m_keys.CopyArray(m_keys);
|
||||
aNewMsgDBView->m_keys = m_keys;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,8 @@
|
|||
#include "nsIMsgDatabase.h"
|
||||
#include "nsIMsgHdr.h"
|
||||
#include "nsMsgLineBuffer.h" // for nsByteArray
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIDBChangeListener.h"
|
||||
#include "nsITreeView.h"
|
||||
#include "nsITreeBoxObject.h"
|
||||
|
@ -120,7 +121,7 @@ public:
|
|||
NS_DECL_NSITREEVIEW
|
||||
NS_DECL_NSIJUNKMAILCLASSIFICATIONLISTENER
|
||||
|
||||
nsMsgViewIndex GetInsertIndexHelper(nsIMsgDBHdr *msgHdr, nsMsgKeyArray &keys,
|
||||
nsMsgViewIndex GetInsertIndexHelper(nsIMsgDBHdr *msgHdr, nsTArray<nsMsgKey> &keys,
|
||||
nsMsgViewSortOrderValue sortOrder,
|
||||
nsMsgViewSortTypeValue sortType);
|
||||
PRInt32 SecondarySort(nsMsgKey key1, nsISupports *folder1, nsMsgKey key2, nsISupports *folder2,
|
||||
|
@ -205,8 +206,8 @@ protected:
|
|||
// When you are done changing the view,
|
||||
// call RestoreSelection passing in the same array
|
||||
// and we'll restore the selection AND unfreeze selection in the UI.
|
||||
nsresult SaveAndClearSelection(nsMsgKey *aCurrentMsgKey, nsMsgKeyArray &aMsgKeyArray);
|
||||
nsresult RestoreSelection(nsMsgKey aCurrentmsgKey, nsMsgKeyArray &aMsgKeyArray);
|
||||
nsresult SaveAndClearSelection(nsMsgKey *aCurrentMsgKey, nsTArray<nsMsgKey> &aMsgKeyArray);
|
||||
nsresult RestoreSelection(nsMsgKey aCurrentmsgKey, nsTArray<nsMsgKey> &aMsgKeyArray);
|
||||
|
||||
// this is not safe to use when you have a selection
|
||||
// RowCountChanged() will call AdjustSelection()
|
||||
|
@ -251,7 +252,8 @@ protected:
|
|||
nsresult PersistFolderInfo(nsIDBFolderInfo **dbFolderInfo);
|
||||
void SetMRUTimeForFolder(nsIMsgFolder *folder);
|
||||
|
||||
nsMsgKey GetAt(nsMsgViewIndex index) ;
|
||||
nsMsgKey GetAt(nsMsgViewIndex index)
|
||||
{return m_keys.SafeElementAt(index, nsMsgKey_None);}
|
||||
nsMsgViewIndex FindViewIndex(nsMsgKey key)
|
||||
{return FindKey(key, PR_FALSE);}
|
||||
nsMsgViewIndex FindHdr(nsIMsgDBHdr *msgHdr);
|
||||
|
@ -264,7 +266,7 @@ protected:
|
|||
nsresult ListUnreadIdsInThread(nsIMsgThread *threadHdr, nsMsgViewIndex startOfThreadViewIndex, PRUint32 *pNumListed);
|
||||
nsMsgViewIndex FindParentInThread(nsMsgKey parentKey, nsMsgViewIndex startOfThreadViewIndex);
|
||||
nsresult ListIdsInThreadOrder(nsIMsgThread *threadHdr, nsMsgKey parentKey, PRInt32 level, nsMsgViewIndex *viewIndex, PRUint32 *pNumListed);
|
||||
PRInt32 GetSize(void) {return(m_keys.GetSize());}
|
||||
PRInt32 GetSize(void) {return(m_keys.Length());}
|
||||
|
||||
// notification api's
|
||||
void EnableChangeUpdates();
|
||||
|
@ -289,7 +291,7 @@ protected:
|
|||
nsMsgJunkStatus aNewClassification);
|
||||
nsresult ToggleReadByIndex(nsMsgViewIndex index);
|
||||
nsresult SetReadByIndex(nsMsgViewIndex index, PRBool read);
|
||||
nsresult SetThreadOfMsgReadByIndex(nsMsgViewIndex index, nsMsgKeyArray &keysMarkedRead, PRBool read);
|
||||
nsresult SetThreadOfMsgReadByIndex(nsMsgViewIndex index, nsTArray<nsMsgKey> &keysMarkedRead, PRBool read);
|
||||
nsresult SetFlaggedByIndex(nsMsgViewIndex index, PRBool mark);
|
||||
nsresult SetLabelByIndex(nsMsgViewIndex index, nsMsgLabelValue label);
|
||||
nsresult OrExtraFlag(nsMsgViewIndex index, PRUint32 orflag);
|
||||
|
@ -328,8 +330,8 @@ protected:
|
|||
nsresult FindPrevUnread(nsMsgKey startKey, nsMsgKey *pResultKey, nsMsgKey *resultThreadId);
|
||||
nsresult FindFirstFlagged(nsMsgViewIndex *pResultIndex);
|
||||
nsresult FindPrevFlagged(nsMsgViewIndex startIndex, nsMsgViewIndex *pResultIndex);
|
||||
nsresult MarkThreadOfMsgRead(nsMsgKey msgId, nsMsgViewIndex msgIndex, nsMsgKeyArray &idsMarkedRead, PRBool bRead);
|
||||
nsresult MarkThreadRead(nsIMsgThread *threadHdr, nsMsgViewIndex threadIndex, nsMsgKeyArray &idsMarkedRead, PRBool bRead);
|
||||
nsresult MarkThreadOfMsgRead(nsMsgKey msgId, nsMsgViewIndex msgIndex, nsTArray<nsMsgKey> &idsMarkedRead, PRBool bRead);
|
||||
nsresult MarkThreadRead(nsIMsgThread *threadHdr, nsMsgViewIndex threadIndex, nsTArray<nsMsgKey> &idsMarkedRead, PRBool bRead);
|
||||
PRBool IsValidIndex(nsMsgViewIndex index);
|
||||
nsresult ToggleIgnored(nsMsgViewIndex * indices, PRInt32 numIndices, nsMsgViewIndex *resultIndex, PRBool *resultToggleState);
|
||||
PRBool OfflineMsgSelected(nsMsgViewIndex * indices, PRInt32 numIndices);
|
||||
|
@ -348,7 +350,7 @@ protected:
|
|||
PRBool AdjustReadFlag(nsIMsgDBHdr *msgHdr, PRUint32 *msgFlags);
|
||||
void FreeAll(nsVoidArray *ptrs);
|
||||
void ClearHdrCache();
|
||||
nsMsgKeyArray m_keys;
|
||||
nsTArray<nsMsgKey> m_keys;
|
||||
nsTArray<PRUint32> m_flags;
|
||||
nsTArray<PRUint8> m_levels;
|
||||
nsMsgImapDeleteModel mDeleteModel;
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
#include "nsMsgLocalFolderHdrs.h"
|
||||
#include "nsIMsgDatabase.h"
|
||||
|
||||
static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID);
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// nsFolderCompactState
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -289,10 +288,10 @@ nsFolderCompactState::Init(nsIMsgFolder *folder, const char *baseMsgUri, nsIMsgD
|
|||
m_file->SetNativeLeafName(NS_LITERAL_CSTRING("nstmp"));
|
||||
m_file->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 00600); //make sure we are not crunching existing nstmp file
|
||||
m_window = aMsgWindow;
|
||||
m_keyArray.RemoveAll();
|
||||
m_keyArray.Clear();
|
||||
InitDB(db);
|
||||
|
||||
m_size = m_keyArray.GetSize();
|
||||
m_size = m_keyArray.Length();
|
||||
m_curIndex = 0;
|
||||
|
||||
rv = NS_NewLocalFileOutputStream(getter_AddRefs(m_fileStream), m_file, -1, 00600);
|
||||
|
|
|
@ -86,7 +86,7 @@ protected:
|
|||
nsCOMPtr<nsIMsgDatabase> m_db; // new database for the compact folder
|
||||
nsCOMPtr <nsILocalFile> m_file; // new mailbox for the compact folder
|
||||
nsCOMPtr <nsIOutputStream> m_fileStream; // output file stream for writing
|
||||
nsMsgKeyArray m_keyArray; // all message keys need to be copied over
|
||||
nsTArray<nsMsgKey> m_keyArray; // all message keys need to be copied over
|
||||
PRInt32 m_size; // size of the message key array
|
||||
PRInt32 m_curIndex; // index of the current copied message key in key array
|
||||
nsMsgKey m_startOfNewMsg; // offset in mailbox of new message
|
||||
|
|
|
@ -109,13 +109,13 @@ NS_IMETHODIMP nsMsgGroupThread::GetSubject(nsACString& result)
|
|||
NS_IMETHODIMP nsMsgGroupThread::GetNumChildren(PRUint32 *aNumChildren)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNumChildren);
|
||||
*aNumChildren = m_keys.GetSize(); // - ((m_dummy) ? 1 : 0);
|
||||
*aNumChildren = m_keys.Length(); // - ((m_dummy) ? 1 : 0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint32 nsMsgGroupThread::NumRealChildren()
|
||||
{
|
||||
return m_keys.GetSize() - ((m_dummy) ? 1 : 0);
|
||||
return m_keys.Length() - ((m_dummy) ? 1 : 0);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgGroupThread::GetNumUnreadChildren (PRUint32 *aNumUnreadChildren)
|
||||
|
@ -153,7 +153,7 @@ nsresult nsMsgGroupThread::RerootThread(nsIMsgDBHdr *newParentOfOldRoot, nsIMsgD
|
|||
{
|
||||
// move the root hdr to pos 0 by removing it and adding it at 0.
|
||||
m_keys.RemoveElement(newRoot);
|
||||
m_keys.InsertAt(0, newRoot);
|
||||
m_keys.InsertElementAt(0, newRoot);
|
||||
ancestorHdr->SetThreadParent(nsMsgKey_None);
|
||||
}
|
||||
return rv;
|
||||
|
@ -175,7 +175,7 @@ nsresult nsMsgGroupThread::AddMsgHdrInDateOrder(nsIMsgDBHdr *child, nsMsgDBView
|
|||
PRUint32 insertIndex = 0;
|
||||
// since we're sorted by date, we could do a binary search for the
|
||||
// insert point. Or, we could start at the end...
|
||||
if (m_keys.GetSize() > 0)
|
||||
if (m_keys.Length() > 0)
|
||||
{
|
||||
nsMsgViewSortTypeValue sortType;
|
||||
nsMsgViewSortOrderValue sortOrder;
|
||||
|
@ -188,7 +188,7 @@ nsresult nsMsgGroupThread::AddMsgHdrInDateOrder(nsIMsgDBHdr *child, nsMsgDBView
|
|||
// sort by date within group
|
||||
insertIndex = view->GetInsertIndexHelper(child, m_keys, threadSortOrder, nsMsgViewSortType::byDate);
|
||||
}
|
||||
m_keys.InsertAt(insertIndex, newHdrKey);
|
||||
m_keys.InsertElementAt(insertIndex, newHdrKey);
|
||||
if (!insertIndex)
|
||||
m_threadRootKey = newHdrKey;
|
||||
return ret;
|
||||
|
@ -260,7 +260,7 @@ nsresult nsMsgGroupThread::ReparentNonReferenceChildrenOf(nsIMsgDBHdr *topLevelH
|
|||
NS_IMETHODIMP nsMsgGroupThread::GetChildKeyAt(PRInt32 aIndex, nsMsgKey *aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
if (aIndex >= m_keys.GetSize())
|
||||
if (aIndex >= m_keys.Length())
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
*aResult = m_keys[aIndex];
|
||||
return NS_OK;
|
||||
|
@ -268,7 +268,7 @@ NS_IMETHODIMP nsMsgGroupThread::GetChildKeyAt(PRInt32 aIndex, nsMsgKey *aResult)
|
|||
|
||||
NS_IMETHODIMP nsMsgGroupThread::GetChildAt(PRInt32 aIndex, nsIMsgDBHdr **aResult)
|
||||
{
|
||||
if (aIndex >= m_keys.GetSize())
|
||||
if (aIndex >= m_keys.Length())
|
||||
return NS_MSG_MESSAGE_NOT_FOUND;
|
||||
return m_db->GetMsgHdrForKey(m_keys[aIndex], aResult);
|
||||
}
|
||||
|
@ -289,16 +289,14 @@ NS_IMETHODIMP nsMsgGroupThread::GetChildHdrAt(PRInt32 aIndex, nsIMsgDBHdr **aRes
|
|||
|
||||
NS_IMETHODIMP nsMsgGroupThread::RemoveChildAt(PRInt32 aIndex)
|
||||
{
|
||||
m_keys.RemoveAt(aIndex);
|
||||
m_keys.RemoveElementAt(aIndex);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsMsgGroupThread::RemoveChild(nsMsgKey msgKey)
|
||||
{
|
||||
PRUint32 childIndex = m_keys.IndexOf(msgKey);
|
||||
if (childIndex != kNotFound)
|
||||
m_keys.RemoveAt(childIndex);
|
||||
m_keys.RemoveElement(msgKey);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -329,7 +327,7 @@ NS_IMETHODIMP nsMsgGroupThread::RemoveChildHdr(nsIMsgDBHdr *child, nsIDBChangeAn
|
|||
nsresult rv = RemoveChild(key);
|
||||
// if we're deleting the root of a dummy thread, need to update the threadKey
|
||||
// and the dummy header at position 0
|
||||
if (m_dummy && keyWasFirstKey && m_keys.GetSize() > 1)
|
||||
if (m_dummy && keyWasFirstKey && m_keys.Length() > 1)
|
||||
m_keys[0] = m_keys[1];
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -39,7 +39,8 @@
|
|||
#include "msgCore.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsIMsgThread.h"
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIMsgDatabase.h"
|
||||
#include "nsIMsgHdr.h"
|
||||
#include "nsMsgDBView.h"
|
||||
|
@ -78,7 +79,7 @@ protected:
|
|||
PRUint32 m_flags;
|
||||
nsMsgKey m_threadRootKey;
|
||||
PRUint32 m_newestMsgDate;
|
||||
nsMsgKeyArray m_keys;
|
||||
nsTArray<nsMsgKey> m_keys;
|
||||
PRBool m_dummy; // top level msg is a dummy, e.g., grouped by age.
|
||||
nsCOMPtr <nsIMsgDatabase> m_db; // should we make a weak ref or just a ptr?
|
||||
};
|
||||
|
|
|
@ -324,14 +324,14 @@ nsMsgGroupThread *nsMsgGroupView::AddHdrToThread(nsIMsgDBHdr *msgHdr, PRBool *pN
|
|||
|
||||
nsMsgViewIndex insertIndex = GetInsertIndex(msgHdr);
|
||||
if (insertIndex == nsMsgViewIndex_None)
|
||||
insertIndex = m_keys.GetSize();
|
||||
m_keys.InsertAt(insertIndex, msgKey);
|
||||
insertIndex = m_keys.Length();
|
||||
m_keys.InsertElementAt(insertIndex, msgKey);
|
||||
m_flags.InsertElementAt(insertIndex, msgFlags | MSG_VIEW_FLAG_ISTHREAD | MSG_FLAG_ELIDED);
|
||||
m_levels.InsertElementAt(insertIndex, 0);
|
||||
// if grouped by date, insert dummy header for "age"
|
||||
if (GroupViewUsesDummyRow())
|
||||
{
|
||||
foundThread->m_keys.InsertAt(0, msgKey /* nsMsgKey_None */);
|
||||
foundThread->m_keys.InsertElementAt(0, msgKey /* nsMsgKey_None */);
|
||||
// the previous code made it look like hashKey in this case was always an integer
|
||||
foundThread->m_threadKey = atoi(NS_LossyConvertUTF16toASCII(hashKey).get());
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ NS_IMETHODIMP nsMsgGroupView::OpenWithHdrs(nsISimpleEnumerator *aHeaders, nsMsgV
|
|||
}
|
||||
// go through the view updating the flags for threads with more than one message...
|
||||
// and if grouped by date, expanding threads that were expanded before.
|
||||
for (PRUint32 viewIndex = 0; viewIndex < m_keys.GetSize(); viewIndex++)
|
||||
for (PRUint32 viewIndex = 0; viewIndex < m_keys.Length(); viewIndex++)
|
||||
{
|
||||
nsCOMPtr <nsIMsgThread> thread;
|
||||
GetThreadContainingIndex(viewIndex, getter_AddRefs(thread));
|
||||
|
@ -413,7 +413,7 @@ NS_IMETHODIMP nsMsgGroupView::OpenWithHdrs(nsISimpleEnumerator *aHeaders, nsMsgV
|
|||
}
|
||||
}
|
||||
}
|
||||
*aCount = m_keys.GetSize();
|
||||
*aCount = m_keys.Length();
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -425,14 +425,14 @@ nsresult nsMsgGroupView::HandleDayChange()
|
|||
{
|
||||
PRInt32 count;
|
||||
m_dayChanged = PR_FALSE;
|
||||
nsMsgKeyArray preservedSelection;
|
||||
nsAutoTArray<nsMsgKey, 1> preservedSelection;
|
||||
nsMsgKey curSelectedKey;
|
||||
SaveAndClearSelection(&curSelectedKey, preservedSelection);
|
||||
InternalClose();
|
||||
PRInt32 oldSize = GetSize();
|
||||
// this is important, because the tree will ask us for our
|
||||
// row count, which get determine from the number of keys.
|
||||
m_keys.RemoveAll();
|
||||
m_keys.Clear();
|
||||
// be consistent
|
||||
m_flags.Clear();
|
||||
m_levels.Clear();
|
||||
|
@ -449,8 +449,8 @@ nsresult nsMsgGroupView::HandleDayChange()
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// now, restore our desired selection
|
||||
nsMsgKeyArray keyArray;
|
||||
keyArray.Add(curSelectedKey);
|
||||
nsAutoTArray<nsMsgKey, 1> keyArray;
|
||||
keyArray.AppendElement(curSelectedKey);
|
||||
|
||||
return RestoreSelection(curSelectedKey, keyArray);
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ nsresult nsMsgGroupView::OnNewHeader(nsIMsgDBHdr *newHdr, nsMsgKey aParentKey, P
|
|||
msgKey = thread->m_keys[msgIndexInThread];
|
||||
}
|
||||
|
||||
m_keys.InsertAt(threadIndex + msgIndexInThread, msgKey);
|
||||
m_keys.InsertElementAt(threadIndex + msgIndexInThread, msgKey);
|
||||
m_flags.InsertElementAt(threadIndex + msgIndexInThread, msgFlags);
|
||||
if (msgIndexInThread > 0)
|
||||
{
|
||||
|
@ -596,7 +596,7 @@ NS_IMETHODIMP nsMsgGroupView::OnHdrDeleted(nsIMsgDBHdr *aHdrDeleted, nsMsgKey aP
|
|||
OrExtraFlag(viewIndexOfThread - 1, MSG_VIEW_FLAG_DUMMY | MSG_VIEW_FLAG_ISTHREAD);
|
||||
}
|
||||
}
|
||||
if (!groupThread->m_keys.GetSize())
|
||||
if (!groupThread->m_keys.Length())
|
||||
{
|
||||
nsString hashKey;
|
||||
rv = HashHdr(aHdrDeleted, hashKey);
|
||||
|
|
|
@ -103,8 +103,8 @@ NS_IMETHODIMP nsMsgQuickSearchDBView::DoCommand(nsMsgViewCommandTypeValue aComma
|
|||
|
||||
nsCOMPtr<nsIMsgImapMailFolder> imapFolder = do_QueryInterface(m_folder);
|
||||
if (NS_SUCCEEDED(rv) && imapFolder)
|
||||
rv = imapFolder->StoreImapFlags(kImapMsgSeenFlag, PR_TRUE, m_keys.GetArray(),
|
||||
m_keys.GetSize(), nsnull);
|
||||
rv = imapFolder->StoreImapFlags(kImapMsgSeenFlag, PR_TRUE, m_keys.Elements(),
|
||||
m_keys.Length(), nsnull);
|
||||
|
||||
m_db->SetSummaryValid(PR_TRUE);
|
||||
return rv;
|
||||
|
@ -136,7 +136,7 @@ nsresult nsMsgQuickSearchDBView::OnNewHeader(nsIMsgDBHdr *newHdr, nsMsgKey aPare
|
|||
(void) newHdr->GetMessageKey(&newKey);
|
||||
nsMsgViewIndex insertIndex = GetInsertIndexHelper(newHdr, m_origKeys,
|
||||
nsMsgViewSortOrder::ascending, nsMsgViewSortType::byId);
|
||||
m_origKeys.InsertAt(insertIndex, newKey);
|
||||
m_origKeys.InsertElementAt(insertIndex, newKey);
|
||||
nsMsgThreadedDBView::OnNewHeader(newHdr, aParentKey, ensureListed); // do not add a new message if there isn't a match.
|
||||
}
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ nsMsgQuickSearchDBView::OnSearchDone(nsresult status)
|
|||
{
|
||||
if (m_viewFolder)
|
||||
{
|
||||
nsMsgKeyArray keyArray;
|
||||
nsTArray<nsMsgKey> keyArray;
|
||||
nsCString searchUri;
|
||||
m_viewFolder->GetURI(searchUri);
|
||||
PRUint32 count = m_hdrHits.Count();
|
||||
|
@ -271,13 +271,13 @@ nsMsgQuickSearchDBView::OnSearchDone(nsresult status)
|
|||
{
|
||||
nsMsgKey key;
|
||||
m_hdrHits[i]->GetMessageKey(&key);
|
||||
keyArray.Add(key);
|
||||
keyArray.AppendElement(key);
|
||||
}
|
||||
nsMsgKey *staleHits;
|
||||
PRUint32 numBadHits;
|
||||
if (m_db)
|
||||
{
|
||||
m_db->RefreshCache(searchUri.get(), m_hdrHits.Count(), keyArray.GetArray(), &numBadHits, &staleHits);
|
||||
m_db->RefreshCache(searchUri.get(), m_hdrHits.Count(), keyArray.Elements(), &numBadHits, &staleHits);
|
||||
for (i = 0; i < numBadHits; i++)
|
||||
{
|
||||
nsMsgViewIndex staleHitIndex = FindKey(staleHits[i], PR_TRUE);
|
||||
|
@ -305,7 +305,7 @@ nsMsgQuickSearchDBView::OnNewSearch()
|
|||
{
|
||||
PRInt32 oldSize = GetSize();
|
||||
|
||||
m_keys.RemoveAll();
|
||||
m_keys.Clear();
|
||||
m_levels.Clear();
|
||||
m_flags.Clear();
|
||||
m_hdrHits.Clear();
|
||||
|
@ -371,7 +371,7 @@ nsresult nsMsgQuickSearchDBView::GetFirstMessageHdrToDisplayInThread(nsIMsgThrea
|
|||
child->GetMessageKey(&msgKey);
|
||||
|
||||
// this works because we've already sorted m_keys by id.
|
||||
nsMsgViewIndex keyIndex = m_origKeys.IndexOfSorted(msgKey);
|
||||
nsMsgViewIndex keyIndex = m_origKeys.BinaryIndexOf(msgKey);
|
||||
if (keyIndex != kNotFound)
|
||||
{
|
||||
// this is the root, so it's the best we're going to do.
|
||||
|
@ -420,13 +420,13 @@ nsresult nsMsgQuickSearchDBView::SortThreads(nsMsgViewSortTypeValue sortType, ns
|
|||
|
||||
// iterate over the messages in the view, getting the thread id's
|
||||
// sort m_keys so we can quickly find if a key is in the view.
|
||||
m_keys.QuickSort();
|
||||
m_keys.Sort();
|
||||
// array of the threads' root hdr keys.
|
||||
nsMsgKeyArray threadRootIds;
|
||||
nsTArray<nsMsgKey> threadRootIds;
|
||||
nsCOMPtr <nsIMsgDBHdr> rootHdr;
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
nsCOMPtr <nsIMsgThread> threadHdr;
|
||||
for (PRUint32 i = 0; i < m_keys.GetSize(); i++)
|
||||
for (PRUint32 i = 0; i < m_keys.Length(); i++)
|
||||
{
|
||||
GetMsgHdrForViewIndex(i, getter_AddRefs(msgHdr));
|
||||
m_db->GetThreadContainingMsgHdr(msgHdr, getter_AddRefs(threadHdr));
|
||||
|
@ -434,30 +434,30 @@ nsresult nsMsgQuickSearchDBView::SortThreads(nsMsgViewSortTypeValue sortType, ns
|
|||
{
|
||||
nsMsgKey rootKey;
|
||||
threadHdr->GetChildKeyAt(0, &rootKey);
|
||||
nsMsgViewIndex threadRootIndex = threadRootIds.IndexOfSorted(rootKey);
|
||||
nsMsgViewIndex threadRootIndex = threadRootIds.BinaryIndexOf(rootKey);
|
||||
// if we already have that id in top level threads, ignore this msg.
|
||||
if (threadRootIndex != kNotFound)
|
||||
continue;
|
||||
// it would be nice if GetInsertIndexHelper always found the hdr, but it doesn't.
|
||||
threadHdr->GetChildHdrAt(0, getter_AddRefs(rootHdr));
|
||||
threadRootIndex = GetInsertIndexHelper(rootHdr, threadRootIds, nsMsgViewSortOrder::ascending, nsMsgViewSortType::byId);
|
||||
threadRootIds.InsertAt(threadRootIndex, rootKey);
|
||||
threadRootIds.InsertElementAt(threadRootIndex, rootKey);
|
||||
}
|
||||
}
|
||||
m_origKeys.CopyArray(m_keys);
|
||||
m_origKeys.SwapElements(m_keys);
|
||||
// need to sort the top level threads now by sort order, if it's not by id.
|
||||
if (sortType != nsMsgViewSortType::byId)
|
||||
{
|
||||
m_keys.CopyArray(threadRootIds);
|
||||
m_keys.SwapElements(threadRootIds);
|
||||
nsMsgDBView::Sort(sortType, sortOrder);
|
||||
threadRootIds.CopyArray(m_keys);
|
||||
threadRootIds.SwapElements(m_keys);
|
||||
}
|
||||
m_keys.RemoveAll();
|
||||
m_keys.Clear();
|
||||
m_levels.Clear();
|
||||
m_flags.Clear();
|
||||
// now we've build up the list of thread ids - need to build the view
|
||||
// from that. So for each thread id, we need to list the messages in the thread.
|
||||
PRUint32 numThreads = threadRootIds.GetSize();
|
||||
PRUint32 numThreads = threadRootIds.Length();
|
||||
for (PRUint32 threadIndex = 0; threadIndex < numThreads; threadIndex++)
|
||||
{
|
||||
m_db->GetMsgHdrForKey(threadRootIds[threadIndex], getter_AddRefs(rootHdr));
|
||||
|
@ -475,17 +475,17 @@ nsresult nsMsgQuickSearchDBView::SortThreads(nsMsgViewSortTypeValue sortType, ns
|
|||
displayRootHdr->GetMessageKey(&rootKey);
|
||||
displayRootHdr->GetFlags(&rootFlags);
|
||||
rootFlags |= MSG_VIEW_FLAG_ISTHREAD;
|
||||
m_keys.Add(rootKey);
|
||||
m_keys.AppendElement(rootKey);
|
||||
m_flags.AppendElement(rootFlags);
|
||||
m_levels.AppendElement(0);
|
||||
|
||||
nsMsgViewIndex startOfThreadViewIndex = m_keys.GetSize() - 1;
|
||||
nsMsgViewIndex startOfThreadViewIndex = m_keys.Length() - 1;
|
||||
PRUint32 numListed;
|
||||
ListIdsInThread(threadHdr, startOfThreadViewIndex, &numListed);
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(m_origKeys.GetSize() == m_keys.GetSize(), "problem threading quick search");
|
||||
NS_ASSERTION(m_origKeys.Length() == m_keys.Length(), "problem threading quick search");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -511,14 +511,14 @@ nsresult nsMsgQuickSearchDBView::ListIdsInThread(nsIMsgThread *threadHdr, nsMsg
|
|||
msgHdr->GetMessageKey(&msgKey);
|
||||
if (msgKey != rootKey)
|
||||
{
|
||||
nsMsgViewIndex threadRootIndex = m_origKeys.IndexOfSorted(msgKey);
|
||||
nsMsgViewIndex threadRootIndex = m_origKeys.BinaryIndexOf(msgKey);
|
||||
// if this hdr is in the original view, add it to new view.
|
||||
if (threadRootIndex != kNotFound)
|
||||
{
|
||||
PRUint32 childFlags;
|
||||
msgHdr->GetFlags(&childFlags);
|
||||
PRUint8 levelToAdd;
|
||||
m_keys.InsertAt(viewIndex, msgKey);
|
||||
m_keys.InsertElementAt(viewIndex, msgKey);
|
||||
m_flags.InsertElementAt(viewIndex, childFlags);
|
||||
if (! (rootFlags & MSG_VIEW_FLAG_HASCHILDREN))
|
||||
{
|
||||
|
@ -539,7 +539,7 @@ nsresult nsMsgQuickSearchDBView::ListIdsInThread(nsIMsgThread *threadHdr, nsMsg
|
|||
nsresult nsMsgQuickSearchDBView::ExpansionDelta(nsMsgViewIndex index, PRInt32 *expansionDelta)
|
||||
{
|
||||
*expansionDelta = 0;
|
||||
if ( index > ((nsMsgViewIndex) m_keys.GetSize()))
|
||||
if (index >= ((nsMsgViewIndex) m_keys.Length()))
|
||||
return NS_MSG_MESSAGE_NOT_FOUND;
|
||||
|
||||
char flags = m_flags[index];
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
|
||||
protected:
|
||||
nsWeakPtr m_searchSession;
|
||||
nsMsgKeyArray m_origKeys;
|
||||
nsTArray<nsMsgKey> m_origKeys;
|
||||
PRBool m_usingCachedHits;
|
||||
PRBool m_cacheEmpty;
|
||||
nsCOMArray <nsIMsgDBHdr> m_hdrHits;
|
||||
|
|
|
@ -190,7 +190,7 @@ nsresult nsMsgSearchDBView::AddHdrFromFolder(nsIMsgDBHdr *msgHdr, nsISupports *f
|
|||
if (msgKey != nsMsgKey_None)
|
||||
{
|
||||
msgHdr->GetFlags(&msgFlags);
|
||||
m_keys.Add(msgKey);
|
||||
m_keys.AppendElement(msgKey);
|
||||
m_levels.AppendElement(0);
|
||||
m_flags.AppendElement(msgFlags);
|
||||
|
||||
|
@ -250,7 +250,7 @@ nsMsgSearchDBView::OnNewSearch()
|
|||
m_dbToUseList.Clear();
|
||||
|
||||
m_folders->Clear();
|
||||
m_keys.RemoveAll();
|
||||
m_keys.Clear();
|
||||
m_levels.Clear();
|
||||
m_flags.Clear();
|
||||
|
||||
|
@ -600,7 +600,7 @@ NS_IMETHODIMP nsMsgSearchDBView::Sort(nsMsgViewSortTypeValue sortType, nsMsgView
|
|||
return NS_OK;
|
||||
|
||||
nsMsgKey preservedKey;
|
||||
nsMsgKeyArray preservedSelection;
|
||||
nsAutoTArray<nsMsgKey, 1> preservedSelection;
|
||||
SaveAndClearSelection(&preservedKey, preservedSelection);
|
||||
|
||||
rv = nsMsgDBView::Sort(sortType,sortOrder);
|
||||
|
|
|
@ -125,10 +125,10 @@ nsresult nsMsgThreadedDBView::InitThreadedView(PRInt32 *pCount)
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
m_keys.RemoveAll();
|
||||
m_keys.Clear();
|
||||
m_flags.Clear();
|
||||
m_levels.Clear();
|
||||
m_prevKeys.RemoveAll();
|
||||
m_prevKeys.Clear();
|
||||
m_prevFlags.Clear();
|
||||
m_prevLevels.Clear();
|
||||
m_havePrevView = PR_FALSE;
|
||||
|
@ -173,7 +173,7 @@ nsresult nsMsgThreadedDBView::SortThreads(nsMsgViewSortTypeValue sortType, nsMsg
|
|||
// messages in the view, and then call nsMsgDBView::Sort(sortType, sortOrder).
|
||||
// Then, we expand the threads in the result array that were expanded in the original view (perhaps by copying
|
||||
// from the original view, but more likely just be calling expand).
|
||||
for (PRUint32 i = 0; i < m_keys.GetSize(); i++)
|
||||
for (PRUint32 i = 0; i < m_keys.Length(); i++)
|
||||
{
|
||||
if (m_flags[i] & MSG_VIEW_FLAG_ISTHREAD)
|
||||
{
|
||||
|
@ -186,7 +186,7 @@ nsresult nsMsgThreadedDBView::SortThreads(nsMsgViewSortTypeValue sortType, nsMsg
|
|||
numThreads++;
|
||||
}
|
||||
}
|
||||
m_keys.SetSize(numThreads);
|
||||
m_keys.SetLength(numThreads);
|
||||
m_flags.SetLength(numThreads);
|
||||
m_levels.SetLength(numThreads);
|
||||
//m_viewFlags &= ~nsMsgViewFlagsType::kThreadedDisplay;
|
||||
|
@ -198,7 +198,7 @@ nsresult nsMsgThreadedDBView::SortThreads(nsMsgViewSortTypeValue sortType, nsMsg
|
|||
// and expand the thread. We have to update MSG_VIEW_FLAG_HAS_CHILDREN because
|
||||
// we may be going from a flat sort, which doesn't maintain that flag,
|
||||
// to a threaded sort, which requires that flag.
|
||||
for (PRUint32 j = 0; j < m_keys.GetSize(); j++)
|
||||
for (PRUint32 j = 0; j < m_keys.Length(); j++)
|
||||
{
|
||||
PRUint32 flags = m_flags[j];
|
||||
if ((flags & (MSG_VIEW_FLAG_HASCHILDREN | MSG_FLAG_ELIDED)) == MSG_VIEW_FLAG_HASCHILDREN)
|
||||
|
@ -238,7 +238,7 @@ nsresult nsMsgThreadedDBView::AddKeys(nsMsgKey *pKeys, PRInt32 *pFlags, const ch
|
|||
{
|
||||
PRInt32 numAdded = 0;
|
||||
// Allocate enough space first to avoid memory allocation/deallocation.
|
||||
m_keys.AllocateSpace(numKeysToAdd+m_keys.GetSize());
|
||||
m_keys.SetCapacity(m_keys.Length() + numKeysToAdd);
|
||||
m_flags.SetCapacity(m_flags.Length() + numKeysToAdd);
|
||||
m_levels.SetCapacity(m_levels.Length() + numKeysToAdd);
|
||||
for (PRInt32 i = 0; i < numKeysToAdd; i++)
|
||||
|
@ -255,14 +255,14 @@ nsresult nsMsgThreadedDBView::AddKeys(nsMsgKey *pKeys, PRInt32 *pFlags, const ch
|
|||
flag |= MSG_FLAG_ELIDED;
|
||||
// should this be persistent? Doesn't seem to need to be.
|
||||
flag |= MSG_VIEW_FLAG_ISTHREAD;
|
||||
m_keys.Add(pKeys[i]);
|
||||
m_keys.AppendElement(pKeys[i]);
|
||||
m_flags.AppendElement(flag);
|
||||
m_levels.AppendElement(pLevels[i]);
|
||||
numAdded++;
|
||||
// we expand as we build the view, which allows us to insert at the end of the key array,
|
||||
// instead of the middle, and is much faster.
|
||||
if ((!(m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay) || m_viewFlags & nsMsgViewFlagsType::kExpandAll) && flag & MSG_FLAG_ELIDED)
|
||||
ExpandByIndex(m_keys.GetSize() - 1, NULL);
|
||||
ExpandByIndex(m_keys.Length() - 1, NULL);
|
||||
}
|
||||
return numAdded;
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ NS_IMETHODIMP nsMsgThreadedDBView::Sort(nsMsgViewSortTypeValue sortType, nsMsgVi
|
|||
sortType = nsMsgViewSortType::byId;
|
||||
|
||||
nsMsgKey preservedKey;
|
||||
nsMsgKeyArray preservedSelection;
|
||||
nsAutoTArray<nsMsgKey, 1> preservedSelection;
|
||||
SaveAndClearSelection(&preservedKey, preservedSelection);
|
||||
// if the client wants us to forget our cached id arrays, they
|
||||
// should build a new view. If this isn't good enough, we
|
||||
|
@ -307,8 +307,7 @@ NS_IMETHODIMP nsMsgThreadedDBView::Sort(nsMsgViewSortTypeValue sortType, nsMsgVi
|
|||
if ( m_havePrevView)
|
||||
{
|
||||
// restore saved id array and flags array
|
||||
m_keys.RemoveAll();
|
||||
m_keys.InsertAt(0, &m_prevKeys);
|
||||
m_keys = m_prevKeys;
|
||||
m_flags = m_prevFlags;
|
||||
m_levels = m_prevLevels;
|
||||
m_sortValid = PR_TRUE;
|
||||
|
@ -351,8 +350,7 @@ NS_IMETHODIMP nsMsgThreadedDBView::Sort(nsMsgViewSortTypeValue sortType, nsMsgVi
|
|||
else
|
||||
{
|
||||
// going from SortByThread to non-thread sort - must build new key, level,and flags arrays
|
||||
m_prevKeys.RemoveAll();
|
||||
m_prevKeys.InsertAt(0, &m_keys);
|
||||
m_prevKeys = m_keys;
|
||||
m_prevFlags = m_flags;
|
||||
m_prevLevels = m_levels;
|
||||
// do this before we sort, so that we'll use the cheap method
|
||||
|
@ -502,7 +500,7 @@ void nsMsgThreadedDBView::OnExtraFlagChanged(nsMsgViewIndex index, PRUint32 extr
|
|||
if (m_havePrevView)
|
||||
{
|
||||
nsMsgKey keyChanged = m_keys[index];
|
||||
nsMsgViewIndex prevViewIndex = m_prevKeys.FindIndex(keyChanged);
|
||||
nsMsgViewIndex prevViewIndex = m_prevKeys.IndexOf(keyChanged);
|
||||
if (prevViewIndex != nsMsgViewIndex_None)
|
||||
{
|
||||
PRUint32 prevFlag = m_prevFlags[prevViewIndex];
|
||||
|
@ -537,7 +535,7 @@ void nsMsgThreadedDBView::OnHeaderAddedOrDeleted()
|
|||
|
||||
void nsMsgThreadedDBView::ClearPrevIdArray()
|
||||
{
|
||||
m_prevKeys.RemoveAll();
|
||||
m_prevKeys.Clear();
|
||||
m_prevLevels.Clear();
|
||||
m_prevFlags.Clear();
|
||||
m_havePrevView = PR_FALSE;
|
||||
|
@ -624,7 +622,7 @@ nsresult nsMsgThreadedDBView::OnNewHeader(nsIMsgDBHdr *newHdr, nsMsgKey aParentK
|
|||
level = m_levels[parentIndex] + 1;
|
||||
insertIndex = GetInsertInfoForNewHdr(newHdr, parentIndex, level);
|
||||
}
|
||||
m_keys.InsertAt(insertIndex, newKey);
|
||||
m_keys.InsertElementAt(insertIndex, newKey);
|
||||
m_flags.InsertElementAt(insertIndex, newFlags);
|
||||
m_levels.InsertElementAt(insertIndex, level);
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ protected:
|
|||
// these are used to save off the previous view so that bopping back and forth
|
||||
// between two views is quick (e.g., threaded and flat sorted by date).
|
||||
PRBool m_havePrevView;
|
||||
nsMsgKeyArray m_prevKeys; //this is used for caching non-threaded view.
|
||||
nsTArray<nsMsgKey> m_prevKeys; //this is used for caching non-threaded view.
|
||||
nsTArray<PRUint32> m_prevFlags;
|
||||
nsTArray<PRUint8> m_prevLevels;
|
||||
nsCOMPtr <nsISimpleEnumerator> m_threadEnumerator;
|
||||
|
|
|
@ -160,7 +160,7 @@ nsresult nsMsgXFVirtualFolderDBView::InsertHdrFromFolder(nsIMsgDBHdr *msgHdr, ns
|
|||
PRUint32 msgFlags;
|
||||
msgHdr->GetMessageKey(&msgKey);
|
||||
msgHdr->GetFlags(&msgFlags);
|
||||
m_keys.InsertAt(insertIndex, msgKey);
|
||||
m_keys.InsertElementAt(insertIndex, msgKey);
|
||||
m_flags.InsertElementAt(insertIndex, msgFlags);
|
||||
m_folders->InsertElementAt(folder, insertIndex);
|
||||
m_levels.InsertElementAt(insertIndex, 0);
|
||||
|
@ -203,15 +203,14 @@ void nsMsgXFVirtualFolderDBView::UpdateCacheAndViewForPrevSearchedFolders(nsIMsg
|
|||
if (m_curFolderGettingHits)
|
||||
{
|
||||
PRUint32 count = m_hdrHits.Count();
|
||||
nsMsgKeyArray newHits;
|
||||
nsTArray<nsMsgKey> newHits;
|
||||
newHits.SetLength(count);
|
||||
for (PRUint32 i = 0; i < count; i++)
|
||||
{
|
||||
nsMsgKey key;
|
||||
m_hdrHits[i]->GetMessageKey(&key);
|
||||
newHits.Add(key);
|
||||
m_hdrHits[i]->GetMessageKey(&newHits[i]);
|
||||
}
|
||||
newHits.QuickSort();
|
||||
UpdateCacheAndViewForFolder(m_curFolderGettingHits, newHits.GetArray(), newHits.GetSize());
|
||||
newHits.Sort();
|
||||
UpdateCacheAndViewForFolder(m_curFolderGettingHits, newHits.Elements(), newHits.Length());
|
||||
}
|
||||
|
||||
while (m_foldersSearchingOver.Count() > 0)
|
||||
|
@ -252,7 +251,7 @@ nsMsgXFVirtualFolderDBView::OnSearchHit(nsIMsgDBHdr* aMsgHdr, nsIMsgFolder *fold
|
|||
UpdateCacheAndViewForPrevSearchedFolders(folder);
|
||||
m_curFolderGettingHits = folder;
|
||||
m_hdrHits.Clear();
|
||||
m_curFolderStartKeyIndex = m_keys.GetSize();
|
||||
m_curFolderStartKeyIndex = m_keys.Length();
|
||||
}
|
||||
PRBool hdrInCache = PR_FALSE;
|
||||
nsCString searchUri;
|
||||
|
@ -321,7 +320,7 @@ nsMsgXFVirtualFolderDBView::OnNewSearch()
|
|||
m_doingSearch = PR_TRUE;
|
||||
|
||||
m_folders->Clear();
|
||||
m_keys.RemoveAll();
|
||||
m_keys.Clear();
|
||||
m_levels.Clear();
|
||||
m_flags.Clear();
|
||||
|
||||
|
|
|
@ -92,9 +92,7 @@ REQUIRES = xpcom \
|
|||
CPPSRCS = \
|
||||
nsMsgLineBuffer.cpp \
|
||||
nsMsgDBFolder.cpp \
|
||||
nsUInt32Array.cpp \
|
||||
nsMsgKeySet.cpp \
|
||||
nsMsgKeyArray.cpp \
|
||||
nsMsgIdentity.cpp \
|
||||
nsMsgIncomingServer.cpp \
|
||||
nsMsgUtils.cpp \
|
||||
|
@ -109,9 +107,7 @@ CPPSRCS = \
|
|||
|
||||
EXPORTS = \
|
||||
nsMsgLineBuffer.h \
|
||||
nsUInt32Array.h \
|
||||
nsMsgKeySet.h \
|
||||
nsMsgKeyArray.h \
|
||||
nsMsgDBFolder.h \
|
||||
nsMsgIdentity.h \
|
||||
nsMsgIncomingServer.h \
|
||||
|
|
|
@ -71,7 +71,7 @@ nsresult nsImapMoveCoalescer::AddMove(nsIMsgFolder *folder, nsMsgKey key)
|
|||
if (supports)
|
||||
{
|
||||
PRInt32 folderIndex = m_destFolders->IndexOf(supports);
|
||||
nsMsgKeyArray *keysToAdd = nsnull;
|
||||
nsTArray<nsMsgKey> *keysToAdd = nsnull;
|
||||
if (folderIndex >= 0)
|
||||
{
|
||||
keysToAdd = &(m_sourceKeyArrays[folderIndex]);
|
||||
|
@ -83,8 +83,8 @@ nsresult nsImapMoveCoalescer::AddMove(nsIMsgFolder *folder, nsMsgKey key)
|
|||
if (!keysToAdd)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (keysToAdd->IndexOf(key) == -1)
|
||||
keysToAdd->Add(key);
|
||||
if (keysToAdd->IndexOf(key) == kNotFound)
|
||||
keysToAdd->AppendElement(key);
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
|
@ -116,15 +116,15 @@ nsresult nsImapMoveCoalescer::PlaybackMoves(PRBool doNewMailNotification /* = PR
|
|||
do_GetService(NS_IMAPSERVICE_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsMsgKeyArray &keysToAdd = m_sourceKeyArrays[i];
|
||||
nsTArray<nsMsgKey>& keysToAdd = m_sourceKeyArrays[i];
|
||||
PRInt32 numNewMessages = 0;
|
||||
PRInt32 numKeysToAdd = keysToAdd.GetSize();
|
||||
PRInt32 numKeysToAdd = keysToAdd.Length();
|
||||
if (numKeysToAdd == 0)
|
||||
continue;
|
||||
|
||||
nsCOMPtr<nsISupportsArray> messages;
|
||||
NS_NewISupportsArray(getter_AddRefs(messages));
|
||||
for (PRUint32 keyIndex = 0; keyIndex < keysToAdd.GetSize(); keyIndex++)
|
||||
for (PRUint32 keyIndex = 0; keyIndex < keysToAdd.Length(); keyIndex++)
|
||||
{
|
||||
nsCOMPtr<nsIMsgDBHdr> mailHdr = nsnull;
|
||||
rv = m_sourceFolder->GetMessageHeader(keysToAdd.ElementAt(keyIndex), getter_AddRefs(mailHdr));
|
||||
|
@ -155,11 +155,11 @@ nsresult nsImapMoveCoalescer::PlaybackMoves(PRBool doNewMailNotification /* = PR
|
|||
oldNewMessageCount = 0;
|
||||
|
||||
m_sourceFolder->SetNumNewMessages(oldNewMessageCount);
|
||||
|
||||
|
||||
nsCOMPtr <nsISupports> sourceSupports = do_QueryInterface(m_sourceFolder, &rv);
|
||||
nsCOMPtr <nsIUrlListener> urlListener(do_QueryInterface(sourceSupports));
|
||||
|
||||
keysToAdd.RemoveAll();
|
||||
|
||||
keysToAdd.Clear();
|
||||
nsCOMPtr<nsIMsgCopyService> copySvc = do_GetService(NS_MSGCOPYSERVICE_CONTRACTID);
|
||||
if (copySvc)
|
||||
{
|
||||
|
@ -171,7 +171,7 @@ nsresult nsImapMoveCoalescer::PlaybackMoves(PRBool doNewMailNotification /* = PR
|
|||
listener = do_QueryInterface(copyListener);
|
||||
}
|
||||
rv = copySvc->CopyMessages(m_sourceFolder, messages, destFolder, PR_TRUE,
|
||||
listener, m_msgWindow, PR_FALSE /*allowUndo*/);
|
||||
listener, m_msgWindow, PR_FALSE /*allowUndo*/);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
m_outstandingMoves++;
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ nsImapMoveCoalescer::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsMsgKeyArray *nsImapMoveCoalescer::GetKeyBucket(PRUint32 keyArrayIndex)
|
||||
nsTArray<nsMsgKey> *nsImapMoveCoalescer::GetKeyBucket(PRUint32 keyArrayIndex)
|
||||
{
|
||||
if (keyArrayIndex >= m_keyBuckets.Length() &&
|
||||
!m_keyBuckets.SetLength(keyArrayIndex + 1))
|
||||
|
|
|
@ -42,11 +42,11 @@
|
|||
#include "nsISupportsArray.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
// imap move coalescer class - in order to keep nsImapMailFolder from growing like Topsy
|
||||
// Logically, we want to keep track of an nsMsgKeyArray per nsIMsgFolder, and then
|
||||
// Logically, we want to keep track of an nsTArray<nsMsgKey> per nsIMsgFolder, and then
|
||||
// be able to retrieve them one by one and play back the moves.
|
||||
// This utility class will be used by both the filter code and the offline playback code,
|
||||
// to avoid multiple moves to the same folder.
|
||||
|
@ -66,18 +66,18 @@ public:
|
|||
nsresult PlaybackMoves(PRBool doNewMailNotification = PR_FALSE);
|
||||
// this lets the caller store keys in an arbitrary number of buckets. If the bucket
|
||||
// for the passed in index doesn't exist, it will get created.
|
||||
nsMsgKeyArray *GetKeyBucket(PRUint32 keyArrayIndex);
|
||||
nsTArray<nsMsgKey> *GetKeyBucket(PRUint32 keyArrayIndex);
|
||||
nsIMsgWindow *GetMsgWindow() {return m_msgWindow;}
|
||||
PRBool HasPendingMoves() {return m_hasPendingMoves;}
|
||||
protected:
|
||||
// m_sourceKeyArrays and m_destFolders are parallel arrays.
|
||||
nsTArray<nsMsgKeyArray> m_sourceKeyArrays;
|
||||
nsTArray<nsTArray<nsMsgKey> > m_sourceKeyArrays;
|
||||
nsCOMPtr <nsISupportsArray> m_destFolders;
|
||||
nsCOMPtr <nsIMsgWindow> m_msgWindow;
|
||||
nsCOMPtr <nsIMsgFolder> m_sourceFolder;
|
||||
PRBool m_doNewMailNotification;
|
||||
PRBool m_hasPendingMoves;
|
||||
nsTArray<nsMsgKeyArray> m_keyBuckets;
|
||||
nsTArray<nsTArray<nsMsgKey> > m_keyBuckets;
|
||||
PRInt32 m_outstandingMoves;
|
||||
};
|
||||
|
||||
|
|
|
@ -296,7 +296,7 @@ NS_IMETHODIMP nsMsgDBFolder::EndFolderLoading(void)
|
|||
|
||||
//GGGG check for new mail here and call SetNewMessages...?? -- ONE OF THE 2 PLACES
|
||||
if(mDatabase)
|
||||
m_newMsgs.RemoveAll();
|
||||
m_newMsgs.Clear();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -448,12 +448,12 @@ NS_IMETHODIMP nsMsgDBFolder::ClearNewMessages()
|
|||
rv = mDatabase->GetNewList(&numNewKeys, &newMessageKeys);
|
||||
if (NS_SUCCEEDED(rv) && newMessageKeys)
|
||||
{
|
||||
m_saveNewMsgs.RemoveAll();
|
||||
m_saveNewMsgs.Add(newMessageKeys, numNewKeys);
|
||||
m_saveNewMsgs.Clear();
|
||||
m_saveNewMsgs.AppendElements(newMessageKeys, numNewKeys);
|
||||
}
|
||||
mDatabase->ClearNewList(PR_TRUE);
|
||||
}
|
||||
m_newMsgs.RemoveAll();
|
||||
m_newMsgs.Clear();
|
||||
mNumNewBiffMessages = 0;
|
||||
return rv;
|
||||
}
|
||||
|
@ -463,7 +463,7 @@ void nsMsgDBFolder::UpdateNewMessages()
|
|||
if (! (mFlags & MSG_FOLDER_FLAG_VIRTUAL))
|
||||
{
|
||||
PRBool hasNewMessages = PR_FALSE;
|
||||
for (PRUint32 keyIndex = 0; keyIndex < m_newMsgs.GetSize(); keyIndex++)
|
||||
for (PRUint32 keyIndex = 0; keyIndex < m_newMsgs.Length(); keyIndex++)
|
||||
{
|
||||
PRBool containsKey = PR_FALSE;
|
||||
mDatabase->ContainsKey(m_newMsgs[keyIndex], &containsKey);
|
||||
|
@ -779,8 +779,8 @@ nsMsgDBFolder::SetMsgDatabase(nsIMsgDatabase *aMsgDatabase)
|
|||
nsresult rv = mDatabase->GetNewList(&numNewKeys, &newMessageKeys);
|
||||
if (NS_SUCCEEDED(rv) && newMessageKeys)
|
||||
{
|
||||
m_newMsgs.RemoveAll();
|
||||
m_newMsgs.Add(newMessageKeys, numNewKeys);
|
||||
m_newMsgs.Clear();
|
||||
m_newMsgs.AppendElements(newMessageKeys, numNewKeys);
|
||||
}
|
||||
nsMemory::Free(newMessageKeys);
|
||||
}
|
||||
|
@ -1212,7 +1212,7 @@ nsMsgDBFolder::MarkAllMessagesRead(void)
|
|||
{
|
||||
// ### fix me need nsIMsgWindow
|
||||
nsresult rv = GetDatabase(nsnull);
|
||||
m_newMsgs.RemoveAll();
|
||||
m_newMsgs.Clear();
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
EnableNotifications(allMessageCountNotifications, PR_FALSE, PR_TRUE /*dbBatching*/);
|
||||
|
@ -1863,13 +1863,13 @@ nsMsgDBFolder::CallFilterPlugins(nsIMsgWindow *aMsgWindow, PRBool *aFiltersRun)
|
|||
rv = mDatabase->GetNewList(&numNewKeys, &newKeys);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsMsgKeyArray newMessageKeys;
|
||||
nsTArray<nsMsgKey> newMessageKeys;
|
||||
newMessageKeys.SwapElements(m_saveNewMsgs);
|
||||
if (numNewKeys)
|
||||
newMessageKeys.Add(newKeys, numNewKeys);
|
||||
newMessageKeys.AppendElements(newKeys, numNewKeys);
|
||||
|
||||
newMessageKeys.InsertAt(0, &m_saveNewMsgs);
|
||||
// if there weren't any, just return
|
||||
if (!newMessageKeys.GetSize())
|
||||
if (newMessageKeys.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
spamSettings->GetUseWhiteList(&useWhiteList);
|
||||
|
@ -1911,8 +1911,8 @@ nsMsgDBFolder::CallFilterPlugins(nsIMsgWindow *aMsgWindow, PRBool *aFiltersRun)
|
|||
|
||||
// build up list of keys to classify
|
||||
nsCString uri;
|
||||
nsMsgKeyArray keysToClassify;
|
||||
PRUint32 numNewMessages = newMessageKeys.GetSize();
|
||||
nsTArray<nsMsgKey> keysToClassify;
|
||||
PRUint32 numNewMessages = newMessageKeys.Length();
|
||||
for ( PRUint32 i=0 ; i < numNewMessages ; ++i )
|
||||
{
|
||||
nsCString junkScore;
|
||||
|
@ -1970,12 +1970,12 @@ nsMsgDBFolder::CallFilterPlugins(nsIMsgWindow *aMsgWindow, PRBool *aFiltersRun)
|
|||
}
|
||||
}
|
||||
}
|
||||
keysToClassify.Add(newMessageKeys[i]);
|
||||
keysToClassify.AppendElement(newMessageKeys[i]);
|
||||
}
|
||||
|
||||
if (keysToClassify.GetSize() > 0)
|
||||
if (!keysToClassify.IsEmpty())
|
||||
{
|
||||
PRUint32 numMessagesToClassify = keysToClassify.GetSize();
|
||||
PRUint32 numMessagesToClassify = keysToClassify.Length();
|
||||
char ** messageURIs = (char **) PR_MALLOC(sizeof(const char *) * numMessagesToClassify);
|
||||
if (!messageURIs)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -1996,7 +1996,6 @@ nsMsgDBFolder::CallFilterPlugins(nsIMsgWindow *aMsgWindow, PRBool *aFiltersRun)
|
|||
PR_Free(messageURIs[freeIndex]);
|
||||
PR_Free(messageURIs);
|
||||
}
|
||||
m_saveNewMsgs.RemoveAll();
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -215,12 +215,12 @@ protected:
|
|||
// want to run junk controls on. This is in addition to "new" hdrs
|
||||
// in the db, which might get cleared because the user clicked away
|
||||
// from the folder.
|
||||
nsMsgKeyArray m_saveNewMsgs;
|
||||
nsTArray<nsMsgKey> m_saveNewMsgs;
|
||||
|
||||
// These are the set of new messages for a folder who has had
|
||||
// its db closed, without the user reading the folder. This
|
||||
// happens with pop3 mail filtered to a different local folder.
|
||||
nsMsgKeyArray m_newMsgs;
|
||||
nsTArray<nsMsgKey> m_newMsgs;
|
||||
|
||||
//
|
||||
// stuff from the uri
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "nsMsgKeySet.h"
|
||||
#include "prprf.h"
|
||||
#include "prmem.h"
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#if defined(DEBUG_seth_) || defined(DEBUG_sspitzer_)
|
||||
#define DEBUG_MSGKEYSET 1
|
||||
|
@ -1173,13 +1173,13 @@ nsMsgKeySet::LastMissingRange(PRInt32 min, PRInt32 max,
|
|||
}
|
||||
|
||||
/**
|
||||
* Return a copy of this as an nsMsgKeyArray, which is much easier for
|
||||
* Return a copy of this as an nsTArray<nsMsgKey>, which is much easier for
|
||||
* callers to manipulate. Normal XPCOM calling conventions, although the
|
||||
* array itself isn't refcounted, so the caller should free when done
|
||||
* using NS_DELETEXPCOM().
|
||||
*/
|
||||
nsresult
|
||||
nsMsgKeySet::ToMsgKeyArray(nsMsgKeyArray **aArray)
|
||||
nsMsgKeySet::ToMsgKeyArray(nsTArray<nsMsgKey> **aArray)
|
||||
{
|
||||
PRInt32 size;
|
||||
PRInt32 *head;
|
||||
|
@ -1187,8 +1187,8 @@ nsMsgKeySet::ToMsgKeyArray(nsMsgKeyArray **aArray)
|
|||
PRInt32 *end;
|
||||
PRInt32 last_art = -1;
|
||||
|
||||
nsMsgKeyArray *array;
|
||||
NS_NEWXPCOM(array, nsMsgKeyArray);
|
||||
nsTArray<nsMsgKey> *array;
|
||||
NS_NEWXPCOM(array, nsTArray<nsMsgKey>);
|
||||
if (!array)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -1220,10 +1220,10 @@ nsMsgKeySet::ToMsgKeyArray(nsMsgKeyArray **aArray)
|
|||
if (from <= to) {
|
||||
if (from < to) {
|
||||
for (PRInt32 i = from; i <= to ; ++i ) {
|
||||
array->Add(i);
|
||||
array->AppendElement(i);
|
||||
}
|
||||
} else {
|
||||
array->Add(from);
|
||||
array->AppendElement(from);
|
||||
}
|
||||
last_art = to;
|
||||
}
|
||||
|
|
|
@ -39,8 +39,7 @@
|
|||
#define _nsMsgKeySet_H_
|
||||
|
||||
#include "msgCore.h"
|
||||
|
||||
class nsMsgKeyArray;
|
||||
#include "nsTArray.h"
|
||||
|
||||
// nsMsgKeySet represents a set of articles. Typically, it is the set of
|
||||
// read articles from a .newsrc file, but it can be used for other purposes
|
||||
|
@ -103,12 +102,12 @@ public:
|
|||
PRInt32 getLength() {return m_length;}
|
||||
|
||||
/**
|
||||
* Return a copy of this as an nsMsgKeyArray, which is much easier for
|
||||
* Return a copy of this as an nsTArray<nsMsgKey>, which is much easier for
|
||||
* callers to manipulate. Normal XPCOM calling conventions, although the
|
||||
* array itself isn't refcounted, so the caller should free when done
|
||||
* using NS_DELETEXPCOM().
|
||||
*/
|
||||
nsresult ToMsgKeyArray(nsMsgKeyArray **aArray);
|
||||
nsresult ToMsgKeyArray(nsTArray<nsMsgKey> **aArray);
|
||||
|
||||
#ifdef DEBUG
|
||||
static void RunTests();
|
||||
|
|
|
@ -3541,11 +3541,11 @@ nsMsgComposeSendListener::RemoveCurrentDraftMessage(nsIMsgCompose *compObj, PRBo
|
|||
{
|
||||
nsCAutoString srcStr(str+1);
|
||||
PRInt32 err;
|
||||
nsMsgKey num = srcStr.ToInteger(&err);
|
||||
if (num != nsMsgKey_None)
|
||||
nsMsgKey messageID = srcStr.ToInteger(&err);
|
||||
if (messageID != nsMsgKey_None)
|
||||
{
|
||||
rv = imapFolder->StoreImapFlags(kImapMsgDeletedFlag, PR_TRUE,
|
||||
&num, 1, nsnull);
|
||||
&messageID, 1, nsnull);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "nsStringGlue.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "mdb.h"
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIDBFolderInfo.h"
|
||||
#include <time.h>
|
||||
|
||||
|
@ -87,7 +87,7 @@ public:
|
|||
nsresult GetUint32PropertyWithToken(mdb_token aProperty, PRUint32 &propertyValue, PRUint32 defaultValue = 0);
|
||||
nsresult GetInt32PropertyWithToken(mdb_token aProperty, PRInt32 &propertyValue, PRInt32 defaultValue = 0);
|
||||
|
||||
nsMsgKeyArray m_lateredKeys; // list of latered messages
|
||||
nsTArray<nsMsgKey> m_lateredKeys; // list of latered messages
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "nsIMsgDBView.idl"
|
||||
|
||||
%{C++
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "nsTArray.h"
|
||||
%}
|
||||
|
||||
interface nsIDBChangeListener;
|
||||
|
@ -103,8 +103,8 @@ interface nsMsgDBCommitType
|
|||
const long kCompressCommit = 3;
|
||||
};
|
||||
|
||||
[ref] native nsMsgKeyArrayRef(nsMsgKeyArray);
|
||||
[ptr] native nsMsgKeyArrayPtr(nsMsgKeyArray);
|
||||
[ref] native nsMsgKeyArrayRef(nsTArray<nsMsgKey>);
|
||||
[ptr] native nsMsgKeyArrayPtr(nsTArray<nsMsgKey>);
|
||||
|
||||
[scriptable, uuid(03223c50-1e88-45e8-ba1a-7ce792dc3fc3)]
|
||||
interface nsIMsgDBService : nsISupports
|
||||
|
|
|
@ -41,9 +41,9 @@
|
|||
#include "nsMsgDatabase.h"
|
||||
#include "nsMsgMessageFlags.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
// This is the subclass of nsMsgDatabase that handles local mail messages.
|
||||
class nsMsgKeyArray;
|
||||
class nsIOFileStream;
|
||||
class nsILocalFile;
|
||||
class nsOfflineImapOperation;
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
virtual ~nsMailDatabase();
|
||||
NS_IMETHOD Open(nsILocalFile *aFolderName, PRBool create, PRBool upgrading);
|
||||
NS_IMETHOD ForceClosed();
|
||||
NS_IMETHOD DeleteMessages(nsMsgKeyArray* nsMsgKeys, nsIDBChangeListener *instigator);
|
||||
NS_IMETHOD DeleteMessages(nsTArray<nsMsgKey>* nsMsgKeys, nsIDBChangeListener *instigator);
|
||||
|
||||
NS_IMETHOD StartBatch();
|
||||
NS_IMETHOD EndBatch();
|
||||
|
@ -73,8 +73,8 @@ public:
|
|||
NS_IMETHOD GetSummaryValid(PRBool *valid);
|
||||
|
||||
NS_IMETHOD EnumerateOfflineOps(nsISimpleEnumerator **enumerator);
|
||||
NS_IMETHOD ListAllOfflineOpIds(nsMsgKeyArray *offlineOpIds);
|
||||
NS_IMETHOD ListAllOfflineDeletes(nsMsgKeyArray *offlineDeletes);
|
||||
NS_IMETHOD ListAllOfflineOpIds(nsTArray<nsMsgKey> *offlineOpIds);
|
||||
NS_IMETHOD ListAllOfflineDeletes(nsTArray<nsMsgKey> *offlineDeletes);
|
||||
|
||||
NS_IMETHOD SetFolderStream(nsIOutputStream *aFileStream);
|
||||
NS_IMETHOD GetFolderStream(nsIOutputStream **aFileStream);
|
||||
|
|
|
@ -53,8 +53,8 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "pldhash.h"
|
||||
#include "nsTArray.h"
|
||||
class ListContext;
|
||||
class nsMsgKeyArray;
|
||||
class nsMsgKeySet;
|
||||
class nsMsgThread;
|
||||
class nsIMsgThread;
|
||||
|
@ -96,7 +96,7 @@ public:
|
|||
nsresult GetSearchResultsTable(const char *searchFolderUri, PRBool createIfMissing, nsIMdbTable **table);
|
||||
|
||||
// this might just be for debugging - we'll see.
|
||||
nsresult ListAllThreads(nsMsgKeyArray *threadIds);
|
||||
nsresult ListAllThreads(nsTArray<nsMsgKey> *threadIds);
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// nsMsgDatabase methods:
|
||||
nsMsgDatabase();
|
||||
|
@ -241,7 +241,7 @@ protected:
|
|||
nsIMdbTable *m_mdbAllMsgHeadersTable;
|
||||
nsIMdbTable *m_mdbAllThreadsTable;
|
||||
nsCString m_dbName;
|
||||
nsMsgKeyArray m_newSet; // new messages since last open.
|
||||
nsTArray<nsMsgKey> m_newSet; // new messages since last open.
|
||||
PRBool m_mdbTokensInitialized;
|
||||
nsCOMPtr <nsISupportsArray> m_ChangeListeners;
|
||||
mdb_token m_hdrRowScopeToken;
|
||||
|
|
|
@ -39,9 +39,9 @@
|
|||
|
||||
#include "nsMsgDatabase.h"
|
||||
#include "nsINewsDatabase.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsIDBChangeListener;
|
||||
class nsMsgKeyArray;
|
||||
class MSG_RetrieveArtInfo;
|
||||
class MSG_PurgeInfo;
|
||||
// news group database
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
|
||||
NS_IMETHOD GetHighWaterArticleNum(nsMsgKey *key);
|
||||
NS_IMETHOD GetLowWaterArticleNum(nsMsgKey *key);
|
||||
NS_IMETHOD MarkAllRead(nsMsgKeyArray *thoseMarked);
|
||||
NS_IMETHOD MarkAllRead(nsTArray<nsMsgKey> *thoseMarked);
|
||||
|
||||
virtual nsresult ExpireUpTo(nsMsgKey expireKey);
|
||||
virtual nsresult ExpireRange(nsMsgKey startRange, nsMsgKey endRange);
|
||||
|
|
|
@ -165,7 +165,7 @@ NS_IMETHODIMP nsMailDatabase::EndBatch()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailDatabase::DeleteMessages(nsMsgKeyArray* nsMsgKeys, nsIDBChangeListener *instigator)
|
||||
NS_IMETHODIMP nsMailDatabase::DeleteMessages(nsTArray<nsMsgKey>* nsMsgKeys, nsIDBChangeListener *instigator)
|
||||
{
|
||||
nsresult rv;
|
||||
if (!m_folderStream && m_folder)
|
||||
|
@ -594,7 +594,7 @@ NS_IMETHODIMP nsMailDatabase::EnumerateOfflineOps(nsISimpleEnumerator **enumerat
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMailDatabase::ListAllOfflineOpIds(nsMsgKeyArray *offlineOpIds)
|
||||
NS_IMETHODIMP nsMailDatabase::ListAllOfflineOpIds(nsTArray<nsMsgKey> *offlineOpIds)
|
||||
{
|
||||
NS_ENSURE_ARG(offlineOpIds);
|
||||
nsresult rv = GetAllOfflineOpsTable();
|
||||
|
@ -617,7 +617,7 @@ NS_IMETHODIMP nsMailDatabase::ListAllOfflineOpIds(nsMsgKeyArray *offlineOpIds)
|
|||
break;
|
||||
if (err == NS_OK)
|
||||
{
|
||||
offlineOpIds->Add(outOid.mOid_Id);
|
||||
offlineOpIds->AppendElement(outOid.mOid_Id);
|
||||
if (PR_LOG_TEST(IMAPOffline, PR_LOG_ALWAYS))
|
||||
{
|
||||
nsCOMPtr <nsIMsgOfflineImapOperation> offlineOp;
|
||||
|
@ -636,11 +636,11 @@ NS_IMETHODIMP nsMailDatabase::ListAllOfflineOpIds(nsMsgKeyArray *offlineOpIds)
|
|||
rowCursor->Release();
|
||||
}
|
||||
|
||||
offlineOpIds->QuickSort();
|
||||
offlineOpIds->Sort();
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailDatabase::ListAllOfflineDeletes(nsMsgKeyArray *offlineDeletes)
|
||||
NS_IMETHODIMP nsMailDatabase::ListAllOfflineDeletes(nsTArray<nsMsgKey> *offlineDeletes)
|
||||
{
|
||||
if (!offlineDeletes)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -676,7 +676,7 @@ NS_IMETHODIMP nsMailDatabase::ListAllOfflineDeletes(nsMsgKeyArray *offlineDelete
|
|||
if (opType & nsIMsgOfflineImapOperation::kMsgMoved ||
|
||||
((opType & nsIMsgOfflineImapOperation::kFlagsChanged)
|
||||
&& (newFlags & nsIMsgOfflineImapOperation::kMsgMarkedDeleted)))
|
||||
offlineDeletes->Add(outOid.mOid_Id);
|
||||
offlineDeletes->AppendElement(outOid.mOid_Id);
|
||||
NS_RELEASE(offlineOp);
|
||||
}
|
||||
offlineOpRow->Release();
|
||||
|
|
|
@ -1766,12 +1766,12 @@ NS_IMETHODIMP nsMsgDatabase::DeleteMessage(nsMsgKey key, nsIDBChangeListener *in
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::DeleteMessages(nsMsgKeyArray* nsMsgKeys, nsIDBChangeListener *instigator)
|
||||
NS_IMETHODIMP nsMsgDatabase::DeleteMessages(nsTArray<nsMsgKey>* nsMsgKeys, nsIDBChangeListener *instigator)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
|
||||
PRUint32 kindex;
|
||||
for (kindex = 0; kindex < nsMsgKeys->GetSize(); kindex++)
|
||||
for (kindex = 0; kindex < nsMsgKeys->Length(); kindex++)
|
||||
{
|
||||
nsMsgKey key = nsMsgKeys->ElementAt(kindex);
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
|
@ -1922,7 +1922,7 @@ PRUint32 nsMsgDatabase::GetStatusFlags(nsIMsgDBHdr *msgHdr, PRUint32 origFlags)
|
|||
|
||||
nsMsgKey key;
|
||||
(void)msgHdr->GetMessageKey(&key);
|
||||
if (m_newSet.GetSize() > 0 && m_newSet[m_newSet.GetSize() - 1] == key || m_newSet.IndexOfSorted(key) != kNotFound)
|
||||
if (!m_newSet.IsEmpty() && m_newSet[m_newSet.Length() - 1] == key || m_newSet.BinaryIndexOf(key) != kNotFound)
|
||||
statusFlags |= MSG_FLAG_NEW;
|
||||
else
|
||||
statusFlags &= ~MSG_FLAG_NEW;
|
||||
|
@ -2065,7 +2065,7 @@ NS_IMETHODIMP nsMsgDatabase::MarkHasAttachments(nsMsgKey key, PRBool bHasAttachm
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDatabase::MarkThreadRead(nsIMsgThread *thread, nsIDBChangeListener *instigator, nsMsgKeyArray *thoseMarked)
|
||||
nsMsgDatabase::MarkThreadRead(nsIMsgThread *thread, nsIDBChangeListener *instigator, nsTArray<nsMsgKey> *thoseMarked)
|
||||
{
|
||||
if (!thread)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -2088,7 +2088,7 @@ nsMsgDatabase::MarkThreadRead(nsIMsgThread *thread, nsIDBChangeListener *instiga
|
|||
{
|
||||
nsMsgKey key;
|
||||
if (NS_SUCCEEDED(child->GetMessageKey(&key)))
|
||||
thoseMarked->Add(key);
|
||||
thoseMarked->AppendElement(key);
|
||||
}
|
||||
MarkHdrRead(child, PR_TRUE, instigator);
|
||||
}
|
||||
|
@ -2368,7 +2368,7 @@ NS_IMETHODIMP nsMsgDatabase::MarkHdrMarked(nsIMsgDBHdr *msgHdr, PRBool mark,
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::MarkAllRead(nsMsgKeyArray *thoseMarked)
|
||||
NS_IMETHODIMP nsMsgDatabase::MarkAllRead(nsTArray<nsMsgKey> *thoseMarked)
|
||||
{
|
||||
nsresult rv;
|
||||
nsMsgHdr *pHeader;
|
||||
|
@ -2395,7 +2395,7 @@ NS_IMETHODIMP nsMsgDatabase::MarkAllRead(nsMsgKeyArray *thoseMarked)
|
|||
{
|
||||
nsMsgKey key;
|
||||
(void)pHeader->GetMessageKey(&key);
|
||||
thoseMarked->Add(key);
|
||||
thoseMarked->AppendElement(key);
|
||||
}
|
||||
rv = MarkHdrRead(pHeader, PR_TRUE, nsnull); // ### dmb - blow off error?
|
||||
}
|
||||
|
@ -2412,7 +2412,7 @@ NS_IMETHODIMP nsMsgDatabase::MarkAllRead(nsMsgKeyArray *thoseMarked)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::MarkReadByDate (PRTime startDate, PRTime endDate, nsMsgKeyArray *markedIds)
|
||||
NS_IMETHODIMP nsMsgDatabase::MarkReadByDate (PRTime startDate, PRTime endDate, nsTArray<nsMsgKey> *markedIds)
|
||||
{
|
||||
nsresult rv;
|
||||
nsMsgHdr *pHeader;
|
||||
|
@ -2448,7 +2448,7 @@ NS_IMETHODIMP nsMsgDatabase::MarkReadByDate (PRTime startDate, PRTime endDate, n
|
|||
{
|
||||
numChanged++;
|
||||
if (markedIds)
|
||||
markedIds->Add(key);
|
||||
markedIds->AppendElement(key);
|
||||
rv = MarkHdrRead(pHeader, PR_TRUE, NULL); // ### dmb - blow off error?
|
||||
}
|
||||
}
|
||||
|
@ -2463,9 +2463,8 @@ NS_IMETHODIMP nsMsgDatabase::MarkReadByDate (PRTime startDate, PRTime endDate, n
|
|||
NS_IMETHODIMP nsMsgDatabase::AddToNewList(nsMsgKey key)
|
||||
{
|
||||
// we add new keys in increasing order...
|
||||
if (m_newSet.GetSize() == 0
|
||||
|| (m_newSet[m_newSet.GetSize() - 1] < key))
|
||||
m_newSet.Add(key);
|
||||
if (m_newSet.IsEmpty() || (m_newSet[m_newSet.Length() - 1] < key))
|
||||
m_newSet.AppendElement(key);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2473,15 +2472,14 @@ NS_IMETHODIMP nsMsgDatabase::AddToNewList(nsMsgKey key)
|
|||
NS_IMETHODIMP nsMsgDatabase::ClearNewList(PRBool notify /* = FALSE */)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
if (notify && m_newSet.GetSize() > 0) // need to update view
|
||||
if (notify && !m_newSet.IsEmpty()) // need to update view
|
||||
{
|
||||
nsMsgKeyArray saveNewSet;
|
||||
saveNewSet.CopyArray(m_newSet);
|
||||
nsTArray<nsMsgKey> saveNewSet;
|
||||
// clear m_newSet so that the code that's listening to the key change
|
||||
// doesn't think we have new messages and send notifications all over
|
||||
// that we have new messages.
|
||||
m_newSet.RemoveAll();
|
||||
for (PRUint32 elementIndex = saveNewSet.GetSize() - 1; ; elementIndex--)
|
||||
saveNewSet.SwapElements(m_newSet);
|
||||
for (PRUint32 elementIndex = saveNewSet.Length() - 1; ; elementIndex--)
|
||||
{
|
||||
nsMsgKey lastNewKey = saveNewSet.ElementAt(elementIndex);
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
|
@ -2505,7 +2503,7 @@ NS_IMETHODIMP nsMsgDatabase::HasNew(PRBool *_retval)
|
|||
{
|
||||
if (!_retval) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*_retval = (m_newSet.GetSize() > 0);
|
||||
*_retval = (m_newSet.Length() > 0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2728,7 +2726,7 @@ nsMsgDatabase::SyncCounts()
|
|||
|
||||
|
||||
// resulting output array is sorted by key.
|
||||
NS_IMETHODIMP nsMsgDatabase::ListAllKeys(nsMsgKeyArray &outputKeys)
|
||||
NS_IMETHODIMP nsMsgDatabase::ListAllKeys(nsTArray<nsMsgKey> &outputKeys)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
nsIMdbTableRowCursor *rowCursor;
|
||||
|
@ -2745,11 +2743,11 @@ NS_IMETHODIMP nsMsgDatabase::ListAllKeys(nsMsgKeyArray &outputKeys)
|
|||
if (outPos < 0 || outOid.mOid_Id == (mdb_id) -1)
|
||||
break;
|
||||
if (err == NS_OK)
|
||||
outputKeys.Add(outOid.mOid_Id);
|
||||
outputKeys.AppendElement(outOid.mOid_Id);
|
||||
}
|
||||
rowCursor->Release();
|
||||
}
|
||||
outputKeys.QuickSort();
|
||||
outputKeys.Sort();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -3343,7 +3341,7 @@ nsresult nsMsgDatabase::CharPtrToRowCellColumn(nsIMdbRow *row, mdb_token columnT
|
|||
return row->AddColumn(GetEnv(), columnToken, &yarn);
|
||||
}
|
||||
|
||||
// caller must PR_FREEIF result
|
||||
// caller must NS_Free result
|
||||
nsresult nsMsgDatabase::RowCellColumnToCharPtr(nsIMdbRow *row, mdb_token columnToken, char **result)
|
||||
{
|
||||
nsresult err = NS_ERROR_NULL_POINTER;
|
||||
|
@ -3354,13 +3352,12 @@ nsresult nsMsgDatabase::RowCellColumnToCharPtr(nsIMdbRow *row, mdb_token columnT
|
|||
err = row->AliasCellYarn(GetEnv(), columnToken, &yarn);
|
||||
if (err == NS_OK)
|
||||
{
|
||||
*result = (char *) PR_CALLOC(yarn.mYarn_Fill + 1);
|
||||
*result = (char *)NS_Alloc(yarn.mYarn_Fill + 1);
|
||||
if (*result)
|
||||
{
|
||||
if (yarn.mYarn_Fill > 0)
|
||||
memcpy(*result, yarn.mYarn_Buf, yarn.mYarn_Fill);
|
||||
else
|
||||
**result = 0;
|
||||
result[yarn.mYarn_Fill] = '\0';
|
||||
}
|
||||
else
|
||||
err = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -4214,7 +4211,7 @@ nsresult nsMsgDatabase::GetIntPref(const char *prefName, PRInt32 *result)
|
|||
}
|
||||
|
||||
|
||||
nsresult nsMsgDatabase::ListAllThreads(nsMsgKeyArray *threadIds)
|
||||
nsresult nsMsgDatabase::ListAllThreads(nsTArray<nsMsgKey> *threadIds)
|
||||
{
|
||||
nsresult rv;
|
||||
nsMsgThread *pThread;
|
||||
|
@ -4232,7 +4229,7 @@ nsresult nsMsgDatabase::ListAllThreads(nsMsgKeyArray *threadIds)
|
|||
if (threadIds) {
|
||||
nsMsgKey key;
|
||||
(void)pThread->GetThreadKey(&key);
|
||||
threadIds->Add(key);
|
||||
threadIds->AppendElement(key);
|
||||
}
|
||||
// NS_RELEASE(pThread);
|
||||
pThread = nsnull;
|
||||
|
@ -4259,7 +4256,7 @@ NS_IMETHODIMP nsMsgDatabase::RemoveOfflineOp(nsIMsgOfflineImapOperation *op)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::ListAllOfflineMsgs(nsMsgKeyArray *outputKeys)
|
||||
NS_IMETHODIMP nsMsgDatabase::ListAllOfflineMsgs(nsTArray<nsMsgKey> *outputKeys)
|
||||
{
|
||||
nsCOMPtr <nsISimpleEnumerator> enumerator;
|
||||
PRUint32 flag = MSG_FLAG_OFFLINE;
|
||||
|
@ -4283,11 +4280,11 @@ NS_IMETHODIMP nsMsgDatabase::ListAllOfflineMsgs(nsMsgKeyArray *outputKeys)
|
|||
{
|
||||
nsMsgKey msgKey;
|
||||
dbMessage->GetMessageKey(&msgKey);
|
||||
outputKeys->Add(msgKey);
|
||||
outputKeys->AppendElement(msgKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
outputKeys->QuickSort();
|
||||
outputKeys->Sort();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -4298,13 +4295,13 @@ NS_IMETHODIMP nsMsgDatabase::EnumerateOfflineOps(nsISimpleEnumerator **enumerato
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::ListAllOfflineOpIds(nsMsgKeyArray *offlineOpIds)
|
||||
NS_IMETHODIMP nsMsgDatabase::ListAllOfflineOpIds(nsTArray<nsMsgKey> *offlineOpIds)
|
||||
{
|
||||
NS_ASSERTION(PR_FALSE, "overridden by nsMailDatabase");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::ListAllOfflineDeletes(nsMsgKeyArray *offlineDeletes)
|
||||
NS_IMETHODIMP nsMsgDatabase::ListAllOfflineDeletes(nsTArray<nsMsgKey> *offlineDeletes)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
if (!offlineDeletes)
|
||||
|
@ -4366,9 +4363,9 @@ nsresult nsMsgDatabase::DumpContents()
|
|||
nsMsgKey key;
|
||||
PRUint32 i;
|
||||
|
||||
nsMsgKeyArray keys;
|
||||
nsTArray<nsMsgKey> keys;
|
||||
nsresult rv = ListAllKeys(keys);
|
||||
for (i = 0; i < keys.GetSize(); i++) {
|
||||
for (i = 0; i < keys.Length(); i++) {
|
||||
key = keys[i];
|
||||
nsIMsgDBHdr *msg = NULL;
|
||||
rv = GetMsgHdrForKey(key, &msg);
|
||||
|
@ -4385,9 +4382,9 @@ nsresult nsMsgDatabase::DumpContents()
|
|||
NS_RELEASE(msgHdr);
|
||||
}
|
||||
}
|
||||
nsMsgKeyArray threads;
|
||||
nsTArray<nsMsgKey> threads;
|
||||
rv = ListAllThreads(&threads);
|
||||
for ( i = 0; i < threads.GetSize(); i++)
|
||||
for ( i = 0; i < threads.Length(); i++)
|
||||
{
|
||||
key = threads[i];
|
||||
printf("thread key = %u\n", key);
|
||||
|
@ -4639,7 +4636,7 @@ nsresult nsMsgDatabase::PurgeMessagesOlderThan(PRUint32 daysToKeepHdrs,
|
|||
nsMsgHdr *pHeader;
|
||||
nsCOMPtr <nsISimpleEnumerator> hdrs;
|
||||
rv = EnumerateMessages(getter_AddRefs(hdrs));
|
||||
nsMsgKeyArray keysToDelete;
|
||||
nsTArray<nsMsgKey> keysToDelete;
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -4684,7 +4681,7 @@ nsresult nsMsgDatabase::PurgeMessagesOlderThan(PRUint32 daysToKeepHdrs,
|
|||
{
|
||||
nsMsgKey msgKey;
|
||||
pHeader->GetMessageKey(&msgKey);
|
||||
keysToDelete.Add(msgKey);
|
||||
keysToDelete.AppendElement(msgKey);
|
||||
if (hdrsToDelete)
|
||||
hdrsToDelete->AppendElement(pHeader);
|
||||
}
|
||||
|
@ -4695,9 +4692,9 @@ nsresult nsMsgDatabase::PurgeMessagesOlderThan(PRUint32 daysToKeepHdrs,
|
|||
{
|
||||
DeleteMessages(&keysToDelete, nsnull);
|
||||
|
||||
if (keysToDelete.GetSize() > 10) // compress commit if we deleted more than 10
|
||||
if (keysToDelete.Length() > 10) // compress commit if we deleted more than 10
|
||||
Commit(nsMsgDBCommitType::kCompressCommit);
|
||||
else if (keysToDelete.GetSize() > 0)
|
||||
else if (!keysToDelete.IsEmpty())
|
||||
Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
}
|
||||
return rv;
|
||||
|
@ -4713,7 +4710,7 @@ nsresult nsMsgDatabase::PurgeExcessMessages(PRUint32 numHeadersToKeep, PRBool ke
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
PRBool hasMore = PR_FALSE;
|
||||
nsMsgKeyArray keysToDelete;
|
||||
nsTArray<nsMsgKey> keysToDelete;
|
||||
|
||||
mdb_count numHdrs = 0;
|
||||
if (m_mdbAllMsgHeadersTable)
|
||||
|
@ -4745,7 +4742,7 @@ nsresult nsMsgDatabase::PurgeExcessMessages(PRUint32 numHeadersToKeep, PRBool ke
|
|||
{
|
||||
nsMsgKey msgKey;
|
||||
pHeader->GetMessageKey(&msgKey);
|
||||
keysToDelete.Add(msgKey);
|
||||
keysToDelete.AppendElement(msgKey);
|
||||
numHdrs--;
|
||||
if (hdrsToDelete)
|
||||
hdrsToDelete->AppendElement(pHeader);
|
||||
|
@ -4755,7 +4752,7 @@ nsresult nsMsgDatabase::PurgeExcessMessages(PRUint32 numHeadersToKeep, PRBool ke
|
|||
|
||||
if (!hdrsToDelete)
|
||||
{
|
||||
PRInt32 numKeysToDelete = keysToDelete.GetSize();
|
||||
PRInt32 numKeysToDelete = keysToDelete.Length();
|
||||
if (numKeysToDelete > 0)
|
||||
{
|
||||
DeleteMessages(&keysToDelete, nsnull);
|
||||
|
@ -5003,13 +5000,13 @@ nsMsgDatabase::GetNewList(PRUint32 *aCount, PRUint32 **aNewKeys)
|
|||
NS_ENSURE_ARG_POINTER(aCount);
|
||||
NS_ENSURE_ARG_POINTER(aNewKeys);
|
||||
|
||||
*aCount = m_newSet.GetSize();
|
||||
*aCount = m_newSet.Length();
|
||||
if (*aCount > 0)
|
||||
{
|
||||
*aNewKeys = static_cast<PRUint32 *>(nsMemory::Alloc(*aCount * sizeof(PRUint32)));
|
||||
if (!*aNewKeys)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
memcpy(*aNewKeys, m_newSet.GetArray(), *aCount * sizeof(PRUint32));
|
||||
memcpy(*aNewKeys, m_newSet.Elements(), *aCount * sizeof(PRUint32));
|
||||
return NS_OK;
|
||||
}
|
||||
// if there were no new messages, signal this by returning a null pointer
|
||||
|
@ -5062,7 +5059,7 @@ NS_IMETHODIMP nsMsgDatabase::RefreshCache(const char *aSearchFolderUri, PRUint32
|
|||
|
||||
PRUint32 rowCount;
|
||||
table->GetCount(GetEnv(), &rowCount);
|
||||
nsMsgKeyArray staleHits;
|
||||
nsTArray<nsMsgKey> staleHits;
|
||||
// should assert that each array is sorted
|
||||
while (newHitIndex < aNumKeys || tableRowIndex < rowCount)
|
||||
{
|
||||
|
@ -5109,19 +5106,19 @@ NS_IMETHODIMP nsMsgDatabase::RefreshCache(const char *aSearchFolderUri, PRUint32
|
|||
}
|
||||
else if (newHitIndex >= aNumKeys || aNewHits[newHitIndex] > tableRowKey)
|
||||
{
|
||||
staleHits.Add(tableRowKey);
|
||||
staleHits.AppendElement(tableRowKey);
|
||||
table->CutOid(GetEnv(), &oid);
|
||||
rowCount--;
|
||||
continue; // don't increment tableRowIndex since we removed that row.
|
||||
}
|
||||
}
|
||||
*aNumBadHits = staleHits.GetSize();
|
||||
*aNumBadHits = staleHits.Length();
|
||||
if (*aNumBadHits)
|
||||
{
|
||||
*aStaleHits = static_cast<PRUint32 *>(nsMemory::Alloc(*aNumBadHits * sizeof(PRUint32)));
|
||||
if (!*aStaleHits)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
memcpy(*aStaleHits, staleHits.GetArray(), *aNumBadHits * sizeof(PRUint32));
|
||||
memcpy(*aStaleHits, staleHits.Elements(), *aNumBadHits * sizeof(PRUint32));
|
||||
}
|
||||
else
|
||||
*aStaleHits = nsnull;
|
||||
|
|
|
@ -253,7 +253,7 @@ PRBool nsNewsDatabase::SetHdrReadFlag(nsIMsgDBHdr *msgHdr, PRBool bRead)
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNewsDatabase::MarkAllRead(nsMsgKeyArray *thoseMarked)
|
||||
NS_IMETHODIMP nsNewsDatabase::MarkAllRead(nsTArray<nsMsgKey> *thoseMarked)
|
||||
{
|
||||
nsMsgKey lowWater = nsMsgKey_None, highWater;
|
||||
nsCString knownArts;
|
||||
|
|
|
@ -120,7 +120,7 @@ nsImapFlagAndUidState::nsImapFlagAndUidState(PRInt32 numberOfMessages, PRUint16
|
|||
fNumberOfMessageSlotsAllocated = kImapFlagAndUidStateSize;
|
||||
fFlags = (imapMessageFlagsType*) PR_Malloc(sizeof(imapMessageFlagsType) * fNumberOfMessageSlotsAllocated); // new imapMessageFlagsType[fNumberOfMessageSlotsAllocated];
|
||||
|
||||
fUids.SetSize(fNumberOfMessageSlotsAllocated);
|
||||
fUids.InsertElementsAt(0, fNumberOfMessageSlotsAllocated, 0);
|
||||
memset(fFlags, 0, sizeof(imapMessageFlagsType) * fNumberOfMessageSlotsAllocated);
|
||||
fSupportedUserFlags = flags;
|
||||
fNumberDeleted = 0;
|
||||
|
@ -134,7 +134,7 @@ nsImapFlagAndUidState::nsImapFlagAndUidState(const nsImapFlagAndUidState& state,
|
|||
|
||||
fNumberOfMessageSlotsAllocated = state.fNumberOfMessageSlotsAllocated;
|
||||
fFlags = (imapMessageFlagsType*) PR_Malloc(sizeof(imapMessageFlagsType) * fNumberOfMessageSlotsAllocated); // new imapMessageFlagsType[fNumberOfMessageSlotsAllocated];
|
||||
fUids.CopyArray((nsMsgKeyArray *) &state.fUids);
|
||||
fUids = state.fUids;
|
||||
|
||||
memcpy(fFlags, state.fFlags, sizeof(imapMessageFlagsType) * fNumberOfMessageSlotsAllocated);
|
||||
fSupportedUserFlags = flags;
|
||||
|
@ -200,7 +200,7 @@ NS_IMETHODIMP nsImapFlagAndUidState::ExpungeByIndex(PRUint32 msgIndex)
|
|||
fNumberDeleted--;
|
||||
for (counter = msgIndex; counter < (PRUint32) fNumberOfMessagesAdded; counter++)
|
||||
{
|
||||
fUids[counter] = fUids[counter + 1];
|
||||
fUids[counter] = fUids[counter + 1];
|
||||
fFlags[counter] = fFlags[counter + 1];
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ NS_IMETHODIMP nsImapFlagAndUidState::AddUidFlagPair(PRUint32 uid, imapMessageFla
|
|||
if (fNumberOfMessagesAdded >= fNumberOfMessageSlotsAllocated)
|
||||
{
|
||||
fNumberOfMessageSlotsAllocated += kImapFlagAndUidStateSize;
|
||||
fUids.SetSize(fNumberOfMessageSlotsAllocated);
|
||||
fUids.InsertElementsAt(fUids.Length(), kImapFlagAndUidStateSize, 0);
|
||||
fFlags = (imapMessageFlagsType*) PR_REALLOC(fFlags, sizeof(imapMessageFlagsType) * fNumberOfMessageSlotsAllocated); // new imapMessageFlagsType[fNumberOfMessageSlotsAllocated];
|
||||
if (!fFlags)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
|
@ -38,7 +38,8 @@
|
|||
#ifndef nsImapFlagAndUidState_h___
|
||||
#define nsImapFlagAndUidState_h___
|
||||
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIImapFlagAndUidState.h"
|
||||
|
||||
const PRInt32 kImapFlagAndUidStateSize = 100;
|
||||
|
@ -71,7 +72,7 @@ private:
|
|||
PRInt32 fNumberOfMessagesAdded;
|
||||
PRInt32 fNumberOfMessageSlotsAllocated;
|
||||
PRInt32 fNumberDeleted;
|
||||
nsMsgKeyArray fUids;
|
||||
nsTArray<nsMsgKey> fUids;
|
||||
imapMessageFlagsType *fFlags;
|
||||
nsDataHashtable<nsUint32HashKey, char *> m_customFlagsHash; // Hash table, mapping uids to extra flags
|
||||
PRUint16 fSupportedUserFlags;
|
||||
|
|
|
@ -120,8 +120,6 @@
|
|||
#include "nsCExternalHandlerService.h"
|
||||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID);
|
||||
static NS_DEFINE_CID(kCImapDB, NS_IMAPDB_CID);
|
||||
static NS_DEFINE_CID(kParseMailMsgStateCID, NS_PARSEMAILMSGSTATE_CID);
|
||||
static NS_DEFINE_CID(kCImapHostSessionList, NS_IIMAPHOSTSESSIONLIST_CID);
|
||||
|
||||
|
@ -1709,11 +1707,11 @@ nsImapMailFolder::MarkMessagesRead(nsISupportsArray *messages, PRBool markRead)
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCAutoString messageIds;
|
||||
nsMsgKeyArray keysToMarkRead;
|
||||
nsTArray<nsMsgKey> keysToMarkRead;
|
||||
rv = BuildIdsAndKeyArray(messages, messageIds, keysToMarkRead);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
StoreImapFlags(kImapMsgSeenFlag, markRead, keysToMarkRead.GetArray(), keysToMarkRead.GetSize(), nsnull);
|
||||
StoreImapFlags(kImapMsgSeenFlag, markRead, keysToMarkRead.Elements(), keysToMarkRead.Length(), nsnull);
|
||||
rv = GetDatabase(nsnull);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
|
@ -1730,10 +1728,10 @@ nsImapMailFolder::SetLabelForMessages(nsISupportsArray *aMessages, nsMsgLabelVal
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCAutoString messageIds;
|
||||
nsMsgKeyArray keysToLabel;
|
||||
nsTArray<nsMsgKey> keysToLabel;
|
||||
nsresult rv = BuildIdsAndKeyArray(aMessages, messageIds, keysToLabel);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
StoreImapFlags((aLabel << 9), PR_TRUE, keysToLabel.GetArray(), keysToLabel.GetSize(), nsnull);
|
||||
StoreImapFlags((aLabel << 9), PR_TRUE, keysToLabel.Elements(), keysToLabel.Length(), nsnull);
|
||||
rv = GetDatabase(nsnull);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
|
@ -1747,14 +1745,14 @@ nsImapMailFolder::MarkAllMessagesRead(void)
|
|||
nsresult rv = GetDatabase(nsnull);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsMsgKeyArray thoseMarked;
|
||||
nsTArray<nsMsgKey> thoseMarked;
|
||||
EnableNotifications(allMessageCountNotifications, PR_FALSE, PR_TRUE /*dbBatching*/);
|
||||
rv = mDatabase->MarkAllRead(&thoseMarked);
|
||||
EnableNotifications(allMessageCountNotifications, PR_TRUE, PR_TRUE /*dbBatching*/);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = StoreImapFlags(kImapMsgSeenFlag, PR_TRUE, thoseMarked.GetArray(),
|
||||
thoseMarked.GetSize(), nsnull);
|
||||
rv = StoreImapFlags(kImapMsgSeenFlag, PR_TRUE, thoseMarked.Elements(),
|
||||
thoseMarked.Length(), nsnull);
|
||||
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
}
|
||||
}
|
||||
|
@ -1766,12 +1764,12 @@ NS_IMETHODIMP nsImapMailFolder::MarkThreadRead(nsIMsgThread *thread)
|
|||
nsresult rv = GetDatabase(nsnull);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsMsgKeyArray thoseMarked;
|
||||
nsTArray<nsMsgKey> thoseMarked;
|
||||
rv = mDatabase->MarkThreadRead(thread, nsnull, &thoseMarked);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = StoreImapFlags(kImapMsgSeenFlag, PR_TRUE, thoseMarked.GetArray(),
|
||||
thoseMarked.GetSize(), nsnull);
|
||||
rv = StoreImapFlags(kImapMsgSeenFlag, PR_TRUE, thoseMarked.Elements(),
|
||||
thoseMarked.Length(), nsnull);
|
||||
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
}
|
||||
}
|
||||
|
@ -1817,11 +1815,11 @@ nsImapMailFolder::MarkMessagesFlagged(nsISupportsArray *messages, PRBool markFla
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCAutoString messageIds;
|
||||
nsMsgKeyArray keysToMarkFlagged;
|
||||
nsTArray<nsMsgKey> keysToMarkFlagged;
|
||||
rv = BuildIdsAndKeyArray(messages, messageIds, keysToMarkFlagged);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = StoreImapFlags(kImapMsgFlaggedFlag, markFlagged, keysToMarkFlagged.GetArray(),
|
||||
keysToMarkFlagged.GetSize(), nsnull);
|
||||
rv = StoreImapFlags(kImapMsgFlaggedFlag, markFlagged, keysToMarkFlagged.Elements(),
|
||||
keysToMarkFlagged.Length(), nsnull);
|
||||
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
}
|
||||
return rv;
|
||||
|
@ -1908,7 +1906,7 @@ nsImapMailFolder::GetDBFolderInfoAndDB(nsIDBFolderInfo **folderInfo, nsIMsgDatab
|
|||
nsresult
|
||||
nsImapMailFolder::BuildIdsAndKeyArray(nsISupportsArray* messages,
|
||||
nsCString& msgIds,
|
||||
nsMsgKeyArray& keyArray)
|
||||
nsTArray<nsMsgKey>& keyArray)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(messages);
|
||||
nsresult rv;
|
||||
|
@ -1925,9 +1923,9 @@ nsImapMailFolder::BuildIdsAndKeyArray(nsISupportsArray* messages,
|
|||
if (msgDBHdr)
|
||||
rv = msgDBHdr->GetMessageKey(&key);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
keyArray.Add(key);
|
||||
keyArray.AppendElement(key);
|
||||
}
|
||||
return AllocateUidStringFromKeys(keyArray.GetArray(), keyArray.GetSize(), msgIds);
|
||||
return AllocateUidStringFromKeys(keyArray.Elements(), keyArray.Length(), msgIds);
|
||||
}
|
||||
|
||||
static int PR_CALLBACK CompareKey (const void *v1, const void *v2, void *)
|
||||
|
@ -1985,9 +1983,9 @@ nsImapMailFolder::AllocateUidStringFromKeys(nsMsgKey *keys, PRUint32 numKeys, ns
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsImapMailFolder::MarkMessagesImapDeleted(nsMsgKeyArray *keyArray, PRBool deleted, nsIMsgDatabase *db)
|
||||
nsresult nsImapMailFolder::MarkMessagesImapDeleted(nsTArray<nsMsgKey> *keyArray, PRBool deleted, nsIMsgDatabase *db)
|
||||
{
|
||||
for (PRUint32 kindex = 0; kindex < keyArray->GetSize(); kindex++)
|
||||
for (PRUint32 kindex = 0; kindex < keyArray->Length(); kindex++)
|
||||
{
|
||||
nsMsgKey key = keyArray->ElementAt(kindex);
|
||||
db->MarkImapDeleted(key, deleted, nsnull);
|
||||
|
@ -2007,7 +2005,7 @@ NS_IMETHODIMP nsImapMailFolder::DeleteMessages(nsISupportsArray *messages,
|
|||
nsCAutoString uri;
|
||||
PRBool deleteImmediatelyNoTrash = PR_FALSE;
|
||||
nsCAutoString messageIds;
|
||||
nsMsgKeyArray srcKeyArray;
|
||||
nsTArray<nsMsgKey> srcKeyArray;
|
||||
PRBool deleteMsgs = PR_TRUE; //used for toggling delete status - default is true
|
||||
nsMsgImapDeleteModel deleteModel = nsMsgImapDeleteModels::MoveToTrash;
|
||||
imapMessageFlagsType messageFlags = kImapMsgDeletedFlag;
|
||||
|
@ -2100,8 +2098,8 @@ NS_IMETHODIMP nsImapMailFolder::DeleteMessages(nsISupportsArray *messages,
|
|||
nsCOMPtr <nsIUrlListener> urlListener = do_QueryInterface(listener);
|
||||
if (deleteMsgs)
|
||||
messageFlags |= kImapMsgSeenFlag;
|
||||
rv = StoreImapFlags(messageFlags, deleteMsgs, srcKeyArray.GetArray(),
|
||||
srcKeyArray.GetSize(), urlListener);
|
||||
rv = StoreImapFlags(messageFlags, deleteMsgs, srcKeyArray.Elements(),
|
||||
srcKeyArray.Length(), urlListener);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
@ -2331,7 +2329,7 @@ NS_IMETHODIMP nsImapMailFolder::Shutdown(PRBool shutdownChildren)
|
|||
return nsMsgDBFolder::Shutdown(shutdownChildren);
|
||||
}
|
||||
|
||||
nsresult nsImapMailFolder::GetBodysToDownload(nsMsgKeyArray *keysOfMessagesToDownload)
|
||||
nsresult nsImapMailFolder::GetBodysToDownload(nsTArray<nsMsgKey> *keysOfMessagesToDownload)
|
||||
{
|
||||
NS_ENSURE_ARG(keysOfMessagesToDownload);
|
||||
NS_ENSURE_TRUE(mDatabase, NS_ERROR_FAILURE);
|
||||
|
@ -2355,7 +2353,7 @@ nsresult nsImapMailFolder::GetBodysToDownload(nsMsgKeyArray *keysOfMessagesToDow
|
|||
else
|
||||
ShouldStoreMsgOffline(msgKey, &shouldStoreMsgOffline);
|
||||
if (shouldStoreMsgOffline)
|
||||
keysOfMessagesToDownload->Add(msgKey);
|
||||
keysOfMessagesToDownload->AppendElement(msgKey);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
|
@ -2395,9 +2393,9 @@ NS_IMETHODIMP nsImapMailFolder::UpdateImapMailboxInfo(nsIImapProtocol* aProtocol
|
|||
PRBool folderSelected;
|
||||
rv = aSpec->GetFolderSelected(&folderSelected);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsMsgKeyArray existingKeys;
|
||||
nsMsgKeyArray keysToDelete;
|
||||
nsMsgKeyArray keysToFetch;
|
||||
nsTArray<nsMsgKey> existingKeys;
|
||||
nsTArray<nsMsgKey> keysToDelete;
|
||||
nsTArray<nsMsgKey> keysToFetch;
|
||||
PRUint32 numNewUnread;
|
||||
nsCOMPtr<nsIDBFolderInfo> dbFolderInfo;
|
||||
PRInt32 imapUIDValidity = 0;
|
||||
|
@ -2408,10 +2406,10 @@ NS_IMETHODIMP nsImapMailFolder::UpdateImapMailboxInfo(nsIImapProtocol* aProtocol
|
|||
if (NS_SUCCEEDED(rv) && dbFolderInfo)
|
||||
dbFolderInfo->GetImapUidValidity(&imapUIDValidity);
|
||||
mDatabase->ListAllKeys(existingKeys);
|
||||
PRInt32 keyCount = existingKeys.GetSize();
|
||||
PRInt32 keyCount = existingKeys.Length();
|
||||
mDatabase->ListAllOfflineDeletes(&existingKeys);
|
||||
if (keyCount < existingKeys.GetSize())
|
||||
existingKeys.QuickSort();
|
||||
if (keyCount < existingKeys.Length())
|
||||
existingKeys.Sort();
|
||||
}
|
||||
PRInt32 folderValidity;
|
||||
aSpec->GetFolder_UIDVALIDITY(&folderValidity);
|
||||
|
@ -2484,12 +2482,12 @@ NS_IMETHODIMP nsImapMailFolder::UpdateImapMailboxInfo(nsIImapProtocol* aProtocol
|
|||
dbFolderInfo->SetImapUidValidity(folderValidity);
|
||||
// delete all my msgs, the keys are bogus now
|
||||
// add every message in this folder
|
||||
existingKeys.RemoveAll();
|
||||
existingKeys.Clear();
|
||||
// keysToDelete.CopyArray(&existingKeys);
|
||||
|
||||
if (flagState)
|
||||
{
|
||||
nsMsgKeyArray no_existingKeys;
|
||||
nsTArray<nsMsgKey> no_existingKeys;
|
||||
FindKeysToAdd(no_existingKeys, keysToFetch, numNewUnread, flagState);
|
||||
}
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -2497,7 +2495,7 @@ NS_IMETHODIMP nsImapMailFolder::UpdateImapMailboxInfo(nsIImapProtocol* aProtocol
|
|||
|
||||
}
|
||||
else if (!flagState /*&& !NET_IsOffline() */) // if there are no messages on the server
|
||||
keysToDelete.CopyArray(&existingKeys);
|
||||
keysToDelete = existingKeys;
|
||||
else /* if ( !NET_IsOffline()) */
|
||||
{
|
||||
FindKeysToDelete(existingKeys, keysToDelete, flagState);
|
||||
|
@ -2507,12 +2505,12 @@ NS_IMETHODIMP nsImapMailFolder::UpdateImapMailboxInfo(nsIImapProtocol* aProtocol
|
|||
if (!(boxFlags & kJustExpunged))
|
||||
FindKeysToAdd(existingKeys, keysToFetch, numNewUnread, flagState);
|
||||
}
|
||||
if (keysToDelete.GetSize() && mDatabase)
|
||||
if (!keysToDelete.IsEmpty() && mDatabase)
|
||||
{
|
||||
PRUint32 total;
|
||||
// It would be nice to notify RDF or whoever of a mass delete here.
|
||||
mDatabase->DeleteMessages(&keysToDelete, nsnull);
|
||||
total = keysToDelete.GetSize();
|
||||
total = keysToDelete.Length();
|
||||
}
|
||||
// If we are performing biff for this folder, tell the
|
||||
// stand-alone biff about the new high water mark
|
||||
|
@ -2528,10 +2526,10 @@ NS_IMETHODIMP nsImapMailFolder::UpdateImapMailboxInfo(nsIImapProtocol* aProtocol
|
|||
SyncFlags(flagState);
|
||||
PRInt32 numUnreadFromServer;
|
||||
aSpec->GetNumUnseenMessages(&numUnreadFromServer);
|
||||
if (mDatabase && mNumUnreadMessages + keysToFetch.GetSize() > numUnreadFromServer)
|
||||
if (mDatabase && mNumUnreadMessages + keysToFetch.Length() > numUnreadFromServer)
|
||||
mDatabase->SyncCounts();
|
||||
|
||||
if (keysToFetch.GetSize())
|
||||
if (!keysToFetch.IsEmpty())
|
||||
PrepareToAddHeadersToMailDB(aProtocol, keysToFetch, aSpec);
|
||||
else
|
||||
{
|
||||
|
@ -3174,10 +3172,10 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWindo
|
|||
mDatabase->SetStringProperty(msgKey, "junkscoreorigin", /* ### should this be plugin? */"plugin");
|
||||
if (junkScore == 100 || !junkScore) // if score is 0 or 100, set up to store junk status on server.
|
||||
{
|
||||
nsMsgKeyArray *keysToClassify = m_moveCoalescer->GetKeyBucket((junkScore == 100) ? 0 : 1);
|
||||
nsTArray<nsMsgKey> *keysToClassify = m_moveCoalescer->GetKeyBucket((junkScore == 100) ? 0 : 1);
|
||||
NS_ASSERTION(keysToClassify, "error getting key bucket");
|
||||
if (keysToClassify)
|
||||
keysToClassify->Add(msgKey);
|
||||
keysToClassify->AppendElement(msgKey);
|
||||
if (junkScore == 100)
|
||||
msgIsNew = PR_FALSE;
|
||||
}
|
||||
|
@ -3538,9 +3536,9 @@ nsresult nsImapMailFolder::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
|||
// folder - we used to store them in the MSG_FolderInfo and then when we'd finished
|
||||
// downloading headers, we'd iterate through all the folders looking for the ones
|
||||
// that needed messages moved into them - perhaps instead we could
|
||||
// keep track of nsIMsgFolder, nsMsgKeyArray pairs here in the imap code.
|
||||
// nsMsgKeyArray *idsToMoveFromInbox = msgFolder->GetImapIdsToMoveFromInbox();
|
||||
// idsToMoveFromInbox->Add(keyToFilter);
|
||||
// keep track of nsIMsgFolder, nsTArray<nsMsgKey> pairs here in the imap code.
|
||||
// nsTArray<nsMsgKey> *idsToMoveFromInbox = msgFolder->GetImapIdsToMoveFromInbox();
|
||||
// idsToMoveFromInbox->AppendElement(keyToFilter);
|
||||
if (imapDeleteIsMoveToTrash)
|
||||
{
|
||||
}
|
||||
|
@ -3560,10 +3558,10 @@ nsresult nsImapMailFolder::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
|||
}
|
||||
|
||||
// both of these algorithms assume that key arrays and flag states are sorted by increasing key.
|
||||
void nsImapMailFolder::FindKeysToDelete(const nsMsgKeyArray &existingKeys, nsMsgKeyArray &keysToDelete, nsIImapFlagAndUidState *flagState)
|
||||
void nsImapMailFolder::FindKeysToDelete(const nsTArray<nsMsgKey> &existingKeys, nsTArray<nsMsgKey> &keysToDelete, nsIImapFlagAndUidState *flagState)
|
||||
{
|
||||
PRBool showDeletedMessages = ShowDeletedMessages();
|
||||
PRUint32 total = existingKeys.GetSize();
|
||||
PRUint32 total = existingKeys.Length();
|
||||
PRInt32 messageIndex;
|
||||
|
||||
int onlineIndex=0; // current index into flagState
|
||||
|
@ -3588,7 +3586,7 @@ void nsImapMailFolder::FindKeysToDelete(const nsMsgKeyArray &existingKeys, nsMsg
|
|||
if ((PRInt32) doomedKey <= 0 && doomedKey != nsMsgKey_None)
|
||||
continue;
|
||||
else
|
||||
keysToDelete.Add(existingKeys[keyIndex]);
|
||||
keysToDelete.AppendElement(existingKeys[keyIndex]);
|
||||
}
|
||||
|
||||
flagState->GetUidOfMessage(onlineIndex, &uidOfMessage);
|
||||
|
@ -3597,7 +3595,7 @@ void nsImapMailFolder::FindKeysToDelete(const nsMsgKeyArray &existingKeys, nsMsg
|
|||
}
|
||||
}
|
||||
|
||||
void nsImapMailFolder::FindKeysToAdd(const nsMsgKeyArray &existingKeys, nsMsgKeyArray &keysToFetch, PRUint32 &numNewUnread, nsIImapFlagAndUidState *flagState)
|
||||
void nsImapMailFolder::FindKeysToAdd(const nsTArray<nsMsgKey> &existingKeys, nsTArray<nsMsgKey> &keysToFetch, PRUint32 &numNewUnread, nsIImapFlagAndUidState *flagState)
|
||||
{
|
||||
PRBool showDeletedMessages = ShowDeletedMessages();
|
||||
int dbIndex=0; // current index into existingKeys
|
||||
|
@ -3605,7 +3603,7 @@ void nsImapMailFolder::FindKeysToAdd(const nsMsgKeyArray &existingKeys, nsMsgKey
|
|||
PRInt32 messageIndex;
|
||||
|
||||
numNewUnread = 0;
|
||||
existTotal = numberOfKnownKeys = existingKeys.GetSize();
|
||||
existTotal = numberOfKnownKeys = existingKeys.Length();
|
||||
flagState->GetNumberOfMessages(&messageIndex);
|
||||
for (PRInt32 flagIndex=0; flagIndex < messageIndex; flagIndex++)
|
||||
{
|
||||
|
@ -3635,7 +3633,7 @@ void nsImapMailFolder::FindKeysToAdd(const nsMsgKeyArray &existingKeys, nsMsgKey
|
|||
continue;
|
||||
}
|
||||
}
|
||||
keysToFetch.Add(uidOfMessage);
|
||||
keysToFetch.AppendElement(uidOfMessage);
|
||||
if (! (flags & kImapMsgSeenFlag))
|
||||
numNewUnread++;
|
||||
}
|
||||
|
@ -3643,19 +3641,19 @@ void nsImapMailFolder::FindKeysToAdd(const nsMsgKeyArray &existingKeys, nsMsgKey
|
|||
}
|
||||
}
|
||||
|
||||
void nsImapMailFolder::PrepareToAddHeadersToMailDB(nsIImapProtocol* aProtocol, const nsMsgKeyArray &keysToFetch,
|
||||
void nsImapMailFolder::PrepareToAddHeadersToMailDB(nsIImapProtocol* aProtocol, const nsTArray<nsMsgKey> &keysToFetch,
|
||||
nsIMailboxSpec *boxSpec)
|
||||
{
|
||||
PRUint32 *theKeys = (PRUint32 *) PR_Malloc( keysToFetch.GetSize() * sizeof(PRUint32) );
|
||||
PRUint32 *theKeys = (PRUint32 *) PR_Malloc( keysToFetch.Length() * sizeof(PRUint32) );
|
||||
if (theKeys)
|
||||
{
|
||||
PRUint32 total = keysToFetch.GetSize();
|
||||
PRUint32 total = keysToFetch.Length();
|
||||
for (PRUint32 keyIndex=0; keyIndex < total; keyIndex++)
|
||||
theKeys[keyIndex] = keysToFetch[keyIndex];
|
||||
// tell the imap thread which hdrs to download
|
||||
if (aProtocol)
|
||||
{
|
||||
aProtocol->NotifyHdrsToDownload(theKeys, total /*keysToFetch.GetSize() */);
|
||||
aProtocol->NotifyHdrsToDownload(theKeys, total /*keysToFetch.Length() */);
|
||||
// now, tell it we don't need any bodies.
|
||||
aProtocol->NotifyBodysToDownload(nsnull, 0);
|
||||
}
|
||||
|
@ -3773,7 +3771,7 @@ nsImapMailFolder::SetupMsgWriteStream(nsIFile * aFile, PRBool addDummyEnvelope)
|
|||
NS_IMETHODIMP nsImapMailFolder::DownloadMessagesForOffline(nsISupportsArray *messages, nsIMsgWindow *window)
|
||||
{
|
||||
nsCAutoString messageIds;
|
||||
nsMsgKeyArray srcKeyArray;
|
||||
nsTArray<nsMsgKey> srcKeyArray;
|
||||
nsresult rv = BuildIdsAndKeyArray(messages, messageIds, srcKeyArray);
|
||||
if (NS_FAILED(rv) || messageIds.IsEmpty()) return rv;
|
||||
|
||||
|
@ -3801,7 +3799,7 @@ NS_IMETHODIMP nsImapMailFolder::DownloadAllForOffline(nsIUrlListener *listener,
|
|||
if (!noSelect)
|
||||
{
|
||||
nsCAutoString messageIdsToDownload;
|
||||
nsMsgKeyArray msgsToDownload;
|
||||
nsTArray<nsMsgKey> msgsToDownload;
|
||||
|
||||
GetDatabase(msgWindow);
|
||||
m_downloadingFolderForOfflineUse = PR_TRUE;
|
||||
|
@ -4110,7 +4108,7 @@ nsImapMailFolder::NotifyMessageDeleted(const char * onlineFolderName, PRBool del
|
|||
if (deleteAllMsgs)
|
||||
return NS_OK;
|
||||
|
||||
nsMsgKeyArray affectedMessages;
|
||||
nsTArray<nsMsgKey> affectedMessages;
|
||||
ParseUidString(msgIdString, affectedMessages);
|
||||
|
||||
if (msgIdString && !ShowDeletedMessages())
|
||||
|
@ -4119,7 +4117,7 @@ nsImapMailFolder::NotifyMessageDeleted(const char * onlineFolderName, PRBool del
|
|||
NS_ENSURE_TRUE(mDatabase, NS_OK);
|
||||
if (!ShowDeletedMessages())
|
||||
{
|
||||
if (affectedMessages.GetSize() > 0) // perhaps Search deleted these messages
|
||||
if (!affectedMessages.IsEmpty()) // perhaps Search deleted these messages
|
||||
mDatabase->DeleteMessages(&affectedMessages, nsnull);
|
||||
}
|
||||
else // && !imapDeleteIsMoveToTrash
|
||||
|
@ -4172,10 +4170,10 @@ nsresult nsImapMailFolder::GetTrashFolder(nsIMsgFolder **pTrashFolder)
|
|||
|
||||
|
||||
// store MSG_FLAG_IMAP_DELETED in the specified mailhdr records
|
||||
void nsImapMailFolder::SetIMAPDeletedFlag(nsIMsgDatabase *mailDB, const nsMsgKeyArray &msgids, PRBool markDeleted)
|
||||
void nsImapMailFolder::SetIMAPDeletedFlag(nsIMsgDatabase *mailDB, const nsTArray<nsMsgKey> &msgids, PRBool markDeleted)
|
||||
{
|
||||
nsresult markStatus = 0;
|
||||
PRUint32 total = msgids.GetSize();
|
||||
PRUint32 total = msgids.Length();
|
||||
|
||||
for (PRUint32 msgIndex=0; !markStatus && (msgIndex < total); msgIndex++)
|
||||
markStatus = mailDB->MarkImapDeleted(msgids[msgIndex], markDeleted, nsnull);
|
||||
|
@ -4348,7 +4346,7 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
|
|||
if (NS_SUCCEEDED(rv) && srcDB)
|
||||
{
|
||||
nsRefPtr<nsImapMoveCopyMsgTxn> msgTxn;
|
||||
nsMsgKeyArray srcKeyArray;
|
||||
nsTArray<nsMsgKey> srcKeyArray;
|
||||
if (m_copyState->m_allowUndo)
|
||||
{
|
||||
rv = m_copyState->m_undoMsgTxn->QueryInterface(NS_GET_IID(nsImapMoveCopyMsgTxn), getter_AddRefs(msgTxn));
|
||||
|
@ -4425,7 +4423,7 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
|
|||
rv = GetMsgDatabase(nsnull, getter_AddRefs(db));
|
||||
if (NS_SUCCEEDED(rv) && db)
|
||||
{
|
||||
nsMsgKeyArray keyArray;
|
||||
nsTArray<nsMsgKey> keyArray;
|
||||
char *keyString;
|
||||
imapUrl->CreateListOfMessageIdsString(&keyString);
|
||||
if (keyString)
|
||||
|
@ -4452,7 +4450,7 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
|
|||
rv = GetMsgDatabase(nsnull, getter_AddRefs(db));
|
||||
if (NS_SUCCEEDED(rv) && db)
|
||||
{
|
||||
nsMsgKeyArray keyArray;
|
||||
nsTArray<nsMsgKey> keyArray;
|
||||
char *keyString = nsnull;
|
||||
imapUrl->CreateListOfMessageIdsString(&keyString);
|
||||
if (keyString)
|
||||
|
@ -4858,15 +4856,15 @@ nsImapMailFolder::HeaderFetchCompleted(nsIImapProtocol* aProtocol)
|
|||
|
||||
if (m_downloadingFolderForOfflineUse)
|
||||
{
|
||||
nsMsgKeyArray keysToDownload;
|
||||
nsTArray<nsMsgKey> keysToDownload;
|
||||
GetBodysToDownload(&keysToDownload);
|
||||
if (keysToDownload.GetSize() > 0)
|
||||
if (!keysToDownload.IsEmpty())
|
||||
SetNotifyDownloadedLines(PR_TRUE);
|
||||
|
||||
aProtocol->NotifyBodysToDownload(keysToDownload.GetArray(), keysToDownload.GetSize());
|
||||
aProtocol->NotifyBodysToDownload(keysToDownload.Elements(), keysToDownload.Length());
|
||||
}
|
||||
else
|
||||
aProtocol->NotifyBodysToDownload(nsnull, 0/*keysToFetch.GetSize() */);
|
||||
aProtocol->NotifyBodysToDownload(nsnull, 0/*keysToFetch.Length() */);
|
||||
|
||||
nsCOMPtr <nsIURI> runningUri;
|
||||
aProtocol->GetRunningUrl(getter_AddRefs(runningUri));
|
||||
|
@ -5782,7 +5780,7 @@ nsImapMailFolder::CopyMessagesWithStream(nsIMsgFolder* srcFolder,
|
|||
if (m_copyState->m_allowUndo)
|
||||
{
|
||||
nsCAutoString messageIds;
|
||||
nsMsgKeyArray srcKeyArray;
|
||||
nsTArray<nsMsgKey> srcKeyArray;
|
||||
nsCOMPtr<nsIUrlListener> urlListener;
|
||||
rv = QueryInterface(NS_GET_IID(nsIUrlListener), getter_AddRefs(urlListener));
|
||||
rv = BuildIdsAndKeyArray(messages, messageIds, srcKeyArray);
|
||||
|
@ -6072,11 +6070,11 @@ nsresult nsImapMailFolder::CopyMessagesOffline(nsIMsgFolder* srcFolder,
|
|||
else
|
||||
sourceOp->AddMessageCopyOperation(folderURI.get()); // offline copy
|
||||
|
||||
nsMsgKeyArray srcKeyArray;
|
||||
nsTArray<nsMsgKey> srcKeyArray;
|
||||
nsCOMPtr<nsIUrlListener> urlListener;
|
||||
|
||||
sourceOp->GetOperation(&opType);
|
||||
srcKeyArray.Add(originalKey);
|
||||
srcKeyArray.AppendElement(originalKey);
|
||||
rv = QueryInterface(NS_GET_IID(nsIUrlListener), getter_AddRefs(urlListener));
|
||||
nsImapOfflineTxn *undoMsgTxn = new
|
||||
nsImapOfflineTxn(srcFolder, &srcKeyArray, this, isMove, opType, message,
|
||||
|
@ -6141,8 +6139,8 @@ nsresult nsImapMailFolder::CopyMessagesOffline(nsIMsgFolder* srcFolder,
|
|||
{
|
||||
nsCOMPtr<nsIUrlListener> urlListener;
|
||||
QueryInterface(NS_GET_IID(nsIUrlListener), getter_AddRefs(urlListener));
|
||||
nsMsgKeyArray keyArray;
|
||||
keyArray.Add(fakeBase + sourceKeyIndex);
|
||||
nsTArray<nsMsgKey> keyArray;
|
||||
keyArray.AppendElement(fakeBase + sourceKeyIndex);
|
||||
nsImapOfflineTxn *undoMsgTxn = new
|
||||
nsImapOfflineTxn(this, &keyArray, this, isMove, nsIMsgOfflineImapOperation::kAddedHeader,
|
||||
newMailHdr, m_thread, urlListener);
|
||||
|
@ -6159,14 +6157,14 @@ nsresult nsImapMailFolder::CopyMessagesOffline(nsIMsgFolder* srcFolder,
|
|||
mailHdr->GetMessageKey(&msgKey);
|
||||
if (isMove && successfulCopy)
|
||||
{
|
||||
nsMsgKeyArray srcKeyArray;
|
||||
srcKeyArray.Add(msgKey);
|
||||
nsTArray<nsMsgKey> srcKeyArray;
|
||||
srcKeyArray.AppendElement(msgKey);
|
||||
nsCOMPtr<nsIUrlListener> urlListener;
|
||||
rv = QueryInterface(NS_GET_IID(nsIUrlListener), getter_AddRefs(urlListener));
|
||||
nsOfflineImapOperationType opType = nsIMsgOfflineImapOperation::kDeletedMsg;
|
||||
if (!deleteToTrash)
|
||||
opType = nsIMsgOfflineImapOperation::kMsgMarkedDeleted;
|
||||
srcKeyArray.Add(msgKey);
|
||||
srcKeyArray.AppendElement(msgKey);
|
||||
nsImapOfflineTxn *undoMsgTxn = new
|
||||
nsImapOfflineTxn(srcFolder, &srcKeyArray, this, isMove, opType, mailHdr,
|
||||
m_thread, urlListener);
|
||||
|
@ -6223,7 +6221,7 @@ nsImapMailFolder::CopyMessages(nsIMsgFolder* srcFolder,
|
|||
{
|
||||
nsresult rv;
|
||||
nsCAutoString messageIds;
|
||||
nsMsgKeyArray srcKeyArray;
|
||||
nsTArray<nsMsgKey> srcKeyArray;
|
||||
nsCOMPtr<nsIUrlListener> urlListener;
|
||||
nsCOMPtr<nsISupports> srcSupport;
|
||||
nsCOMPtr<nsISupports> copySupport;
|
||||
|
@ -7518,14 +7516,14 @@ nsImapMailFolder::PlaybackCoalescedOperations()
|
|||
{
|
||||
if (m_moveCoalescer)
|
||||
{
|
||||
nsMsgKeyArray *junkKeysToClassify = m_moveCoalescer->GetKeyBucket(0);
|
||||
if (junkKeysToClassify && junkKeysToClassify->GetSize() > 0)
|
||||
StoreCustomKeywords(m_moveCoalescer->GetMsgWindow(), NS_LITERAL_CSTRING("Junk"), EmptyCString(), junkKeysToClassify->GetArray(), junkKeysToClassify->GetSize(), nsnull);
|
||||
junkKeysToClassify->RemoveAll();
|
||||
nsMsgKeyArray *nonJunkKeysToClassify = m_moveCoalescer->GetKeyBucket(1);
|
||||
if (nonJunkKeysToClassify && nonJunkKeysToClassify->GetSize() > 0)
|
||||
StoreCustomKeywords(m_moveCoalescer->GetMsgWindow(), NS_LITERAL_CSTRING("NonJunk"), EmptyCString(), nonJunkKeysToClassify->GetArray(), nonJunkKeysToClassify->GetSize(), nsnull);
|
||||
nonJunkKeysToClassify->RemoveAll();
|
||||
nsTArray<nsMsgKey> *junkKeysToClassify = m_moveCoalescer->GetKeyBucket(0);
|
||||
if (junkKeysToClassify && !junkKeysToClassify->IsEmpty())
|
||||
StoreCustomKeywords(m_moveCoalescer->GetMsgWindow(), NS_LITERAL_CSTRING("Junk"), EmptyCString(), junkKeysToClassify->Elements(), junkKeysToClassify->Length(), nsnull);
|
||||
junkKeysToClassify->Clear();
|
||||
nsTArray<nsMsgKey> *nonJunkKeysToClassify = m_moveCoalescer->GetKeyBucket(1);
|
||||
if (nonJunkKeysToClassify && !nonJunkKeysToClassify->IsEmpty())
|
||||
StoreCustomKeywords(m_moveCoalescer->GetMsgWindow(), NS_LITERAL_CSTRING("NonJunk"), EmptyCString(), nonJunkKeysToClassify->Elements(), nonJunkKeysToClassify->Length(), nsnull);
|
||||
nonJunkKeysToClassify->Clear();
|
||||
return m_moveCoalescer->PlaybackMoves(ShowPreviewText());
|
||||
}
|
||||
return NS_OK; // must not be any coalesced operations
|
||||
|
@ -7540,11 +7538,11 @@ nsImapMailFolder::SetJunkScoreForMessages(nsISupportsArray *aMessages, const nsA
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCAutoString messageIds;
|
||||
nsMsgKeyArray keys;
|
||||
nsTArray<nsMsgKey> keys;
|
||||
nsresult rv = BuildIdsAndKeyArray(aMessages, messageIds, keys);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
StoreCustomKeywords(nsnull, aJunkScore.Equals("0") ? NS_LITERAL_CSTRING("NonJunk") : NS_LITERAL_CSTRING("Junk"), EmptyCString(), keys.GetArray(),
|
||||
keys.GetSize(), nsnull);
|
||||
StoreCustomKeywords(nsnull, aJunkScore.Equals("0") ? NS_LITERAL_CSTRING("NonJunk") : NS_LITERAL_CSTRING("Junk"), EmptyCString(), keys.Elements(),
|
||||
keys.Length(), nsnull);
|
||||
if (mDatabase)
|
||||
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
}
|
||||
|
@ -7572,10 +7570,10 @@ nsImapMailFolder::OnMessageClassified(const char * aMsgURI, nsMsgJunkStatus aCla
|
|||
GetMoveCoalescer();
|
||||
if (m_moveCoalescer)
|
||||
{
|
||||
nsMsgKeyArray *keysToClassify = m_moveCoalescer->GetKeyBucket((aClassification == nsIJunkMailPlugin::JUNK) ? 0 : 1);
|
||||
nsTArray<nsMsgKey> *keysToClassify = m_moveCoalescer->GetKeyBucket((aClassification == nsIJunkMailPlugin::JUNK) ? 0 : 1);
|
||||
NS_ASSERTION(keysToClassify, "error getting key bucket");
|
||||
if (keysToClassify)
|
||||
keysToClassify->Add(msgKey);
|
||||
keysToClassify->AppendElement(msgKey);
|
||||
}
|
||||
if (aClassification == nsIJunkMailPlugin::JUNK)
|
||||
{
|
||||
|
@ -7718,7 +7716,7 @@ NS_IMETHODIMP nsImapMailFolder::FetchMsgPreviewText(nsMsgKey *aKeysToFetch, PRUi
|
|||
NS_ENSURE_ARG_POINTER(aKeysToFetch);
|
||||
NS_ENSURE_ARG_POINTER(aAsyncResults);
|
||||
|
||||
nsMsgKeyArray keysToFetchFromServer;
|
||||
nsTArray<nsMsgKey> keysToFetchFromServer;
|
||||
|
||||
*aAsyncResults = PR_FALSE;
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -7791,14 +7789,14 @@ NS_IMETHODIMP nsImapMailFolder::FetchMsgPreviewText(nsMsgKey *aKeysToFetch, PRUi
|
|||
rv = GetMsgPreviewTextFromStream(msgHdr, inputStream);
|
||||
}
|
||||
else if (!aLocalOnly)
|
||||
keysToFetchFromServer.Add(msgKey);
|
||||
keysToFetchFromServer.AppendElement(msgKey);
|
||||
}
|
||||
}
|
||||
if (keysToFetchFromServer.GetSize() > 0)
|
||||
if (!keysToFetchFromServer.IsEmpty())
|
||||
{
|
||||
PRUint32 msgCount = keysToFetchFromServer.GetSize();
|
||||
PRUint32 msgCount = keysToFetchFromServer.Length();
|
||||
nsCAutoString messageIds;
|
||||
AllocateImapUidString(keysToFetchFromServer.GetArray(), msgCount,
|
||||
AllocateImapUidString(keysToFetchFromServer.Elements(), msgCount,
|
||||
nsnull, messageIds);
|
||||
rv = imapService->GetBodyStart(m_thread, this, aUrlListener,
|
||||
messageIds, 2048, nsnull);
|
||||
|
@ -7813,10 +7811,10 @@ NS_IMETHODIMP nsImapMailFolder::AddKeywordsToMessages(nsISupportsArray *aMessage
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCAutoString messageIds;
|
||||
nsMsgKeyArray keys;
|
||||
nsTArray<nsMsgKey> keys;
|
||||
rv = BuildIdsAndKeyArray(aMessages, messageIds, keys);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = StoreCustomKeywords(nsnull, aKeywords, EmptyCString(), keys.GetArray(), keys.GetSize(), nsnull);
|
||||
rv = StoreCustomKeywords(nsnull, aKeywords, EmptyCString(), keys.Elements(), keys.Length(), nsnull);
|
||||
if (mDatabase)
|
||||
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
}
|
||||
|
@ -7829,10 +7827,10 @@ NS_IMETHODIMP nsImapMailFolder::RemoveKeywordsFromMessages(nsISupportsArray *aMe
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCAutoString messageIds;
|
||||
nsMsgKeyArray keys;
|
||||
nsTArray<nsMsgKey> keys;
|
||||
nsresult rv = BuildIdsAndKeyArray(aMessages, messageIds, keys);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = StoreCustomKeywords(nsnull, EmptyCString(), aKeywords, keys.GetArray(), keys.GetSize(), nsnull);
|
||||
rv = StoreCustomKeywords(nsnull, EmptyCString(), aKeywords, keys.Elements(), keys.Length(), nsnull);
|
||||
if (mDatabase)
|
||||
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
}
|
||||
|
|
|
@ -331,12 +331,12 @@ public:
|
|||
protected:
|
||||
// Helper methods
|
||||
|
||||
void FindKeysToAdd(const nsMsgKeyArray &existingKeys, nsMsgKeyArray
|
||||
void FindKeysToAdd(const nsTArray<nsMsgKey> &existingKeys, nsTArray<nsMsgKey>
|
||||
&keysToFetch, PRUint32 &numNewUnread, nsIImapFlagAndUidState *flagState);
|
||||
void FindKeysToDelete(const nsMsgKeyArray &existingKeys, nsMsgKeyArray
|
||||
void FindKeysToDelete(const nsTArray<nsMsgKey> &existingKeys, nsTArray<nsMsgKey>
|
||||
&keysToFetch, nsIImapFlagAndUidState *flagState);
|
||||
void PrepareToAddHeadersToMailDB(nsIImapProtocol* aProtocol, const
|
||||
nsMsgKeyArray &keysToFetch,
|
||||
nsTArray<nsMsgKey> &keysToFetch,
|
||||
nsIMailboxSpec *boxSpec);
|
||||
void TweakHeaderFlags(nsIImapProtocol* aProtocol, nsIMsgDBHdr *tweakMe);
|
||||
|
||||
|
@ -350,10 +350,10 @@ protected:
|
|||
|
||||
void EndOfflineDownload();
|
||||
|
||||
nsresult MarkMessagesImapDeleted(nsMsgKeyArray *keyArray, PRBool deleted, nsIMsgDatabase *db);
|
||||
nsresult MarkMessagesImapDeleted(nsTArray<nsMsgKey> *keyArray, PRBool deleted, nsIMsgDatabase *db);
|
||||
|
||||
void UpdatePendingCounts();
|
||||
void SetIMAPDeletedFlag(nsIMsgDatabase *mailDB, const nsMsgKeyArray &msgids, PRBool markDeleted);
|
||||
void SetIMAPDeletedFlag(nsIMsgDatabase *mailDB, const nsTArray<nsMsgKey> &msgids, PRBool markDeleted);
|
||||
virtual PRBool ShowDeletedMessages();
|
||||
virtual PRBool DeleteIsMoveToTrash();
|
||||
nsresult GetFolder(const nsACString& name, nsIMsgFolder **pFolder);
|
||||
|
@ -375,7 +375,7 @@ protected:
|
|||
|
||||
nsMsgIMAPFolderACL * GetFolderACL();
|
||||
nsresult CreateACLRightsStringForFolder(nsAString& rightsString);
|
||||
nsresult GetBodysToDownload(nsMsgKeyArray *keysOfMessagesToDownload);
|
||||
nsresult GetBodysToDownload(nsTArray<nsMsgKey> *keysOfMessagesToDownload);
|
||||
// Uber message copy service
|
||||
nsresult CopyMessagesWithStream(nsIMsgFolder* srcFolder,
|
||||
nsISupportsArray* messages,
|
||||
|
@ -395,7 +395,7 @@ protected:
|
|||
nsIMsgWindow *msgWindow,
|
||||
PRBool allowUndo);
|
||||
nsresult OnCopyCompleted(nsISupports *srcSupport, nsresult exitCode);
|
||||
nsresult BuildIdsAndKeyArray(nsISupportsArray* messages, nsCString& msgIds, nsMsgKeyArray& keyArray);
|
||||
nsresult BuildIdsAndKeyArray(nsISupportsArray* messages, nsCString& msgIds, nsTArray<nsMsgKey>& keyArray);
|
||||
nsresult GetMoveCoalescer();
|
||||
nsresult PlaybackCoalescedOperations();
|
||||
virtual nsresult CreateBaseMessageURI(const nsACString& aURI);
|
||||
|
|
|
@ -235,7 +235,7 @@ void nsImapOfflineSync::AdvanceToFirstIMAPFolder()
|
|||
void nsImapOfflineSync::ProcessFlagOperation(nsIMsgOfflineImapOperation *op)
|
||||
{
|
||||
nsCOMPtr <nsIMsgOfflineImapOperation> currentOp = op;
|
||||
nsMsgKeyArray matchingFlagKeys;
|
||||
nsTArray<nsMsgKey> matchingFlagKeys;
|
||||
PRUint32 currentKeyIndex = m_KeyIndex;
|
||||
|
||||
imapMessageFlagsType matchingFlags;
|
||||
|
@ -249,11 +249,11 @@ void nsImapOfflineSync::ProcessFlagOperation(nsIMsgOfflineImapOperation *op)
|
|||
{
|
||||
nsMsgKey curKey;
|
||||
currentOp->GetMessageKey(&curKey);
|
||||
matchingFlagKeys.Add(curKey);
|
||||
matchingFlagKeys.AppendElement(curKey);
|
||||
currentOp->ClearOperation(nsIMsgOfflineImapOperation::kFlagsChanged);
|
||||
}
|
||||
currentOp = nsnull;
|
||||
if (++currentKeyIndex < m_CurrentKeys.GetSize())
|
||||
if (++currentKeyIndex < m_CurrentKeys.Length())
|
||||
m_currentDB->GetOfflineOpForKey(m_CurrentKeys[currentKeyIndex], PR_FALSE,
|
||||
getter_AddRefs(currentOp));
|
||||
if (currentOp)
|
||||
|
@ -269,10 +269,10 @@ void nsImapOfflineSync::ProcessFlagOperation(nsIMsgOfflineImapOperation *op)
|
|||
&& (newFlags == matchingFlags);
|
||||
} while (currentOp);
|
||||
|
||||
if (matchingFlagKeys.GetSize() > 0)
|
||||
if (!matchingFlagKeys.IsEmpty())
|
||||
{
|
||||
nsCAutoString uids;
|
||||
nsImapMailFolder::AllocateUidStringFromKeys(matchingFlagKeys.GetArray(), matchingFlagKeys.GetSize(), uids);
|
||||
nsImapMailFolder::AllocateUidStringFromKeys(matchingFlagKeys.Elements(), matchingFlagKeys.Length(), uids);
|
||||
PRUint32 curFolderFlags;
|
||||
m_currentFolder->GetFlags(&curFolderFlags);
|
||||
|
||||
|
@ -300,7 +300,7 @@ void nsImapOfflineSync::ProcessFlagOperation(nsIMsgOfflineImapOperation *op)
|
|||
void nsImapOfflineSync::ProcessKeywordOperation(nsIMsgOfflineImapOperation *op)
|
||||
{
|
||||
nsCOMPtr <nsIMsgOfflineImapOperation> currentOp = op;
|
||||
nsMsgKeyArray matchingKeywordKeys;
|
||||
nsTArray<nsMsgKey> matchingKeywordKeys;
|
||||
PRUint32 currentKeyIndex = m_KeyIndex;
|
||||
|
||||
nsCAutoString keywords;
|
||||
|
@ -315,11 +315,11 @@ void nsImapOfflineSync::ProcessKeywordOperation(nsIMsgOfflineImapOperation *op)
|
|||
{
|
||||
nsMsgKey curKey;
|
||||
currentOp->GetMessageKey(&curKey);
|
||||
matchingKeywordKeys.Add(curKey);
|
||||
matchingKeywordKeys.AppendElement(curKey);
|
||||
currentOp->ClearOperation(mCurrentPlaybackOpType);
|
||||
}
|
||||
currentOp = nsnull;
|
||||
if (++currentKeyIndex < m_CurrentKeys.GetSize())
|
||||
if (++currentKeyIndex < m_CurrentKeys.Length())
|
||||
m_currentDB->GetOfflineOpForKey(m_CurrentKeys[currentKeyIndex], PR_FALSE,
|
||||
getter_AddRefs(currentOp));
|
||||
if (currentOp)
|
||||
|
@ -336,7 +336,7 @@ void nsImapOfflineSync::ProcessKeywordOperation(nsIMsgOfflineImapOperation *op)
|
|||
}
|
||||
} while (currentOp);
|
||||
|
||||
if (matchingKeywordKeys.GetSize() > 0)
|
||||
if (!matchingKeywordKeys.IsEmpty())
|
||||
{
|
||||
PRUint32 curFolderFlags;
|
||||
m_currentFolder->GetFlags(&curFolderFlags);
|
||||
|
@ -351,8 +351,8 @@ void nsImapOfflineSync::ProcessKeywordOperation(nsIMsgOfflineImapOperation *op)
|
|||
rv = imapFolder->StoreCustomKeywords(m_window,
|
||||
(mCurrentPlaybackOpType == nsIMsgOfflineImapOperation::kAddKeywords) ? keywords : EmptyCString(),
|
||||
(mCurrentPlaybackOpType == nsIMsgOfflineImapOperation::kRemoveKeywords) ? keywords : EmptyCString(),
|
||||
matchingKeywordKeys.GetArray(),
|
||||
matchingKeywordKeys.GetSize(), getter_AddRefs(uriToStoreCustomKeywords));
|
||||
matchingKeywordKeys.Elements(),
|
||||
matchingKeywordKeys.Length(), getter_AddRefs(uriToStoreCustomKeywords));
|
||||
if (NS_SUCCEEDED(rv) && uriToStoreCustomKeywords)
|
||||
{
|
||||
nsCOMPtr <nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(uriToStoreCustomKeywords);
|
||||
|
@ -476,7 +476,7 @@ nsImapOfflineSync::ProcessAppendMsgOperation(nsIMsgOfflineImapOperation *current
|
|||
|
||||
void nsImapOfflineSync::ProcessMoveOperation(nsIMsgOfflineImapOperation *op)
|
||||
{
|
||||
nsMsgKeyArray matchingFlagKeys ;
|
||||
nsTArray<nsMsgKey> matchingFlagKeys;
|
||||
PRUint32 currentKeyIndex = m_KeyIndex;
|
||||
nsCString moveDestination;
|
||||
op->GetDestinationFolderURI(getter_Copies(moveDestination));
|
||||
|
@ -488,12 +488,12 @@ void nsImapOfflineSync::ProcessMoveOperation(nsIMsgOfflineImapOperation *op)
|
|||
{
|
||||
nsMsgKey curKey;
|
||||
currentOp->GetMessageKey(&curKey);
|
||||
matchingFlagKeys.Add(curKey);
|
||||
matchingFlagKeys.AppendElement(curKey);
|
||||
currentOp->ClearOperation(nsIMsgOfflineImapOperation::kMsgMoved);
|
||||
}
|
||||
currentOp = nsnull;
|
||||
|
||||
if (++currentKeyIndex < m_CurrentKeys.GetSize())
|
||||
if (++currentKeyIndex < m_CurrentKeys.Length())
|
||||
{
|
||||
nsCString nextDestination;
|
||||
nsresult rv = m_currentDB->GetOfflineOpForKey(m_CurrentKeys[currentKeyIndex], PR_FALSE, getter_AddRefs(currentOp));
|
||||
|
@ -526,7 +526,7 @@ void nsImapOfflineSync::ProcessMoveOperation(nsIMsgOfflineImapOperation *op)
|
|||
nsCOMPtr <nsIMsgImapMailFolder> imapFolder = do_QueryInterface(m_currentFolder);
|
||||
if (imapFolder && DestFolderOnSameServer(destFolder))
|
||||
{
|
||||
rv = imapFolder->ReplayOfflineMoveCopy(matchingFlagKeys.GetArray(), matchingFlagKeys.GetSize(), PR_TRUE, destFolder,
|
||||
rv = imapFolder->ReplayOfflineMoveCopy(matchingFlagKeys.Elements(), matchingFlagKeys.Length(), PR_TRUE, destFolder,
|
||||
this, m_window);
|
||||
}
|
||||
else
|
||||
|
@ -535,7 +535,7 @@ void nsImapOfflineSync::ProcessMoveOperation(nsIMsgOfflineImapOperation *op)
|
|||
if (messages && NS_SUCCEEDED(rv))
|
||||
{
|
||||
NS_NewISupportsArray(getter_AddRefs(messages));
|
||||
for (PRUint32 keyIndex = 0; keyIndex < matchingFlagKeys.GetSize(); keyIndex++)
|
||||
for (PRUint32 keyIndex = 0; keyIndex < matchingFlagKeys.Length(); keyIndex++)
|
||||
{
|
||||
nsCOMPtr<nsIMsgDBHdr> mailHdr = nsnull;
|
||||
rv = m_currentFolder->GetMessageHeader(matchingFlagKeys.ElementAt(keyIndex), getter_AddRefs(mailHdr));
|
||||
|
@ -590,7 +590,7 @@ PRBool nsImapOfflineSync::DestFolderOnSameServer(nsIMsgFolder *destFolder)
|
|||
|
||||
void nsImapOfflineSync::ProcessCopyOperation(nsIMsgOfflineImapOperation *currentOp)
|
||||
{
|
||||
nsMsgKeyArray matchingFlagKeys;
|
||||
nsTArray<nsMsgKey> matchingFlagKeys;
|
||||
PRUint32 currentKeyIndex = m_KeyIndex;
|
||||
nsCString copyDestination;
|
||||
currentOp->GetCopyDestination(0, getter_Copies(copyDestination));
|
||||
|
@ -601,12 +601,12 @@ void nsImapOfflineSync::ProcessCopyOperation(nsIMsgOfflineImapOperation *current
|
|||
{
|
||||
nsMsgKey curKey;
|
||||
currentOp->GetMessageKey(&curKey);
|
||||
matchingFlagKeys.Add(curKey);
|
||||
matchingFlagKeys.AppendElement(curKey);
|
||||
currentOp->ClearOperation(nsIMsgOfflineImapOperation::kMsgCopy);
|
||||
}
|
||||
currentOp = nsnull;
|
||||
|
||||
if (++currentKeyIndex < m_CurrentKeys.GetSize())
|
||||
if (++currentKeyIndex < m_CurrentKeys.Length())
|
||||
{
|
||||
nsCString nextDestination;
|
||||
nsresult rv = m_currentDB->GetOfflineOpForKey(m_CurrentKeys[currentKeyIndex], PR_FALSE, ¤tOp);
|
||||
|
@ -641,7 +641,7 @@ void nsImapOfflineSync::ProcessCopyOperation(nsIMsgOfflineImapOperation *current
|
|||
nsCOMPtr <nsIMsgImapMailFolder> imapFolder = do_QueryInterface(m_currentFolder);
|
||||
if (imapFolder && DestFolderOnSameServer(destFolder))
|
||||
{
|
||||
rv = imapFolder->ReplayOfflineMoveCopy(matchingFlagKeys.GetArray(), matchingFlagKeys.GetSize(), PR_FALSE, destFolder,
|
||||
rv = imapFolder->ReplayOfflineMoveCopy(matchingFlagKeys.Elements(), matchingFlagKeys.Length(), PR_FALSE, destFolder,
|
||||
this, m_window);
|
||||
}
|
||||
else
|
||||
|
@ -650,7 +650,7 @@ void nsImapOfflineSync::ProcessCopyOperation(nsIMsgOfflineImapOperation *current
|
|||
if (messages && NS_SUCCEEDED(rv))
|
||||
{
|
||||
NS_NewISupportsArray(getter_AddRefs(messages));
|
||||
for (PRUint32 keyIndex = 0; keyIndex < matchingFlagKeys.GetSize(); keyIndex++)
|
||||
for (PRUint32 keyIndex = 0; keyIndex < matchingFlagKeys.Length(); keyIndex++)
|
||||
{
|
||||
nsCOMPtr<nsIMsgDBHdr> mailHdr = nsnull;
|
||||
rv = m_currentFolder->GetMessageHeader(matchingFlagKeys.ElementAt(keyIndex), getter_AddRefs(mailHdr));
|
||||
|
@ -777,9 +777,9 @@ nsresult nsImapOfflineSync::ProcessNextOperation()
|
|||
|
||||
if (m_currentDB)
|
||||
{
|
||||
m_CurrentKeys.RemoveAll();
|
||||
m_CurrentKeys.Clear();
|
||||
m_KeyIndex = 0;
|
||||
if ((m_currentDB->ListAllOfflineOpIds(&m_CurrentKeys) != 0) || !m_CurrentKeys.GetSize())
|
||||
if ((m_currentDB->ListAllOfflineOpIds(&m_CurrentKeys) != 0) || m_CurrentKeys.IsEmpty())
|
||||
{
|
||||
m_currentDB = nsnull;
|
||||
folderInfo = nsnull; // can't hold onto folderInfo longer than db
|
||||
|
@ -789,7 +789,7 @@ nsresult nsImapOfflineSync::ProcessNextOperation()
|
|||
{
|
||||
// trash any ghost msgs
|
||||
PRBool deletedGhostMsgs = PR_FALSE;
|
||||
for (PRUint32 fakeIndex=0; fakeIndex < m_CurrentKeys.GetSize(); fakeIndex++)
|
||||
for (PRUint32 fakeIndex=0; fakeIndex < m_CurrentKeys.Length(); fakeIndex++)
|
||||
{
|
||||
nsCOMPtr <nsIMsgOfflineImapOperation> currentOp;
|
||||
m_currentDB->GetOfflineOpForKey(m_CurrentKeys[fakeIndex], PR_FALSE, getter_AddRefs(currentOp));
|
||||
|
@ -814,8 +814,8 @@ nsresult nsImapOfflineSync::ProcessNextOperation()
|
|||
if (deletedGhostMsgs)
|
||||
m_currentFolder->SummaryChanged();
|
||||
|
||||
m_CurrentKeys.RemoveAll();
|
||||
if ( (m_currentDB->ListAllOfflineOpIds(&m_CurrentKeys) != 0) || !m_CurrentKeys.GetSize() )
|
||||
m_CurrentKeys.Clear();
|
||||
if ( (m_currentDB->ListAllOfflineOpIds(&m_CurrentKeys) != 0) || m_CurrentKeys.IsEmpty() )
|
||||
{
|
||||
m_currentDB = nsnull;
|
||||
if (deletedGhostMsgs)
|
||||
|
@ -860,7 +860,7 @@ nsresult nsImapOfflineSync::ProcessNextOperation()
|
|||
if (!folderInfo)
|
||||
m_currentDB->GetDBFolderInfo(getter_AddRefs(folderInfo));
|
||||
// user canceled the lite select! if GetCurrentUIDValidity() == 0
|
||||
if (folderInfo && (m_KeyIndex < m_CurrentKeys.GetSize()) && (m_pseudoOffline || (GetCurrentUIDValidity() != 0) || !(folderFlags & MSG_FOLDER_FLAG_IMAPBOX)) )
|
||||
if (folderInfo && (m_KeyIndex < m_CurrentKeys.Length()) && (m_pseudoOffline || (GetCurrentUIDValidity() != 0) || !(folderFlags & MSG_FOLDER_FLAG_IMAPBOX)) )
|
||||
{
|
||||
PRInt32 curFolderUidValidity;
|
||||
folderInfo->GetImapUidValidity(&curFolderUidValidity);
|
||||
|
@ -881,7 +881,7 @@ nsresult nsImapOfflineSync::ProcessNextOperation()
|
|||
{
|
||||
currentOp = nsnull;
|
||||
++m_KeyIndex;
|
||||
if (m_KeyIndex < m_CurrentKeys.GetSize())
|
||||
if (m_KeyIndex < m_CurrentKeys.Length())
|
||||
m_currentDB->GetOfflineOpForKey(m_CurrentKeys[m_KeyIndex], PR_FALSE, getter_AddRefs(currentOp));
|
||||
if (currentOp)
|
||||
currentOp->GetOperation(&opType);
|
||||
|
@ -1059,7 +1059,7 @@ void nsImapOfflineSync::DeleteAllOfflineOpsForCurrentDB()
|
|||
m_currentDB->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
currentOp = nsnull;
|
||||
|
||||
if (++m_KeyIndex < m_CurrentKeys.GetSize())
|
||||
if (++m_KeyIndex < m_CurrentKeys.Length())
|
||||
m_currentDB->GetOfflineOpForKey(m_CurrentKeys[m_KeyIndex], PR_FALSE, getter_AddRefs(currentOp));
|
||||
}
|
||||
// turn off MSG_FOLDER_FLAG_OFFLINEEVENTS
|
||||
|
|
|
@ -88,7 +88,7 @@ protected:
|
|||
nsCOMPtr <nsIEnumerator> m_serverEnumerator;
|
||||
nsCOMPtr <nsILocalFile> m_curTempFile;
|
||||
|
||||
nsMsgKeyArray m_CurrentKeys;
|
||||
nsTArray<nsMsgKey> m_CurrentKeys;
|
||||
PRUint32 m_KeyIndex;
|
||||
nsCOMPtr <nsIMsgDatabase> m_currentDB;
|
||||
nsCOMPtr <nsIUrlListener> m_listener;
|
||||
|
|
|
@ -4731,11 +4731,11 @@ nsImapProtocol::Store(const nsCString &messageList, const char * messageData,
|
|||
// turn messageList back into key array and then back into a message id list,
|
||||
// but use the flag state to handle ranges correctly.
|
||||
nsCString messageIdList;
|
||||
nsMsgKeyArray msgKeys;
|
||||
nsTArray<nsMsgKey> msgKeys;
|
||||
if (idsAreUid)
|
||||
ParseUidString(messageList.get(), msgKeys);
|
||||
|
||||
PRInt32 msgCountLeft = msgKeys.GetSize();
|
||||
PRInt32 msgCountLeft = msgKeys.Length();
|
||||
PRUint32 msgsHandled = 0;
|
||||
do
|
||||
{
|
||||
|
@ -4743,7 +4743,7 @@ nsImapProtocol::Store(const nsCString &messageList, const char * messageData,
|
|||
|
||||
PRUint32 msgsToHandle = msgCountLeft;
|
||||
if (idsAreUid)
|
||||
AllocateImapUidString(msgKeys.GetArray() + msgsHandled, msgsToHandle, m_flagState, idString); // 20 * 200
|
||||
AllocateImapUidString(msgKeys.Elements() + msgsHandled, msgsToHandle, m_flagState, idString); // 20 * 200
|
||||
else
|
||||
idString.Assign(messageList);
|
||||
|
||||
|
@ -7134,11 +7134,11 @@ void nsImapProtocol::Copy(const char * messageList,
|
|||
// turn messageList back into key array and then back into a message id list,
|
||||
// but use the flag state to handle ranges correctly.
|
||||
nsCString messageIdList;
|
||||
nsMsgKeyArray msgKeys;
|
||||
nsTArray<nsMsgKey> msgKeys;
|
||||
if (idsAreUid)
|
||||
ParseUidString(messageList, msgKeys);
|
||||
|
||||
PRInt32 msgCountLeft = msgKeys.GetSize();
|
||||
PRInt32 msgCountLeft = msgKeys.Length();
|
||||
PRUint32 msgsHandled = 0;
|
||||
const char *formatString;
|
||||
formatString = (idsAreUid)
|
||||
|
@ -7151,7 +7151,7 @@ void nsImapProtocol::Copy(const char * messageList,
|
|||
|
||||
PRUint32 msgsToHandle = msgCountLeft;
|
||||
if (idsAreUid)
|
||||
AllocateImapUidString(msgKeys.GetArray() + msgsHandled, msgsToHandle, m_flagState, idString);
|
||||
AllocateImapUidString(msgKeys.Elements() + msgsHandled, msgsToHandle, m_flagState, idString);
|
||||
else
|
||||
idString.Assign(messageList);
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@
|
|||
#include "nsIMAPHostSessionList.h"
|
||||
#include "nsImapSearchResults.h"
|
||||
#include "nsString.h"
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsImapUtils.h"
|
||||
|
||||
class nsIMAPNamespace;
|
||||
|
@ -288,7 +289,7 @@ private:
|
|||
nsImapProtocol &fServerConnection;
|
||||
|
||||
nsIImapHostSessionList *fHostSessionList;
|
||||
nsMsgKeyArray fCopyResponseKeyArray;
|
||||
nsTArray<nsMsgKey> fCopyResponseKeyArray;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -769,7 +769,7 @@ NS_IMETHODIMP nsImapService::CopyMessage(const char *aSrcMailboxURI,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapService::CopyMessages(nsMsgKeyArray &keys,
|
||||
NS_IMETHODIMP nsImapService::CopyMessages(nsTArray<nsMsgKey> &keys,
|
||||
nsIMsgFolder *srcFolder,
|
||||
nsIStreamListener *aMailboxCopy,
|
||||
PRBool moveMessage,
|
||||
|
@ -798,8 +798,8 @@ NS_IMETHODIMP nsImapService::CopyMessages(nsMsgKeyArray &keys,
|
|||
srcFolder->GenerateMessageURI(keys[0], uri);
|
||||
|
||||
nsCString messageIds;
|
||||
PRUint32 numKeys = keys.GetSize();
|
||||
AllocateImapUidString(keys.GetArray(), numKeys, nsnull, messageIds);
|
||||
PRUint32 numKeys = keys.Length();
|
||||
AllocateImapUidString(keys.Elements(), numKeys, nsnull, messageIds);
|
||||
nsCOMPtr<nsIImapUrl> imapUrl;
|
||||
nsCAutoString urlSpec;
|
||||
PRUnichar hierarchySeparator = GetHierarchyDelimiter(folder);
|
||||
|
|
|
@ -51,7 +51,7 @@ nsImapMoveCopyMsgTxn::nsImapMoveCopyMsgTxn() :
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsImapMoveCopyMsgTxn::Init(nsIMsgFolder* srcFolder, nsMsgKeyArray* srcKeyArray,
|
||||
nsImapMoveCopyMsgTxn::Init(nsIMsgFolder* srcFolder, nsTArray<nsMsgKey>* srcKeyArray,
|
||||
const char* srcMsgIdString, nsIMsgFolder* dstFolder,
|
||||
PRBool idsAreUids, PRBool isMove,
|
||||
nsIEventTarget* eventTarget, nsIUrlListener* urlListener)
|
||||
|
@ -66,8 +66,8 @@ nsImapMoveCopyMsgTxn::Init(nsIMsgFolder* srcFolder, nsMsgKeyArray* srcKeyArray,
|
|||
m_eventTarget = eventTarget;
|
||||
if (urlListener)
|
||||
m_urlListener = do_QueryInterface(urlListener, &rv);
|
||||
m_srcKeyArray.CopyArray(srcKeyArray);
|
||||
m_dupKeyArray.CopyArray(srcKeyArray);
|
||||
m_srcKeyArray = *srcKeyArray;
|
||||
m_dupKeyArray = *srcKeyArray;
|
||||
nsCString uri;
|
||||
rv = srcFolder->GetURI(uri);
|
||||
nsCString protocolType(uri);
|
||||
|
@ -76,7 +76,7 @@ nsImapMoveCopyMsgTxn::Init(nsIMsgFolder* srcFolder, nsMsgKeyArray* srcKeyArray,
|
|||
if (protocolType.LowerCaseEqualsLiteral("mailbox"))
|
||||
{
|
||||
m_srcIsPop3 = PR_TRUE;
|
||||
PRUint32 i, count = m_srcKeyArray.GetSize();
|
||||
PRUint32 i, count = m_srcKeyArray.Length();
|
||||
nsCOMPtr<nsIMsgDatabase> srcDB;
|
||||
rv = srcFolder->GetMsgDatabase(nsnull, getter_AddRefs(srcDB));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -177,8 +177,8 @@ nsImapMoveCopyMsgTxn::UndoTransaction(void)
|
|||
|
||||
// protect against a bogus undo txn without any source keys
|
||||
// see bug #179856 for details
|
||||
NS_ASSERTION(m_srcKeyArray.GetSize(), "no source keys");
|
||||
if (!m_srcKeyArray.GetSize())
|
||||
NS_ASSERTION(!m_srcKeyArray.IsEmpty(), "no source keys");
|
||||
if (m_srcKeyArray.IsEmpty())
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
if (NS_SUCCEEDED(rv) && deleteModel == nsMsgImapDeleteModels::IMAPDelete)
|
||||
|
@ -259,8 +259,8 @@ nsImapMoveCopyMsgTxn::RedoTransaction(void)
|
|||
|
||||
// protect against a bogus undo txn without any source keys
|
||||
// see bug #179856 for details
|
||||
NS_ASSERTION(m_srcKeyArray.GetSize(), "no source keys");
|
||||
if (!m_srcKeyArray.GetSize())
|
||||
NS_ASSERTION(!m_srcKeyArray.IsEmpty(), "no source keys");
|
||||
if (m_srcKeyArray.IsEmpty())
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
if (NS_SUCCEEDED(rv) && deleteModel == nsMsgImapDeleteModels::IMAPDelete)
|
||||
|
@ -337,9 +337,9 @@ nsImapMoveCopyMsgTxn::SetCopyResponseUid(const char* aMsgIdString)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsImapMoveCopyMsgTxn::GetSrcKeyArray(nsMsgKeyArray& srcKeyArray)
|
||||
nsImapMoveCopyMsgTxn::GetSrcKeyArray(nsTArray<nsMsgKey>& srcKeyArray)
|
||||
{
|
||||
srcKeyArray.CopyArray(&m_srcKeyArray);
|
||||
srcKeyArray = m_srcKeyArray;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -372,7 +372,7 @@ nsImapMoveCopyMsgTxn::UndoMailboxDelete()
|
|||
rv = dstFolder->GetMsgDatabase(nsnull, getter_AddRefs(dstDB));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRUint32 count = m_srcKeyArray.GetSize();
|
||||
PRUint32 count = m_srcKeyArray.Length();
|
||||
PRUint32 i;
|
||||
nsCOMPtr<nsIMsgDBHdr> oldHdr;
|
||||
nsCOMPtr<nsIMsgDBHdr> newHdr;
|
||||
|
@ -441,7 +441,7 @@ nsresult nsImapMoveCopyMsgTxn::GetImapDeleteModel(nsIMsgFolder *aFolder, nsMsgIm
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsImapOfflineTxn::nsImapOfflineTxn(nsIMsgFolder* srcFolder, nsMsgKeyArray* srcKeyArray,
|
||||
nsImapOfflineTxn::nsImapOfflineTxn(nsIMsgFolder* srcFolder, nsTArray<nsMsgKey>* srcKeyArray,
|
||||
nsIMsgFolder* dstFolder, PRBool isMove, nsOfflineImapOperationType opType,
|
||||
nsIMsgDBHdr *srcHdr,
|
||||
nsIEventTarget* eventTarget, nsIUrlListener* urlListener)
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "nsIUrlListener.h"
|
||||
#include "nsIEventTarget.h"
|
||||
#include "nsMsgTxn.h"
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIMsgOfflineImapOperation.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
@ -62,7 +62,7 @@ public:
|
|||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMAPMOVECOPYMSGTXN_IID)
|
||||
|
||||
nsImapMoveCopyMsgTxn();
|
||||
nsImapMoveCopyMsgTxn(nsIMsgFolder* srcFolder, nsMsgKeyArray* srcKeyArray,
|
||||
nsImapMoveCopyMsgTxn(nsIMsgFolder* srcFolder, nsTArray<nsMsgKey>* srcKeyArray,
|
||||
const char* srcMsgIdString, nsIMsgFolder* dstFolder,
|
||||
PRBool idsAreUids, PRBool isMove,
|
||||
nsIEventTarget *eventTarget,
|
||||
|
@ -76,11 +76,11 @@ public:
|
|||
|
||||
// helper
|
||||
nsresult SetCopyResponseUid(const char *msgIdString);
|
||||
nsresult GetSrcKeyArray(nsMsgKeyArray& srcKeyArray);
|
||||
nsresult GetSrcKeyArray(nsTArray<nsMsgKey>& srcKeyArray);
|
||||
nsresult AddDstKey(nsMsgKey aKey);
|
||||
nsresult UndoMailboxDelete();
|
||||
nsresult RedoMailboxDelete();
|
||||
nsresult Init(nsIMsgFolder* srcFolder, nsMsgKeyArray* srcKeyArray,
|
||||
nsresult Init(nsIMsgFolder* srcFolder, nsTArray<nsMsgKey>* srcKeyArray,
|
||||
const char* srcMsgIdString, nsIMsgFolder* dstFolder,
|
||||
PRBool idsAreUids, PRBool isMove,
|
||||
nsIEventTarget *eventTarget,
|
||||
|
@ -90,8 +90,8 @@ protected:
|
|||
|
||||
nsWeakPtr m_srcFolder;
|
||||
nsCOMPtr<nsISupportsArray> m_srcHdrs;
|
||||
nsMsgKeyArray m_dupKeyArray;
|
||||
nsMsgKeyArray m_srcKeyArray;
|
||||
nsTArray<nsMsgKey> m_dupKeyArray;
|
||||
nsTArray<nsMsgKey> m_srcKeyArray;
|
||||
nsCString m_srcMsgIdString;
|
||||
nsWeakPtr m_dstFolder;
|
||||
nsCString m_dstMsgIdString;
|
||||
|
@ -110,7 +110,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsImapMoveCopyMsgTxn, NS_IMAPMOVECOPYMSGTXN_IID)
|
|||
class nsImapOfflineTxn : public nsImapMoveCopyMsgTxn
|
||||
{
|
||||
public:
|
||||
nsImapOfflineTxn(nsIMsgFolder* srcFolder, nsMsgKeyArray* srcKeyArray,
|
||||
nsImapOfflineTxn(nsIMsgFolder* srcFolder, nsTArray<nsMsgKey>* srcKeyArray,
|
||||
nsIMsgFolder* dstFolder,
|
||||
PRBool isMove,
|
||||
nsOfflineImapOperationType opType,
|
||||
|
|
|
@ -423,7 +423,7 @@ void AllocateImapUidString(PRUint32 *msgUids, PRUint32 &msgCount,
|
|||
}
|
||||
}
|
||||
|
||||
void ParseUidString(const char *uidString, nsMsgKeyArray &keys)
|
||||
void ParseUidString(const char *uidString, nsTArray<nsMsgKey> &keys)
|
||||
{
|
||||
// This is in the form <id>,<id>, or <id1>:<id2>
|
||||
char curChar = *uidString;
|
||||
|
@ -444,9 +444,9 @@ void ParseUidString(const char *uidString, nsMsgKeyArray &keys)
|
|||
if (isRange)
|
||||
{
|
||||
while (saveStartToken < curToken)
|
||||
keys.Add(saveStartToken++);
|
||||
keys.AppendElement(saveStartToken++);
|
||||
}
|
||||
keys.Add(curToken);
|
||||
keys.AppendElement(curToken);
|
||||
isRange = (curChar == ':');
|
||||
if (isRange)
|
||||
saveStartToken = curToken + 1;
|
||||
|
|
|
@ -40,7 +40,8 @@
|
|||
|
||||
#include "nsString.h"
|
||||
#include "nsIMsgIncomingServer.h"
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIMailboxSpec.h"
|
||||
|
||||
class nsImapFlagAndUidState;
|
||||
|
@ -67,7 +68,7 @@ extern nsresult
|
|||
nsCreateImapBaseMessageURI(const nsACString& baseURI, nsCString& baseMessageURI);
|
||||
|
||||
void AllocateImapUidString(PRUint32 *msgUids, PRUint32 &msgCount, nsImapFlagAndUidState *flagState, nsCString &returnString);
|
||||
void ParseUidString(const char *uidString, nsMsgKeyArray &keys);
|
||||
void ParseUidString(const char *uidString, nsTArray<nsMsgKey> &keys);
|
||||
void AppendUid(nsCString &msgIds, PRUint32 uid);
|
||||
|
||||
|
||||
|
|
|
@ -109,7 +109,6 @@
|
|||
#include "nsLocalStrings.h"
|
||||
|
||||
static NS_DEFINE_CID(kMailboxServiceCID, NS_MAILBOXSERVICE_CID);
|
||||
static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// nsLocal
|
||||
|
@ -1543,13 +1542,13 @@ nsMsgLocalMailFolder::OnCopyCompleted(nsISupports *srcSupport, PRBool moveCopySu
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsMsgLocalMailFolder::SortMessagesBasedOnKey(nsISupportsArray *messages, nsMsgKeyArray &aKeyArray, nsIMsgFolder *srcFolder)
|
||||
nsMsgLocalMailFolder::SortMessagesBasedOnKey(nsISupportsArray *messages, nsTArray<nsMsgKey> &aKeyArray, nsIMsgFolder *srcFolder)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUint32 numMessages = 0;
|
||||
rv = messages->Count(&numMessages);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
NS_ASSERTION ((numMessages == aKeyArray.GetSize()), "message array and key array size are not same");
|
||||
NS_ASSERTION ((numMessages == aKeyArray.Length()), "message array and key array size are not same");
|
||||
rv = messages->Clear();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
|
@ -2773,9 +2772,9 @@ nsresult nsMsgLocalMailFolder::CopyMessagesTo(nsISupportsArray *messages,
|
|||
|
||||
if (NS_SUCCEEDED(rv) && mCopyState->m_messageService)
|
||||
{
|
||||
nsMsgKeyArray keyArray;
|
||||
PRUint32 numMessages = 0;
|
||||
messages->Count(&numMessages);
|
||||
nsTArray<nsMsgKey> keyArray(numMessages);
|
||||
for (PRUint32 i = 0; i < numMessages; i++)
|
||||
{
|
||||
nsCOMPtr<nsIMsgDBHdr> aMessage = do_QueryElementAt(messages, i, &rv);
|
||||
|
@ -2783,10 +2782,10 @@ nsresult nsMsgLocalMailFolder::CopyMessagesTo(nsISupportsArray *messages,
|
|||
{
|
||||
nsMsgKey key;
|
||||
aMessage->GetMessageKey(&key);
|
||||
keyArray.Add(key);
|
||||
keyArray.AppendElement(key);
|
||||
}
|
||||
}
|
||||
keyArray.QuickSort();
|
||||
keyArray.Sort();
|
||||
rv = SortMessagesBasedOnKey(messages, keyArray, srcFolder);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
|
@ -3373,7 +3372,7 @@ NS_IMETHODIMP
|
|||
nsMsgLocalMailFolder::NotifyCompactCompleted()
|
||||
{
|
||||
mExpungedBytes = 0;
|
||||
m_newMsgs.RemoveAll(); // if compacted, m_newMsgs probably aren't valid.
|
||||
m_newMsgs.Clear(); // if compacted, m_newMsgs probably aren't valid.
|
||||
(void) RefreshSizeOnDisk();
|
||||
(void) CloseDBIfFolderNotOpen();
|
||||
nsCOMPtr <nsIAtom> compactCompletedAtom;
|
||||
|
@ -3466,7 +3465,7 @@ nsMsgLocalMailFolder::OnMessageClassified(const char *aMsgURI, nsMsgJunkStatus a
|
|||
{
|
||||
rv = folder->SetFlag(MSG_FOLDER_FLAG_JUNK);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
mSpamKeysToMove.Add(msgKey);
|
||||
mSpamKeysToMove.AppendElement(msgKey);
|
||||
willMoveMessage = PR_TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -3476,7 +3475,7 @@ nsMsgLocalMailFolder::OnMessageClassified(const char *aMsgURI, nsMsgJunkStatus a
|
|||
// the listener should do
|
||||
// rv = folder->SetFlag(MSG_FOLDER_FLAG_JUNK);
|
||||
// NS_ENSURE_SUCCESS(rv,rv);
|
||||
// mSpamKeysToMove.Add(msgKey);
|
||||
// mSpamKeysToMove.AppendElement(msgKey);
|
||||
// willMoveMessage = PR_TRUE;
|
||||
rv = GetOrCreateFolder(mSpamFolderURI, nsnull /* aListener */);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "GetOrCreateFolder failed");
|
||||
|
@ -3489,7 +3488,7 @@ nsMsgLocalMailFolder::OnMessageClassified(const char *aMsgURI, nsMsgJunkStatus a
|
|||
|
||||
if (mNumFilterClassifyRequests == 0)
|
||||
{
|
||||
if (mSpamKeysToMove.GetSize() > 0)
|
||||
if (!mSpamKeysToMove.IsEmpty())
|
||||
{
|
||||
if (!mSpamFolderURI.IsEmpty())
|
||||
{
|
||||
|
@ -3498,7 +3497,7 @@ nsMsgLocalMailFolder::OnMessageClassified(const char *aMsgURI, nsMsgJunkStatus a
|
|||
if (NS_SUCCEEDED(rv) && folder) {
|
||||
nsCOMPtr<nsISupportsArray> messages;
|
||||
NS_NewISupportsArray(getter_AddRefs(messages));
|
||||
for (PRUint32 keyIndex = 0; keyIndex < mSpamKeysToMove.GetSize(); keyIndex++)
|
||||
for (PRUint32 keyIndex = 0; keyIndex < mSpamKeysToMove.Length(); keyIndex++)
|
||||
{
|
||||
nsCOMPtr<nsIMsgDBHdr> mailHdr = nsnull;
|
||||
rv = GetMessageHeader(mSpamKeysToMove.ElementAt(keyIndex), getter_AddRefs(mailHdr));
|
||||
|
@ -3526,8 +3525,8 @@ nsMsgLocalMailFolder::OnMessageClassified(const char *aMsgURI, nsMsgJunkStatus a
|
|||
}
|
||||
PRInt32 numNewMessages;
|
||||
GetNumNewMessages(PR_FALSE, &numNewMessages);
|
||||
SetNumNewMessages(numNewMessages - mSpamKeysToMove.GetSize());
|
||||
mSpamKeysToMove.RemoveAll();
|
||||
SetNumNewMessages(numNewMessages - mSpamKeysToMove.Length());
|
||||
mSpamKeysToMove.Clear();
|
||||
// check if this is the inbox first...
|
||||
if (mFlags & MSG_FOLDER_FLAG_INBOX)
|
||||
PerformBiffNotifications();
|
||||
|
|
|
@ -214,7 +214,7 @@ protected:
|
|||
|
||||
// copy message helper
|
||||
nsresult DisplayMoveCopyStatusMsg();
|
||||
nsresult SortMessagesBasedOnKey(nsISupportsArray *messages, nsMsgKeyArray &aKeyArray, nsIMsgFolder *srcFolder);
|
||||
nsresult SortMessagesBasedOnKey(nsISupportsArray *messages, nsTArray<nsMsgKey> &aKeyArray, nsIMsgFolder *srcFolder);
|
||||
|
||||
nsresult CopyMessageTo(nsISupports *message, nsIMsgFolder *dstFolder,
|
||||
nsIMsgWindow *msgWindow, PRBool isMove);
|
||||
|
@ -242,7 +242,7 @@ protected:
|
|||
PRPackedBool m_parsingFolder;
|
||||
nsCOMPtr<nsIUrlListener> mReparseListener;
|
||||
PRInt32 mNumFilterClassifyRequests;
|
||||
nsMsgKeyArray mSpamKeysToMove;
|
||||
nsTArray<nsMsgKey> mSpamKeysToMove;
|
||||
nsCString mSpamFolderURI;
|
||||
nsresult setSubfolderFlag(const nsAString& aFolderName, PRUint32 flags);
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ nsLocalMoveCopyMsgTxn::SetDstFolder(nsIMsgFolder* dstFolder)
|
|||
nsresult
|
||||
nsLocalMoveCopyMsgTxn::AddSrcKey(nsMsgKey aKey)
|
||||
{
|
||||
m_srcKeyArray.Add(aKey);
|
||||
m_srcKeyArray.AppendElement(aKey);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ nsLocalMoveCopyMsgTxn::AddSrcStatusOffset(PRUint32 aStatusOffset)
|
|||
nsresult
|
||||
nsLocalMoveCopyMsgTxn::AddDstKey(nsMsgKey aKey)
|
||||
{
|
||||
m_dstKeyArray.Add(aKey);
|
||||
m_dstKeyArray.AppendElement(aKey);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ nsLocalMoveCopyMsgTxn::AddDstMsgSize(PRUint32 msgSize)
|
|||
|
||||
nsresult
|
||||
nsLocalMoveCopyMsgTxn::UndoImapDeleteFlag(nsIMsgFolder* folder,
|
||||
nsMsgKeyArray& keyArray,
|
||||
nsTArray<nsMsgKey>& keyArray,
|
||||
PRBool deleteFlag)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
@ -163,7 +163,7 @@ nsLocalMoveCopyMsgTxn::UndoImapDeleteFlag(nsIMsgFolder* folder,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIUrlListener> urlListener;
|
||||
nsCString msgIds;
|
||||
PRUint32 i, count = keyArray.GetSize();
|
||||
PRUint32 i, count = keyArray.Length();
|
||||
urlListener = do_QueryInterface(folder, &rv);
|
||||
for (i=0; i < count; i++)
|
||||
{
|
||||
|
@ -268,7 +268,7 @@ nsLocalMoveCopyMsgTxn::UndoTransactionInternal()
|
|||
rv = dstFolder->GetMsgDatabase(nsnull, getter_AddRefs(dstDB));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRUint32 count = m_srcKeyArray.GetSize();
|
||||
PRUint32 count = m_srcKeyArray.Length();
|
||||
PRUint32 i;
|
||||
nsCOMPtr<nsIMsgDBHdr> oldHdr;
|
||||
nsCOMPtr<nsIMsgDBHdr> newHdr;
|
||||
|
@ -344,7 +344,7 @@ nsLocalMoveCopyMsgTxn::RedoTransaction()
|
|||
rv = dstFolder->GetMsgDatabase(nsnull, getter_AddRefs(dstDB));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRUint32 count = m_srcKeyArray.GetSize();
|
||||
PRUint32 count = m_srcKeyArray.Length();
|
||||
PRUint32 i;
|
||||
nsCOMPtr<nsIMsgDBHdr> oldHdr;
|
||||
nsCOMPtr<nsIMsgDBHdr> newHdr;
|
||||
|
@ -384,8 +384,8 @@ nsLocalMoveCopyMsgTxn::RedoTransaction()
|
|||
{
|
||||
// protect against a bogus undo txn without any source keys
|
||||
// see bug #179856 for details
|
||||
NS_ASSERTION(m_srcKeyArray.GetSize(), "no source keys");
|
||||
if (!m_srcKeyArray.GetSize())
|
||||
NS_ASSERTION(!m_srcKeyArray.IsEmpty(), "no source keys");
|
||||
if (m_srcKeyArray.IsEmpty())
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
PRBool deleteFlag = PR_FALSE; //message is un-deleted- we are trying to redo
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "nsIMsgFolder.h"
|
||||
#include "nsMailboxService.h"
|
||||
#include "nsMsgTxn.h"
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIUrlListener.h"
|
||||
|
@ -81,16 +81,16 @@ public:
|
|||
nsIMsgFolder* dstFolder,
|
||||
PRBool isMove);
|
||||
nsresult UndoImapDeleteFlag(nsIMsgFolder* aFolder,
|
||||
nsMsgKeyArray& aKeyArray,
|
||||
nsTArray<nsMsgKey>& aKeyArray,
|
||||
PRBool deleteFlag);
|
||||
nsresult UndoTransactionInternal();
|
||||
|
||||
private:
|
||||
nsWeakPtr m_srcFolder;
|
||||
nsMsgKeyArray m_srcKeyArray; // used when src is local or imap
|
||||
nsTArray<nsMsgKey> m_srcKeyArray; // used when src is local or imap
|
||||
nsTArray<PRUint32> m_srcStatusOffsetArray; // used when src is local
|
||||
nsWeakPtr m_dstFolder;
|
||||
nsMsgKeyArray m_dstKeyArray;
|
||||
nsTArray<nsMsgKey> m_dstKeyArray;
|
||||
PRBool m_isMove;
|
||||
PRBool m_srcIsImap4;
|
||||
nsTArray<PRUint32> m_dstSizeArray;
|
||||
|
|
|
@ -46,7 +46,8 @@
|
|||
#include "nsMailboxProtocol.h"
|
||||
#include "nsIMsgDatabase.h"
|
||||
#include "nsMsgDBCID.h"
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsLocalUtils.h"
|
||||
#include "nsMsgLocalCID.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
|
@ -127,7 +128,7 @@ nsresult nsMailboxService::CopyMessage(const char * aSrcMailboxURI,
|
|||
return FetchMessage(aSrcMailboxURI, aMailboxCopyHandler, aMsgWindow, aUrlListener, nsnull, mailboxAction, nsnull, aURL);
|
||||
}
|
||||
|
||||
nsresult nsMailboxService::CopyMessages(nsMsgKeyArray &msgKeys,
|
||||
nsresult nsMailboxService::CopyMessages(nsTArray<nsMsgKey> &msgKeys,
|
||||
nsIMsgFolder *srcFolder,
|
||||
nsIStreamListener * aMailboxCopyHandler,
|
||||
PRBool moveMessage,
|
||||
|
@ -162,7 +163,7 @@ nsresult nsMailboxService::CopyMessages(nsMsgKeyArray &msgKeys,
|
|||
nsCOMPtr<nsIMailboxUrl> mailboxUrl (do_QueryInterface(url));
|
||||
msgUrl->SetMsgWindow(aMsgWindow);
|
||||
|
||||
mailboxUrl->SetMoveCopyMsgKeys(msgKeys.GetArray(), msgKeys.GetSize());
|
||||
mailboxUrl->SetMoveCopyMsgKeys(msgKeys.Elements(), msgKeys.Length());
|
||||
rv = RunMailboxUrl(url, aMailboxCopyHandler);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -488,9 +488,8 @@ NS_IMETHODIMP nsMailboxUrl::SetCharsetOverRide(const char * aCharacterSet)
|
|||
/* void setMoveCopyMsgKeys (out nsMsgKey keysToFlag, in long numKeys); */
|
||||
NS_IMETHODIMP nsMailboxUrl::SetMoveCopyMsgKeys(nsMsgKey *keysToFlag, PRInt32 numKeys)
|
||||
{
|
||||
m_keys.RemoveAll();
|
||||
m_keys.Add(keysToFlag, numKeys);
|
||||
if (m_keys.GetSize() > 0 && m_messageKey == nsMsgKey_None)
|
||||
m_keys.ReplaceElementsAt(0, m_keys.Length(), keysToFlag, numKeys);
|
||||
if (!m_keys.IsEmpty() && m_messageKey == nsMsgKey_None)
|
||||
m_messageKey = m_keys[0];
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -498,7 +497,7 @@ NS_IMETHODIMP nsMailboxUrl::SetMoveCopyMsgKeys(nsMsgKey *keysToFlag, PRInt32 num
|
|||
NS_IMETHODIMP nsMailboxUrl::GetMoveCopyMsgHdrForIndex(PRUint32 msgIndex, nsIMsgDBHdr **msgHdr)
|
||||
{
|
||||
NS_ENSURE_ARG(msgHdr);
|
||||
if (msgIndex < m_keys.GetSize())
|
||||
if (msgIndex < m_keys.Length())
|
||||
{
|
||||
nsMsgKey nextKey = m_keys[msgIndex];
|
||||
return GetMsgHdrForKey(nextKey, msgHdr);
|
||||
|
@ -509,7 +508,7 @@ NS_IMETHODIMP nsMailboxUrl::GetMoveCopyMsgHdrForIndex(PRUint32 msgIndex, nsIMsgD
|
|||
NS_IMETHODIMP nsMailboxUrl::GetNumMoveCopyMsgs(PRUint32 *numMsgs)
|
||||
{
|
||||
NS_ENSURE_ARG(numMsgs);
|
||||
*numMsgs = m_keys.GetSize();
|
||||
*numMsgs = m_keys.Length();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@
|
|||
#include "nsMsgMailNewsUrl.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsISupportsObsolete.h"
|
||||
|
||||
class nsMailboxUrl : public nsIMailboxUrl, public nsMsgMailNewsUrl, public nsIMsgMessageUrl, public nsIMsgI18NUrl
|
||||
|
@ -104,7 +105,7 @@ protected:
|
|||
nsresult ParseSearchPart();
|
||||
|
||||
// for multiple msg move/copy
|
||||
nsMsgKeyArray m_keys;
|
||||
nsTArray<nsMsgKey> m_keys;
|
||||
PRInt32 m_curMsgIndex;
|
||||
|
||||
// truncated message support
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
|
||||
#include "nsIURI.h"
|
||||
#include "nsIMsgParseMailMsgState.h"
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsMsgLineBuffer.h"
|
||||
|
|
|
@ -895,8 +895,8 @@ MsgMapiListContext::DeleteMessage(nsMsgKey key)
|
|||
if (!m_db)
|
||||
return FALSE;
|
||||
|
||||
nsMsgKeyArray messageKeys;
|
||||
messageKeys.InsertAt(0, key);
|
||||
nsAutoTArray<nsMsgKey, 1> messageKeys;
|
||||
messageKeys.AppendElement(key);
|
||||
|
||||
if ( !IsIMAPHost() )
|
||||
{
|
||||
|
|
|
@ -85,10 +85,10 @@ NS_IMETHODIMP
|
|||
nsNNTPArticleList::AddArticleKey(PRInt32 key)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
m_idsOnServer.Add(key);
|
||||
m_idsOnServer.AppendElement(key);
|
||||
#endif
|
||||
|
||||
if (m_dbIndex < m_idsInDB.GetSize())
|
||||
if (m_dbIndex < m_idsInDB.Length())
|
||||
{
|
||||
PRInt32 idInDBToCheck = m_idsInDB[m_dbIndex];
|
||||
// if there are keys in the database that aren't in the newsgroup
|
||||
|
@ -98,9 +98,9 @@ nsNNTPArticleList::AddArticleKey(PRInt32 key)
|
|||
{
|
||||
m_newsFolder->RemoveMessage(idInDBToCheck);
|
||||
#ifdef DEBUG
|
||||
m_idsDeleted.Add(idInDBToCheck);
|
||||
m_idsDeleted.AppendElement(idInDBToCheck);
|
||||
#endif
|
||||
if (m_dbIndex >= m_idsInDB.GetSize())
|
||||
if (m_dbIndex >= m_idsInDB.Length())
|
||||
break;
|
||||
idInDBToCheck = m_idsInDB[++m_dbIndex];
|
||||
}
|
||||
|
@ -115,20 +115,20 @@ nsNNTPArticleList::FinishAddingArticleKeys()
|
|||
{
|
||||
// if the last n messages in the group are cancelled, they won't have gotten removed
|
||||
// so we have to go an removed them now.
|
||||
PRUint32 totalCount = m_idsInDB.GetSize();
|
||||
PRUint32 totalCount = m_idsInDB.Length();
|
||||
PRUint32 i;
|
||||
|
||||
for (i = m_dbIndex; i < totalCount; i++) {
|
||||
m_newsFolder->RemoveMessage(m_idsInDB[i]);
|
||||
#ifdef DEBUG
|
||||
m_idsDeleted.Add(m_idsInDB[i]);
|
||||
m_idsDeleted.AppendElement(m_idsInDB[i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// make sure none of the deleted turned up on the idsOnServer list
|
||||
for (i = 0; i < m_idsDeleted.GetSize(); i++) {
|
||||
NS_ASSERTION(m_idsOnServer.FindIndex((nsMsgKey)(m_idsDeleted[i]), 0) == nsMsgViewIndex_None, "a deleted turned up on the idsOnServer list");
|
||||
for (i = 0; i < m_idsDeleted.Length(); i++) {
|
||||
NS_ASSERTION(m_idsOnServer.IndexOf((nsMsgKey)(m_idsDeleted[i]), 0) == nsMsgViewIndex_None, "a deleted turned up on the idsOnServer list");
|
||||
}
|
||||
#endif
|
||||
return NS_OK;
|
||||
|
|
|
@ -42,7 +42,8 @@
|
|||
#include "nsINNTPArticleList.h"
|
||||
#include "nsIMsgNewsFolder.h"
|
||||
#include "nsIMsgDatabase.h"
|
||||
#include "nsMsgKeyArray.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsNNTPArticleList : public nsINNTPArticleList
|
||||
{
|
||||
|
@ -54,11 +55,11 @@ public:
|
|||
NS_DECL_NSINNTPARTICLELIST
|
||||
|
||||
protected:
|
||||
nsMsgKeyArray m_idsInDB;
|
||||
nsTArray<nsMsgKey> m_idsInDB;
|
||||
|
||||
#ifdef DEBUG
|
||||
nsMsgKeyArray m_idsOnServer;
|
||||
nsMsgKeyArray m_idsDeleted;
|
||||
nsTArray<nsMsgKey> m_idsOnServer;
|
||||
nsTArray<nsMsgKey> m_idsDeleted;
|
||||
#endif
|
||||
|
||||
nsCOMPtr <nsIMsgNewsFolder> m_newsFolder;
|
||||
|
|
|
@ -57,12 +57,12 @@
|
|||
// if pIds is not null, download the articles whose id's are passed in. Otherwise,
|
||||
// which articles to download is determined by nsNewsDownloader object,
|
||||
// or subclasses thereof. News can download marked objects, for example.
|
||||
nsresult nsNewsDownloader::DownloadArticles(nsIMsgWindow *window, nsIMsgFolder *folder, nsMsgKeyArray *pIds)
|
||||
nsresult nsNewsDownloader::DownloadArticles(nsIMsgWindow *window, nsIMsgFolder *folder, nsTArray<nsMsgKey> *pIds)
|
||||
{
|
||||
if (pIds != nsnull)
|
||||
m_keysToDownload.InsertAt(0, pIds);
|
||||
m_keysToDownload.InsertElementsAt(0, pIds->Elements(), pIds->Length());
|
||||
|
||||
if (m_keysToDownload.GetSize() > 0)
|
||||
if (!m_keysToDownload.IsEmpty())
|
||||
m_downloadFromKeys = PR_TRUE;
|
||||
|
||||
m_folder = folder;
|
||||
|
@ -187,12 +187,12 @@ PRBool nsNewsDownloader::GetNextHdrToRetrieve()
|
|||
nsresult rv;
|
||||
if (m_downloadFromKeys)
|
||||
{
|
||||
if (m_numwrote >= (PRInt32) m_keysToDownload.GetSize())
|
||||
if (m_numwrote >= (PRInt32) m_keysToDownload.Length())
|
||||
return PR_FALSE;
|
||||
|
||||
m_keyToDownload = m_keysToDownload[m_numwrote++];
|
||||
PRInt32 percent;
|
||||
percent = (100 * m_numwrote) / (PRInt32) m_keysToDownload.GetSize();
|
||||
percent = (100 * m_numwrote) / (PRInt32) m_keysToDownload.Length();
|
||||
|
||||
PRInt64 nowMS = LL_ZERO;
|
||||
if (percent < 100) // always need to do 100%
|
||||
|
@ -219,7 +219,7 @@ PRBool nsNewsDownloader::GetNextHdrToRetrieve()
|
|||
nsAutoString firstStr;
|
||||
firstStr.AppendInt(m_numwrote);
|
||||
nsAutoString totalStr;
|
||||
totalStr.AppendInt(m_keysToDownload.GetSize());
|
||||
totalStr.AppendInt(m_keysToDownload.Length());
|
||||
nsString prettiestName;
|
||||
nsString statusString;
|
||||
|
||||
|
@ -298,14 +298,14 @@ NS_IMETHODIMP nsNewsDownloader::OnSearchHit(nsIMsgDBHdr *header, nsIMsgFolder *f
|
|||
{
|
||||
nsMsgKey key;
|
||||
header->GetMessageKey(&key);
|
||||
m_keysToDownload.Add(key);
|
||||
m_keysToDownload.AppendElement(key);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNewsDownloader::OnSearchDone(nsresult status)
|
||||
{
|
||||
if (m_keysToDownload.GetSize() == 0)
|
||||
if (m_keysToDownload.IsEmpty())
|
||||
{
|
||||
if (m_listener)
|
||||
return m_listener->OnStopRunningUrl(nsnull, NS_OK);
|
||||
|
@ -519,7 +519,7 @@ nsresult DownloadMatchingNewsArticlesToNewsDB::RunSearch(nsIMsgFolder *folder, n
|
|||
m_newsDB = newsDB;
|
||||
m_searchSession = searchSession;
|
||||
|
||||
m_keysToDownload.RemoveAll();
|
||||
m_keysToDownload.Clear();
|
||||
nsresult rv;
|
||||
NS_ENSURE_ARG(searchSession);
|
||||
NS_ENSURE_ARG(folder);
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
NS_DECL_NSIURLLISTENER
|
||||
NS_DECL_NSIMSGSEARCHNOTIFY
|
||||
|
||||
virtual nsresult DownloadArticles(nsIMsgWindow *window, nsIMsgFolder *folder, nsMsgKeyArray *pKeyArray);
|
||||
virtual nsresult DownloadArticles(nsIMsgWindow *window, nsIMsgFolder *folder, nsTArray<nsMsgKey> *pKeyArray);
|
||||
|
||||
PRBool ShouldAbort() const { return m_abort; }
|
||||
|
||||
|
@ -73,7 +73,7 @@ protected:
|
|||
virtual PRInt32 StartDownload() {return 0;}
|
||||
virtual nsresult ShowProgress(const PRUnichar *progressString, PRInt32 percent);
|
||||
|
||||
nsMsgKeyArray m_keysToDownload;
|
||||
nsTArray<nsMsgKey> m_keysToDownload;
|
||||
nsCOMPtr <nsIMsgFolder> m_folder;
|
||||
nsCOMPtr <nsIMsgDatabase> m_newsDB;
|
||||
nsCOMPtr <nsIUrlListener> m_listener;
|
||||
|
|
|
@ -95,7 +95,6 @@
|
|||
#include "nsIMsgAccountManager.h"
|
||||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kCNewsDB, NS_NEWSDB_CID);
|
||||
|
||||
// ###tw This really ought to be the most
|
||||
// efficient file reading size for the current
|
||||
|
@ -1529,7 +1528,7 @@ NS_IMETHODIMP nsMsgNewsFolder::SetSaveArticleOffline(PRBool aBool)
|
|||
|
||||
NS_IMETHODIMP nsMsgNewsFolder::DownloadAllForOffline(nsIUrlListener *listener, nsIMsgWindow *msgWindow)
|
||||
{
|
||||
nsMsgKeyArray srcKeyArray;
|
||||
nsTArray<nsMsgKey> srcKeyArray;
|
||||
SetSaveArticleOffline(PR_TRUE);
|
||||
nsresult rv;
|
||||
|
||||
|
@ -1553,7 +1552,7 @@ NS_IMETHODIMP nsMsgNewsFolder::DownloadAllForOffline(nsIUrlListener *listener, n
|
|||
pHeader->GetMessageKey(&msgKey);
|
||||
MsgFitsDownloadCriteria(msgKey, &shouldStoreMsgOffline);
|
||||
if (shouldStoreMsgOffline)
|
||||
srcKeyArray.Add(msgKey);
|
||||
srcKeyArray.AppendElement(msgKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1567,7 +1566,7 @@ NS_IMETHODIMP nsMsgNewsFolder::DownloadAllForOffline(nsIUrlListener *listener, n
|
|||
|
||||
NS_IMETHODIMP nsMsgNewsFolder::DownloadMessagesForOffline(nsISupportsArray *messages, nsIMsgWindow *window)
|
||||
{
|
||||
nsMsgKeyArray srcKeyArray;
|
||||
nsTArray<nsMsgKey> srcKeyArray;
|
||||
SetSaveArticleOffline(PR_TRUE); // ### TODO need to clear this when we've finished
|
||||
PRUint32 count = 0;
|
||||
PRUint32 i;
|
||||
|
@ -1582,7 +1581,7 @@ NS_IMETHODIMP nsMsgNewsFolder::DownloadMessagesForOffline(nsISupportsArray *mess
|
|||
if (msgDBHdr)
|
||||
rv = msgDBHdr->GetMessageKey(&key);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
srcKeyArray.Add(key);
|
||||
srcKeyArray.AppendElement(key);
|
||||
}
|
||||
DownloadNewsArticlesToOfflineStore *downloadState = new DownloadNewsArticlesToOfflineStore(window, mDatabase, this);
|
||||
if (!downloadState)
|
||||
|
|
|
@ -698,7 +698,7 @@ nsNntpService::CopyMessage(const char * aSrcMessageURI, nsIStreamListener * aMai
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpService::CopyMessages(nsMsgKeyArray &keys, nsIMsgFolder *srcFolder, nsIStreamListener * aMailboxCopyHandler, PRBool moveMessage,
|
||||
nsNntpService::CopyMessages(nsTArray<nsMsgKey> &keys, nsIMsgFolder *srcFolder, nsIStreamListener * aMailboxCopyHandler, PRBool moveMessage,
|
||||
nsIUrlListener * aUrlListener, nsIMsgWindow *aMsgWindow, nsIURI **aURL)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
|
Загрузка…
Ссылка в новой задаче