Bug 11054 Back end support for ignoring (killing) a subthread (branch) [Troll] p=pidgeot18@gmail.com r=bienvenu sr=me

This commit is contained in:
neil%parkwaycc.co.uk 2008-04-06 23:31:07 +00:00
Родитель 420ca8103c
Коммит 3b146619eb
16 изменённых файлов: 275 добавлений и 21 удалений

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

@ -240,6 +240,7 @@ interface nsMsgNavigationType
const nsMsgNavigationTypeValue firstNew = 20;
const nsMsgNavigationTypeValue editUndo = 21;
const nsMsgNavigationTypeValue editRedo = 22;
const nsMsgNavigationTypeValue toggleSubthreadKilled = 23;
};

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

@ -47,7 +47,7 @@
interface nsIMsgFolder;
[scriptable, uuid(B5212A60-F93F-11d2-951C-006097222B83)]
[scriptable, uuid(56515ecb-5ad2-4b3e-9877-c6df26bb9443)]
interface nsIMsgDBHdr : nsISupports
{
/* general property routines - I think this can retrieve any
@ -64,6 +64,9 @@ interface nsIMsgDBHdr : nsISupports
readonly attribute boolean isRead;
readonly attribute boolean isFlagged;
// Special accessor that checks if a message is part of an ignored subthread
readonly attribute boolean isKilled;
// Mark message routines
void markRead(in boolean read);
void markFlagged(in boolean flagged);

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

@ -83,5 +83,6 @@ interface nsMsgFilterAction {
const long FetchBodyFromPop3Server=15;
const long CopyToFolder=16;
const long AddTag=17;
const long KillSubthread=18;
};

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

@ -873,6 +873,7 @@ static struct RuleActionsTableEntry ruleActionsTable[] =
{ nsMsgFilterAction::Delete, nsMsgFilterType::All, 0, "Delete"},
{ nsMsgFilterAction::MarkRead, nsMsgFilterType::All, 0, "Mark read"},
{ nsMsgFilterAction::KillThread, nsMsgFilterType::All, 0, "Ignore thread"},
{ nsMsgFilterAction::KillSubthread, nsMsgFilterType::All, 0, "Ignore subthread"},
{ nsMsgFilterAction::WatchThread, nsMsgFilterType::All, 0, "Watch thread"},
{ nsMsgFilterAction::MarkFlagged, nsMsgFilterType::All, 0, "Mark flagged"},
{ nsMsgFilterAction::Label, nsMsgFilterType::All, 0, "Label"},

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

@ -581,6 +581,17 @@ nsresult nsMsgFilterAfterTheFact::ApplyFilter()
}
}
break;
case nsMsgFilterAction::KillSubthread:
{
for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.Length(); msgIndex++)
{
nsCOMPtr <nsIMsgDBHdr> msgHdr;
m_searchHitHdrs->QueryElementAt(msgIndex, NS_GET_IID(nsIMsgDBHdr), getter_AddRefs(msgHdr));
if (msgHdr)
m_curFolderDB->MarkHeaderKilled(msgHdr, PR_TRUE, nsnull);
}
}
break;
case nsMsgFilterAction::ChangePriority:
{
nsMsgPriorityValue filterPriority;

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

@ -91,6 +91,7 @@ nsIAtom * nsMsgDBView::kAttachMsgAtom = nsnull;
nsIAtom * nsMsgDBView::kHasUnreadAtom = nsnull;
nsIAtom * nsMsgDBView::kWatchThreadAtom = nsnull;
nsIAtom * nsMsgDBView::kIgnoreThreadAtom = nsnull;
nsIAtom * nsMsgDBView::kIgnoreSubthreadAtom = nsnull;
nsIAtom * nsMsgDBView::kHasImageAtom = nsnull;
nsIAtom * nsMsgDBView::kJunkMsgAtom = nsnull;
@ -199,6 +200,7 @@ void nsMsgDBView::InitializeAtomsAndLiterals()
kHasUnreadAtom = NS_NewAtom("hasUnread");
kWatchThreadAtom = NS_NewAtom("watch");
kIgnoreThreadAtom = NS_NewAtom("ignore");
kIgnoreSubthreadAtom = NS_NewAtom("ignoreSubthread");
kHasImageAtom = NS_NewAtom("hasimage");
kJunkMsgAtom = NS_NewAtom("junk");
kNotJunkMsgAtom = NS_NewAtom("notjunk");
@ -248,6 +250,7 @@ nsMsgDBView::~nsMsgDBView()
NS_IF_RELEASE(kHasUnreadAtom);
NS_IF_RELEASE(kWatchThreadAtom);
NS_IF_RELEASE(kIgnoreThreadAtom);
NS_IF_RELEASE(kIgnoreSubthreadAtom);
NS_IF_RELEASE(kHasImageAtom);
NS_IF_RELEASE(kJunkMsgAtom);
NS_IF_RELEASE(kNotJunkMsgAtom);
@ -1207,6 +1210,9 @@ NS_IMETHODIMP nsMsgDBView::GetCellProperties(PRInt32 aRow, nsITreeColumn *col, n
if (flags & MSG_FLAG_NEW)
properties->AppendElement(kNewMsgAtom);
if (flags & MSG_FLAG_IGNORED)
properties->AppendElement(kIgnoreSubthreadAtom);
nsCOMPtr <nsIMsgLocalMailFolder> localFolder = do_QueryInterface(m_folder);
if ((flags & MSG_FLAG_OFFLINE) || (localFolder && !(flags & MSG_FLAG_PARTIAL)))
@ -4697,6 +4703,11 @@ nsresult nsMsgDBView::AddHdr(nsIMsgDBHdr *msgHdr)
if (flags & MSG_FLAG_IGNORED)
return NS_OK;
}
PRBool ignored;
msgHdr->GetIsKilled(&ignored);
if (ignored)
return NS_OK;
}
nsMsgKey msgKey, threadId;
@ -4804,7 +4815,18 @@ nsresult nsMsgDBView::ListIdsInThreadOrder(nsIMsgThread *threadHdr, nsMsgKey par
rv = NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE;
break;
}
msgHdr = do_QueryInterface(supports);
if (!(m_viewFlags & nsMsgViewFlagsType::kShowIgnored))
{
PRBool ignored;
msgHdr->GetIsKilled(&ignored);
// We are not going to process subthreads, horribly invalidating the
// numChildren characteristic
if (ignored)
continue;
}
nsMsgKey msgKey;
PRUint32 msgFlags, newFlags;
msgHdr->GetMessageKey(&msgKey);
@ -4849,13 +4871,26 @@ nsresult nsMsgDBView::ListIdsInThread(nsIMsgThread *threadHdr, nsMsgViewIndex st
}
else
{
PRUint32 ignoredHeaders = 0;
// if we're not threaded, just list em out in db order
for (i = 1; i <= numChildren; i++)
{
nsCOMPtr <nsIMsgDBHdr> msgHdr;
threadHdr->GetChildHdrAt(i, getter_AddRefs(msgHdr));
if (msgHdr != nsnull)
{
if (!(m_viewFlags & nsMsgViewFlagsType::kShowIgnored))
{
PRBool killed;
msgHdr->GetIsKilled(&killed);
if (killed)
{
ignoredHeaders++;
continue;
}
}
nsMsgKey msgKey;
PRUint32 msgFlags, newFlags;
msgHdr->GetMessageKey(&msgKey);
@ -4871,19 +4906,24 @@ nsresult nsMsgDBView::ListIdsInThread(nsIMsgThread *threadHdr, nsMsgViewIndex st
viewIndex++;
}
}
if (ignoredHeaders + *pNumListed < numChildren)
{
NS_NOTREACHED("thread corrupt in db");
// if we've listed fewer messages than are in the thread, then the db
// is corrupt, and we should invalidate it.
// we'll use this rv to indicate there's something wrong with the db
// though for now it probably won't get paid attention to.
m_db->SetSummaryValid(PR_FALSE);
rv = NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE;
}
}
// We may have added too many elements (i.e., subthreads were cut)
if (*pNumListed < numChildren)
{
NS_NOTREACHED("thread corrupt in db");
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
// is corrupt, and we should invalidate it.
// we'll use this rv to indicate there's something wrong with the db
// though for now it probably won't get paid attention to.
m_db->SetSummaryValid(PR_FALSE);
rv = NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE;
}
return rv;
}
@ -4944,6 +4984,14 @@ nsresult nsMsgDBView::ListUnreadIdsInThread(nsIMsgThread *threadHdr, nsMsgViewIn
threadHdr->GetChildHdrAt(i, getter_AddRefs(msgHdr));
if (msgHdr != nsnull)
{
if (!(m_viewFlags & nsMsgViewFlagsType::kShowIgnored))
{
PRBool killed;
msgHdr->GetIsKilled(&killed);
if (killed)
continue;
}
nsMsgKey msgKey;
PRUint32 msgFlags;
msgHdr->GetMessageKey(&msgKey);
@ -5466,6 +5514,24 @@ nsresult nsMsgDBView::NavigateFromPos(nsMsgNavigationTypeValue motion, nsMsgView
return NS_OK;
}
}
case nsMsgNavigationType::toggleSubthreadKilled:
{
PRBool resultKilled;
nsMsgViewIndexArray selection;
GetSelectedIndices(selection);
ToggleMessageKilled(selection.Elements(), selection.Length(),
&threadIndex, &resultKilled);
if (resultKilled)
{
return NavigateFromPos(nsMsgNavigationType::nextUnreadMessage, threadIndex, pResultKey, pResultIndex, pThreadIndex, PR_TRUE);
}
else
{
*pResultIndex = nsMsgViewIndex_None;
*pResultKey = nsMsgKey_None;
return NS_OK;
}
}
// check where navigate says this will take us. If we have the message in the view,
// return it. Otherwise, return an error.
case nsMsgNavigationType::back:
@ -5787,6 +5853,41 @@ nsresult nsMsgDBView::ToggleIgnored(nsMsgViewIndex * indices, PRInt32 numIndices
return NS_OK;
}
nsresult nsMsgDBView::ToggleMessageKilled(nsMsgViewIndex * indices, PRInt32 numIndices, nsMsgViewIndex *resultIndex, PRBool *resultToggleState)
{
nsCOMPtr <nsIMsgDBHdr> header;
nsresult rv;
// Ignored state is toggled based on the first selected message
rv = GetMsgHdrForViewIndex(indices[0], getter_AddRefs(header));
PRUint32 msgFlags;
header->GetFlags(&msgFlags);
PRUint32 ignored = msgFlags & MSG_FLAG_IGNORED;
// Process messages in reverse order
// Otherwise the indices may be invalidated...
nsMsgViewIndex msgIndex = nsMsgViewIndex_None;
while (numIndices)
{
numIndices--;
if (indices[numIndices] < msgIndex)
{
msgIndex = indices[numIndices];
rv = GetMsgHdrForViewIndex(msgIndex, getter_AddRefs(header));
header->GetFlags(&msgFlags);
if ((msgFlags & MSG_FLAG_IGNORED) == ignored)
SetSubthreadKilled(header, msgIndex, !ignored);
}
}
if (resultIndex)
*resultIndex = msgIndex;
if (resultToggleState)
*resultToggleState = !ignored;
return NS_OK;
}
nsMsgViewIndex nsMsgDBView::GetThreadFromMsgIndex(nsMsgViewIndex index,
nsIMsgThread **threadHdr)
{
@ -5853,6 +5954,57 @@ nsresult nsMsgDBView::SetThreadIgnored(nsIMsgThread *thread, nsMsgViewIndex thre
return m_db->MarkThreadIgnored(thread, m_keys[threadIndex], ignored, this);
}
nsresult nsMsgDBView::SetSubthreadKilled(nsIMsgDBHdr *header, nsMsgViewIndex msgIndex, PRBool ignored)
{
if (!IsValidIndex(msgIndex))
return NS_MSG_INVALID_DBVIEW_INDEX;
NoteChange(msgIndex, 1, nsMsgViewNotificationCode::changed);
nsresult rv;
rv = m_db->MarkHeaderKilled(header, ignored, this);
NS_ENSURE_SUCCESS(rv, rv);
if (ignored)
{
nsCOMPtr <nsIMsgThread> thread;
nsresult rv;
rv = m_db->GetThreadContainingMsgHdr(header, getter_AddRefs(thread));
if (NS_FAILED(rv))
return NS_OK; // So we didn't mark threads read
PRUint32 children, current;
thread->GetNumChildren(&children);
nsMsgKey headKey;
header->GetMessageKey(&headKey);
for (current = 0; current < children; current++)
{
nsMsgKey newKey;
thread->GetChildKeyAt(current, &newKey);
if (newKey == headKey)
break;
}
// Process all messages, starting with this message.
for (; current < children; current++)
{
nsCOMPtr <nsIMsgDBHdr> nextHdr;
PRBool isKilled;
thread->GetChildHdrAt(current, getter_AddRefs(nextHdr));
nextHdr->GetIsKilled(&isKilled);
// Ideally, the messages should stop processing here.
// However, the children are ordered not by thread...
if (isKilled)
nextHdr->MarkRead(PR_TRUE);
}
}
return NS_OK;
}
nsresult nsMsgDBView::SetThreadWatched(nsIMsgThread *thread, nsMsgViewIndex index, PRBool watched)
{
if (!IsValidIndex(index))

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

@ -142,6 +142,7 @@ protected:
static nsIAtom* kHasUnreadAtom;
static nsIAtom* kWatchThreadAtom;
static nsIAtom* kIgnoreThreadAtom;
static nsIAtom* kIgnoreSubthreadAtom;
static nsIAtom* kHasImageAtom;
#ifdef SUPPORT_PRIORITY_COLORS
@ -303,6 +304,7 @@ protected:
nsresult ToggleWatched( nsMsgViewIndex* indices, PRInt32 numIndices);
nsresult SetThreadWatched(nsIMsgThread *thread, nsMsgViewIndex index, PRBool watched);
nsresult SetThreadIgnored(nsIMsgThread *thread, nsMsgViewIndex threadIndex, PRBool ignored);
nsresult SetSubthreadKilled(nsIMsgDBHdr *header, nsMsgViewIndex msgIndex, PRBool ignored);
nsresult DownloadForOffline(nsIMsgWindow *window, nsMsgViewIndex *indices, PRInt32 numIndices);
nsresult DownloadFlaggedForOffline(nsIMsgWindow *window);
nsMsgViewIndex GetThreadFromMsgIndex(nsMsgViewIndex index, nsIMsgThread **threadHdr);
@ -334,6 +336,7 @@ protected:
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);
nsresult ToggleMessageKilled(nsMsgViewIndex * indices, PRInt32 numIndices, nsMsgViewIndex *resultIndex, PRBool *resultToggleState);
PRBool OfflineMsgSelected(nsMsgViewIndex * indices, PRInt32 numIndices);
PRBool NonDummyMsgSelected(nsMsgViewIndex * indices, PRInt32 numIndices);
PRUnichar * GetString(const PRUnichar *aStringName);

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

@ -206,7 +206,7 @@ nsresult nsMsgGroupThread::AddChildFromGroupView(nsIMsgDBHdr *child, nsMsgDBView
if (msgDate > m_newestMsgDate)
SetNewestMsgDate(msgDate);
child->AndFlags(~(MSG_FLAG_WATCHED | MSG_FLAG_IGNORED), &newHdrFlags);
child->AndFlags(~(MSG_FLAG_WATCHED), &newHdrFlags);
PRUint32 numChildren;
// get the num children before we add the new header.

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

@ -249,6 +249,18 @@ nsresult nsMsgThreadedDBView::AddKeys(nsMsgKey *pKeys, PRInt32 *pFlags, const ch
// skip ignored threads.
if ((threadFlag & MSG_FLAG_IGNORED) && !(m_viewFlags & nsMsgViewFlagsType::kShowIgnored))
continue;
// skip ignored subthreads
nsCOMPtr <nsIMsgDBHdr> msgHdr;
m_db->GetMsgHdrForKey(pKeys[i], getter_AddRefs(msgHdr));
if (!(m_viewFlags & nsMsgViewFlagsType::kShowIgnored))
{
PRBool killed;
msgHdr->GetIsKilled(&killed);
if (killed)
continue;
}
// by default, make threads collapsed, unless we're in only viewing new msgs
if (flag & MSG_VIEW_FLAG_HASCHILDREN)
@ -453,7 +465,7 @@ nsresult nsMsgThreadedDBView::ListThreadIds(nsMsgKey *startMsg, PRBool unreadOnl
pOutput[numListed] = msgKey;
pLevels[numListed] = 0;
// turn off these flags on msg hdr - they belong in thread
msgHdr->AndFlags(~(MSG_FLAG_WATCHED | MSG_FLAG_IGNORED), &newMsgFlags);
msgHdr->AndFlags(~(MSG_FLAG_WATCHED), &newMsgFlags);
AdjustReadFlag(msgHdr, &msgFlags);
// try adding in MSG_VIEW_FLAG_ISTHREAD flag for unreadonly view.
pFlags[numListed] = msgFlags | MSG_VIEW_FLAG_ISTHREAD | threadFlags;
@ -716,7 +728,12 @@ nsresult nsMsgThreadedDBView::AddMsgToThreadNotInView(nsIMsgThread *threadHdr, n
PRUint32 threadFlags;
threadHdr->GetFlags(&threadFlags);
if (!(threadFlags & MSG_FLAG_IGNORED))
rv = AddHdr(msgHdr);
{
PRBool msgKilled;
msgHdr->GetIsKilled(&msgKilled);
if (!msgKilled)
rv = AddHdr(msgHdr);
}
return rv;
}

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

@ -203,6 +203,8 @@ interface nsIMsgDatabase : nsIDBChangeAnnouncer {
in nsIDBChangeListener instigator);
void MarkThreadWatched(in nsIMsgThread thread, in nsMsgKey threadKey, in boolean bWatched,
in nsIDBChangeListener instigator);
void MarkHeaderKilled(in nsIMsgDBHdr msg, in boolean bIgnored,
in nsIDBChangeListener instigator);
boolean IsRead(in nsMsgKey key);
boolean IsIgnored(in nsMsgKey key);

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

@ -2121,6 +2121,22 @@ nsMsgDatabase::MarkThreadIgnored(nsIMsgThread *thread, nsMsgKey threadKey, PRBoo
return NotifyHdrChangeAll(msg, oldThreadFlags, threadFlags, instigator);
}
NS_IMETHODIMP
nsMsgDatabase::MarkHeaderKilled(nsIMsgDBHdr *msg, PRBool bIgnored,
nsIDBChangeListener *instigator)
{
PRUint32 msgFlags;
msg->GetFlags(&msgFlags);
PRUint32 oldFlags = msgFlags;
if (bIgnored)
msgFlags |= MSG_FLAG_IGNORED;
else
msgFlags &= ~MSG_FLAG_IGNORED;
msg->SetFlags(msgFlags);
return NotifyHdrChangeAll(msg, oldFlags, msgFlags, instigator);
}
NS_IMETHODIMP
nsMsgDatabase::MarkThreadWatched(nsIMsgThread *thread, nsMsgKey threadKey, PRBool bWatched,
nsIDBChangeListener *instigator)

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

@ -203,7 +203,7 @@ NS_IMETHODIMP nsMsgHdr::GetFlags(PRUint32 *result)
else
*result = m_flags;
#ifdef DEBUG_bienvenu
NS_ASSERTION(! (*result & (MSG_FLAG_ELIDED | MSG_FLAG_IGNORED)), "shouldn't be set in db");
NS_ASSERTION(! (*result & (MSG_FLAG_ELIDED)), "shouldn't be set in db");
#endif
return NS_OK;
}
@ -211,7 +211,7 @@ NS_IMETHODIMP nsMsgHdr::GetFlags(PRUint32 *result)
NS_IMETHODIMP nsMsgHdr::SetFlags(PRUint32 flags)
{
#ifdef DEBUG_bienvenu
NS_ASSERTION(! (flags & (MSG_FLAG_ELIDED | MSG_FLAG_IGNORED)), "shouldn't set this flag on db");
NS_ASSERTION(! (flags & (MSG_FLAG_ELIDED)), "shouldn't set this flag on db");
#endif
m_initedValues |= FLAGS_INITED;
m_flags = flags;
@ -854,3 +854,27 @@ NS_IMETHODIMP nsMsgHdr::GetIsFlagged(PRBool *isFlagged)
*isFlagged = m_flags & MSG_FLAG_MARKED;
return NS_OK;
}
NS_IMETHODIMP nsMsgHdr::GetIsKilled(PRBool *isKilled)
{
NS_ENSURE_ARG_POINTER(isKilled);
if (!(m_initedValues & FLAGS_INITED))
InitFlags();
*isKilled = m_flags & MSG_FLAG_IGNORED;
if (!*isKilled)
{
nsMsgKey threadParent;
GetThreadParent(&threadParent);
if (threadParent != nsMsgKey_None)
{
nsCOMPtr <nsIMsgDBHdr> parentHdr;
(void) m_mdb->GetMsgHdrForKey(threadParent, getter_AddRefs(parentHdr));
if (parentHdr)
return parentHdr->GetIsKilled(isKilled);
}
}
return NS_OK;
}

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

@ -236,13 +236,10 @@ NS_IMETHODIMP nsMsgThread::AddChild(nsIMsgDBHdr *child, nsIMsgDBHdr *inReplyTo,
if (msgDate > m_newestMsgDate)
SetNewestMsgDate(msgDate);
if (newHdrFlags & MSG_FLAG_IGNORED)
SetFlags(m_flags | MSG_FLAG_IGNORED);
if (newHdrFlags & MSG_FLAG_WATCHED)
SetFlags(m_flags | MSG_FLAG_WATCHED);
child->AndFlags(~(MSG_FLAG_WATCHED | MSG_FLAG_IGNORED), &newHdrFlags);
child->AndFlags(~(MSG_FLAG_WATCHED), &newHdrFlags);
PRUint32 numChildren;
PRUint32 childIndex = 0;
@ -394,7 +391,9 @@ NS_IMETHODIMP nsMsgThread::AddChild(nsIMsgDBHdr *child, nsIMsgDBHdr *inReplyTo,
}
// do this after we've put the new hdr in the thread
if (m_flags & MSG_FLAG_IGNORED && m_mdbDB)
PRBool isKilled;
child->GetIsKilled(&isKilled);
if ((m_flags & MSG_FLAG_IGNORED || isKilled) && m_mdbDB)
m_mdbDB->MarkHdrRead(child, PR_TRUE, nsnull);
#ifdef DEBUG_bienvenu1

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

@ -3154,7 +3154,15 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWindo
}
break;
case nsMsgFilterAction::KillThread:
// The db will check for this flag when a hdr gets added to the db, and set the flag appropriately on the thread object
{
nsCOMPtr<nsIMsgThread> thread;
PRUint32 threadFlags;
mDatabase->GetThreadContainingMsgHdr(msgHdr,getter_AddRefs(thread));
thread->GetFlags(&threadFlags);
thread->SetFlags(threadFlags | MSG_FLAG_IGNORED);
break;
}
case nsMsgFilterAction::KillSubthread:
msgHdr->OrFlags(MSG_FLAG_IGNORED, &newFlags);
break;
case nsMsgFilterAction::WatchThread:

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

@ -1971,7 +1971,15 @@ NS_IMETHODIMP nsParseNewMailState::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWi
MarkFilteredMessageRead(msgHdr);
break;
case nsMsgFilterAction::KillThread:
// The db will check for this flag when a hdr gets added to the db, and set the flag appropriately on the thread object
{
nsCOMPtr<nsIMsgThread> thread;
PRUint32 threadFlags;
m_mailDB->GetThreadContainingMsgHdr(msgHdr,getter_AddRefs(thread));
thread->GetFlags(&threadFlags);
thread->SetFlags(threadFlags | MSG_FLAG_IGNORED);
break;
}
case nsMsgFilterAction::KillSubthread:
msgHdr->OrFlags(MSG_FLAG_IGNORED, &newFlags);
break;
case nsMsgFilterAction::WatchThread:

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

@ -691,7 +691,15 @@ NS_IMETHODIMP nsNNTPNewsgroupList::ApplyFilterHit(nsIMsgFilter *aFilter, nsIMsgW
case nsMsgFilterAction::KillThread:
{
PRUint32 newFlags;
// The db will check for this flag when a hdr gets added to the db, and set the flag appropriately on the thread object
nsCOMPtr<nsIMsgThread> thread;
m_newsDB->GetThreadContainingMsgHdr(m_newMsgHdr, getter_AddRefs(thread) );
thread->GetFlags(&newFlags);
thread->SetFlags(newFlags | MSG_FLAG_IGNORED);
}
break;
case nsMsgFilterAction::KillSubthread:
{
PRUint32 newFlags;
m_newMsgHdr->OrFlags(MSG_FLAG_IGNORED, &newFlags);
}
break;