fix threading of messages that claim to be their own children/parents, 332883, sr=mscott
git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@212030 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -3719,7 +3719,7 @@ nsresult nsMsgDatabase::ThreadNewHdr(nsMsgHdr* newHdr, PRBool &newThread)
|
||||
nsresult result=NS_ERROR_UNEXPECTED;
|
||||
nsCOMPtr <nsIMsgThread> thread;
|
||||
nsCOMPtr <nsIMsgDBHdr> replyToHdr;
|
||||
nsMsgKey threadId = nsMsgKey_None;
|
||||
nsMsgKey threadId = nsMsgKey_None, newHdrKey;
|
||||
|
||||
if (!newHdr)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
@@ -3733,6 +3733,7 @@ nsresult nsMsgDatabase::ThreadNewHdr(nsMsgHdr* newHdr, PRBool &newThread)
|
||||
// in m_newSet yet.
|
||||
newHdr->GetRawFlags(&newHdrFlags);
|
||||
newHdr->GetNumReferences(&numReferences);
|
||||
newHdr->GetMessageKey(&newHdrKey);
|
||||
|
||||
// try reference threading first
|
||||
for (PRInt32 i = numReferences - 1; i >= 0; i--)
|
||||
@@ -3750,6 +3751,14 @@ nsresult nsMsgDatabase::ThreadNewHdr(nsMsgHdr* newHdr, PRBool &newThread)
|
||||
thread = getter_AddRefs(GetThreadForReference(reference, getter_AddRefs(replyToHdr))) ;
|
||||
if (thread)
|
||||
{
|
||||
if (replyToHdr)
|
||||
{
|
||||
nsMsgKey replyToKey;
|
||||
replyToHdr->GetMessageKey(&replyToKey);
|
||||
// message claims to be a reply to itself - ignore that since it leads to corrupt threading.
|
||||
if (replyToKey == newHdrKey)
|
||||
continue;
|
||||
}
|
||||
thread->GetThreadKey(&threadId);
|
||||
newHdr->SetThreadId(threadId);
|
||||
result = AddToThread(newHdr, thread, replyToHdr, PR_TRUE);
|
||||
|
||||
Reference in New Issue
Block a user