Bug #73093 --> fix corruption when opening attachments multiple times. When determining if

we are fetching a part look for ;section= AND ?section= in the url spec.
sr=bienvenu
This commit is contained in:
mscott%netscape.com 2001-05-02 23:02:26 +00:00
Родитель c75ad76702
Коммит 62ed722064
1 изменённых файлов: 13 добавлений и 9 удалений

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

@ -362,16 +362,20 @@ NS_IMETHODIMP nsImapUrl::CreateListOfMessageIdsString(char ** aResult)
NS_IMETHODIMP nsImapUrl::GetImapPartToFetch(char **result) NS_IMETHODIMP nsImapUrl::GetImapPartToFetch(char **result)
{ {
// here's the old code: // here's the old code....
char *wherepart = NULL;
if (m_listOfMessageIds && (wherepart = PL_strstr(m_listOfMessageIds, "/;section=")) != NULL) // unforunately an imap part can have the form: /;section= OR
{ // it can have the form ?section=. We need to look for both.
wherepart += 10; // nsCRT::strlen("/;section=") if (m_listOfMessageIds)
{
char *wherepart = PL_strstr(m_listOfMessageIds, ";section=");
if (!wherepart) // look for ?section too....
wherepart = PL_strstr(m_listOfMessageIds, "?section=");
if (wherepart) if (wherepart)
{ {
wherepart += 9; // nsCRT::strlen("/;section=")
char *wherelibmimepart = PL_strstr(wherepart, "&part="); char *wherelibmimepart = PL_strstr(wherepart, "&part=");
int numCharsToCopy = (wherelibmimepart) ? int numCharsToCopy = (wherelibmimepart) ? wherelibmimepart - wherepart :
wherelibmimepart - wherepart :
PL_strlen(m_listOfMessageIds) - (wherepart - m_listOfMessageIds); PL_strlen(m_listOfMessageIds) - (wherepart - m_listOfMessageIds);
if (numCharsToCopy) if (numCharsToCopy)
{ {
@ -382,8 +386,8 @@ NS_IMETHODIMP nsImapUrl::GetImapPartToFetch(char **result)
(*result)[numCharsToCopy] = '\0'; (*result)[numCharsToCopy] = '\0';
} }
} }
} } // if we got a wherepart
} } // if we got a m_listOfMessageIds
return NS_OK; return NS_OK;
} }