Bug 1594892 - xpidl [array] removal from nsIMsgDatabase.MarkAllRead(). r=mkmelin
This commit is contained in:
Родитель
de8fe6a711
Коммит
09a2472bcf
|
@ -1396,16 +1396,15 @@ nsMsgDBFolder::MarkAllMessagesRead(nsIMsgWindow *aMsgWindow) {
|
|||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
EnableNotifications(allMessageCountNotifications, false);
|
||||
nsMsgKey *thoseMarked;
|
||||
uint32_t numMarked;
|
||||
rv = mDatabase->MarkAllRead(&numMarked, &thoseMarked);
|
||||
nsTArray<nsMsgKey> thoseMarked;
|
||||
rv = mDatabase->MarkAllRead(thoseMarked);
|
||||
EnableNotifications(allMessageCountNotifications, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Setup a undo-state
|
||||
if (aMsgWindow && numMarked)
|
||||
rv = AddMarkAllReadUndoAction(aMsgWindow, thoseMarked, numMarked);
|
||||
free(thoseMarked);
|
||||
if (aMsgWindow && thoseMarked.Length() > 0)
|
||||
rv = AddMarkAllReadUndoAction(aMsgWindow, thoseMarked.Elements(),
|
||||
thoseMarked.Length());
|
||||
}
|
||||
|
||||
SetHasNewMessages(false);
|
||||
|
|
|
@ -415,8 +415,7 @@ interface nsIMsgDatabase : nsIDBChangeAnnouncer {
|
|||
/// Does the message have attachments.
|
||||
boolean HasAttachments(in nsMsgKey key);
|
||||
|
||||
void MarkAllRead(out unsigned long aCount,
|
||||
[array, size_is(aCount)] out nsMsgKey aKeys);
|
||||
Array<nsMsgKey> markAllRead();
|
||||
|
||||
void deleteMessages(in unsigned long aNumKeys,
|
||||
[array, size_is(aNumKeys)] in nsMsgKey nsMsgKeys,
|
||||
|
|
|
@ -31,7 +31,7 @@ class nsNewsDatabase : public nsMsgDatabase, public nsINewsDatabase {
|
|||
|
||||
NS_IMETHOD GetHighWaterArticleNum(nsMsgKey *key) override;
|
||||
NS_IMETHOD GetLowWaterArticleNum(nsMsgKey *key) override;
|
||||
NS_IMETHOD MarkAllRead(uint32_t *aNumMarked, nsMsgKey **thoseMarked) override;
|
||||
NS_IMETHOD MarkAllRead(nsTArray<nsMsgKey> &thoseMarked) override;
|
||||
|
||||
virtual nsresult ExpireUpTo(nsMsgKey expireKey);
|
||||
virtual nsresult ExpireRange(nsMsgKey startRange, nsMsgKey endRange);
|
||||
|
|
|
@ -2424,14 +2424,11 @@ nsMsgDatabase::MarkHdrNotNew(nsIMsgDBHdr *aMsgHdr,
|
|||
return SetMsgHdrFlag(aMsgHdr, false, nsMsgMessageFlags::New, aInstigator);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::MarkAllRead(uint32_t *aNumKeys,
|
||||
nsMsgKey **aThoseMarked) {
|
||||
NS_ENSURE_ARG_POINTER(aNumKeys);
|
||||
NS_ENSURE_ARG_POINTER(aThoseMarked);
|
||||
NS_IMETHODIMP nsMsgDatabase::MarkAllRead(nsTArray<nsMsgKey> &aThoseMarked) {
|
||||
nsMsgHdr *pHeader;
|
||||
aThoseMarked.ClearAndRetainStorage();
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> hdrs;
|
||||
nsTArray<nsMsgKey> thoseMarked;
|
||||
nsresult rv = EnumerateMessages(getter_AddRefs(hdrs));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
bool hasMore = false;
|
||||
|
@ -2447,21 +2444,12 @@ NS_IMETHODIMP nsMsgDatabase::MarkAllRead(uint32_t *aNumKeys,
|
|||
if (!isRead) {
|
||||
nsMsgKey key;
|
||||
(void)pHeader->GetMessageKey(&key);
|
||||
thoseMarked.AppendElement(key);
|
||||
aThoseMarked.AppendElement(key);
|
||||
rv = MarkHdrRead(pHeader, true, nullptr); // ### dmb - blow off error?
|
||||
}
|
||||
NS_RELEASE(pHeader);
|
||||
}
|
||||
|
||||
*aNumKeys = thoseMarked.Length();
|
||||
|
||||
if (thoseMarked.Length()) {
|
||||
*aThoseMarked = (nsMsgKey *)moz_xmemdup(
|
||||
&thoseMarked[0], thoseMarked.Length() * sizeof(nsMsgKey));
|
||||
if (!*aThoseMarked) return NS_ERROR_OUT_OF_MEMORY;
|
||||
} else
|
||||
*aThoseMarked = nullptr;
|
||||
|
||||
// force num new to 0.
|
||||
int32_t numUnreadMessages;
|
||||
|
||||
|
|
|
@ -183,8 +183,7 @@ bool nsNewsDatabase::SetHdrReadFlag(nsIMsgDBHdr *msgHdr, bool bRead) {
|
|||
return true;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNewsDatabase::MarkAllRead(uint32_t *aNumMarked,
|
||||
nsMsgKey **aThoseMarked) {
|
||||
NS_IMETHODIMP nsNewsDatabase::MarkAllRead(nsTArray<nsMsgKey> &aThoseMarked) {
|
||||
nsMsgKey lowWater = nsMsgKey_None, highWater;
|
||||
nsCString knownArts;
|
||||
if (m_dbFolderInfo) {
|
||||
|
@ -197,7 +196,7 @@ NS_IMETHODIMP nsNewsDatabase::MarkAllRead(uint32_t *aNumMarked,
|
|||
if (lowWater == nsMsgKey_None) GetLowWaterArticleNum(&lowWater);
|
||||
GetHighWaterArticleNum(&highWater);
|
||||
if (lowWater > 2) m_readSet->AddRange(1, lowWater - 1);
|
||||
nsresult err = nsMsgDatabase::MarkAllRead(aNumMarked, aThoseMarked);
|
||||
nsresult err = nsMsgDatabase::MarkAllRead(aThoseMarked);
|
||||
if (NS_SUCCEEDED(err) && 1 <= highWater)
|
||||
m_readSet->AddRange(1, highWater); // mark everything read in newsrc.
|
||||
|
||||
|
|
|
@ -1705,20 +1705,19 @@ NS_IMETHODIMP
|
|||
nsImapMailFolder::MarkAllMessagesRead(nsIMsgWindow *aMsgWindow) {
|
||||
nsresult rv = GetDatabase();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsMsgKey *thoseMarked;
|
||||
uint32_t numMarked;
|
||||
nsTArray<nsMsgKey> thoseMarked;
|
||||
EnableNotifications(allMessageCountNotifications, false);
|
||||
rv = mDatabase->MarkAllRead(&numMarked, &thoseMarked);
|
||||
rv = mDatabase->MarkAllRead(thoseMarked);
|
||||
EnableNotifications(allMessageCountNotifications, true);
|
||||
if (NS_SUCCEEDED(rv) && numMarked) {
|
||||
rv = StoreImapFlags(kImapMsgSeenFlag, true, thoseMarked, numMarked,
|
||||
nullptr);
|
||||
if (NS_SUCCEEDED(rv) && thoseMarked.Length() > 0) {
|
||||
rv = StoreImapFlags(kImapMsgSeenFlag, true, thoseMarked.Elements(),
|
||||
thoseMarked.Length(), nullptr);
|
||||
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
|
||||
// Setup a undo-state
|
||||
if (aMsgWindow)
|
||||
rv = AddMarkAllReadUndoAction(aMsgWindow, thoseMarked, numMarked);
|
||||
free(thoseMarked);
|
||||
rv = AddMarkAllReadUndoAction(aMsgWindow, thoseMarked.Elements(),
|
||||
thoseMarked.Length());
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
|
|
|
@ -1127,34 +1127,36 @@ nsMsgLocalMailFolder::MarkAllMessagesRead(nsIMsgWindow *aMsgWindow) {
|
|||
nsresult rv = GetDatabase();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsMsgKey *thoseMarked = nullptr;
|
||||
uint32_t numMarked = 0;
|
||||
nsTArray<nsMsgKey> thoseMarked;
|
||||
EnableNotifications(allMessageCountNotifications, false);
|
||||
rv = mDatabase->MarkAllRead(&numMarked, &thoseMarked);
|
||||
rv = mDatabase->MarkAllRead(thoseMarked);
|
||||
EnableNotifications(allMessageCountNotifications, true);
|
||||
if (NS_FAILED(rv) || !numMarked || !thoseMarked) return rv;
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
do {
|
||||
nsCOMPtr<nsIMutableArray> messages;
|
||||
rv = MsgGetHdrsFromKeys(mDatabase, thoseMarked, numMarked,
|
||||
getter_AddRefs(messages));
|
||||
if (NS_FAILED(rv)) break;
|
||||
if (thoseMarked.IsEmpty()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIMsgPluggableStore> msgStore;
|
||||
rv = GetMsgStore(getter_AddRefs(msgStore));
|
||||
if (NS_FAILED(rv)) break;
|
||||
nsCOMPtr<nsIMutableArray> messages;
|
||||
rv = MsgGetHdrsFromKeys(mDatabase, thoseMarked.Elements(),
|
||||
thoseMarked.Length(),
|
||||
getter_AddRefs(messages));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = msgStore->ChangeFlags(messages, nsMsgMessageFlags::Read, true);
|
||||
if (NS_FAILED(rv)) break;
|
||||
nsCOMPtr<nsIMsgPluggableStore> msgStore;
|
||||
rv = GetMsgStore(getter_AddRefs(msgStore));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
rv = msgStore->ChangeFlags(messages, nsMsgMessageFlags::Read, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Setup a undo-state
|
||||
if (aMsgWindow)
|
||||
rv = AddMarkAllReadUndoAction(aMsgWindow, thoseMarked, numMarked);
|
||||
} while (false);
|
||||
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
|
||||
// Setup a undo-state
|
||||
if (aMsgWindow)
|
||||
rv = AddMarkAllReadUndoAction(aMsgWindow, thoseMarked.Elements(),
|
||||
thoseMarked.Length());
|
||||
|
||||
free(thoseMarked);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче