Bug 93426 New followups/replies were still being appended to the wrong parent partly due to my not unbitrotting the original patch correctly r+sr=bienvenu

This commit is contained in:
neil%parkwaycc.co.uk 2004-09-19 09:19:43 +00:00
Родитель 91d664d4a7
Коммит e95759d1ac
3 изменённых файлов: 12 добавлений и 17 удалений

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

@ -4357,25 +4357,19 @@ PRBool nsMsgDBView::WantsThisThread(nsIMsgThread * /*threadHdr*/)
return PR_TRUE; // default is to want all threads.
}
nsMsgViewIndex nsMsgDBView::FindParentInThread(nsIMsgDBHdr *msgHdr, nsMsgViewIndex startOfThreadViewIndex)
nsMsgViewIndex nsMsgDBView::FindParentInThread(nsMsgKey parentKey, nsMsgViewIndex startOfThreadViewIndex)
{
nsCOMPtr<nsIMsgDBHdr> curMsgHdr;
nsMsgKey parentKey;
msgHdr->GetThreadParent(&parentKey);
nsCOMPtr<nsIMsgDBHdr> msgHdr;
while (parentKey != nsMsgKey_None)
{
if (NS_FAILED(m_db->GetMsgHdrForKey(parentKey, getter_AddRefs(curMsgHdr))))
break;
nsMsgKey parentKey;
curMsgHdr->GetThreadParent(&parentKey);
if (parentKey == nsMsgKey_None)
break;
nsMsgViewIndex parentIndex = m_keys.FindIndex(parentKey, startOfThreadViewIndex);
if (parentIndex != nsMsgViewIndex_None)
return parentIndex;
if (NS_FAILED(m_db->GetMsgHdrForKey(parentKey, getter_AddRefs(msgHdr))))
break;
msgHdr->GetThreadParent(&parentKey);
}
return startOfThreadViewIndex;

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

@ -228,7 +228,7 @@ protected:
nsresult ListIdsInThread(nsIMsgThread *threadHdr, nsMsgViewIndex viewIndex, PRUint32 *pNumListed);
nsresult ListUnreadIdsInThread(nsIMsgThread *threadHdr, nsMsgViewIndex startOfThreadViewIndex, PRUint32 *pNumListed);
nsMsgViewIndex FindParentInThread(nsIMsgDBHdr *msgHdr, nsMsgViewIndex startOfThreadViewIndex);
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());}

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

@ -595,15 +595,16 @@ nsresult nsMsgThreadedDBView::OnNewHeader(nsIMsgDBHdr *newHdr, nsMsgKey aParentK
// levels of other hdrs may have changed!
PRUint32 newFlags = msgFlags;
PRInt32 level = 0;
nsMsgViewIndex insertIndex = FindParentInThread(newHdr, threadIndex);
nsMsgViewIndex insertIndex = threadIndex;
if (aParentKey == nsMsgKey_None)
{
newFlags |= MSG_VIEW_FLAG_ISTHREAD | MSG_VIEW_FLAG_HASCHILDREN;
}
else
{
level = m_levels[insertIndex];
insertIndex = GetInsertInfoForNewHdr(newHdr, threadIndex, level);
nsMsgViewIndex parentIndex = FindParentInThread(aParentKey, threadIndex);
level = m_levels[parentIndex] + 1;
insertIndex = GetInsertInfoForNewHdr(newHdr, parentIndex, level);
}
m_keys.InsertAt(insertIndex, newKey);
m_flags.InsertAt(insertIndex, newFlags, 1);