Bug #98294: In nsImapService::DiscoverChildren(), make sure we have a consistent server hierarchy delimiter. r=sspitzer, sr=mscott.

Bug #98433: In nsImapService::GetListOfFoldersWithPath(), if the folder path contains 'INBOX' of any forms, we need to convert it to uppercase before finding it under the root folder. r=naving, sr=mscott.
This commit is contained in:
cavin%netscape.com 2001-09-07 21:55:38 +00:00
Родитель a201a6ff1f
Коммит e7f7cf4dcb
1 изменённых файлов: 33 добавлений и 3 удалений

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

@ -1931,7 +1931,16 @@ nsImapService::DiscoverChildren(nsIEventQueue* aClientEventQueue,
// mscott - this cast to a char * is okay...there's a bug in the XPIDL
// compiler that is preventing in string parameters from showing up as
// const char *. hopefully they will fix it soon.
rv = uri->SetSpec(urlSpec.get());
rv = uri->SetSpec(urlSpec.get());
// Make sure the uri has the same hierarchy separator as the one in msg folder
// obj if it's not kOnlineHierarchySeparatorUnknown (ie, '^').
char uriDelimiter;
nsresult rv1 = aImapUrl->GetOnlineSubDirSeparator(&uriDelimiter);
if (NS_SUCCEEDED (rv1) && hierarchySeparator != kOnlineHierarchySeparatorUnknown &&
uriDelimiter != hierarchySeparator)
aImapUrl->SetOnlineSubDirSeparator((char)hierarchySeparator);
if (NS_SUCCEEDED(rv))
rv = GetImapConnectionAndLoadUrl(aClientEventQueue,
aImapUrl,
@ -3472,8 +3481,29 @@ nsImapService::GetListOfFoldersWithPath(nsIImapIncomingServer *aServer, nsIMsgWi
nsCOMPtr<nsIMsgFolder> msgFolder;
nsCOMPtr<nsIFolder> subFolder;
if (rootMsgFolder && folderPath && (*folderPath))
{
rv = rootMsgFolder->FindSubFolder(folderPath, getter_AddRefs(subFolder));
{
// If the folder path contains 'INBOX' of any forms, we need to convert it to uppercase
// before finding it under the root folder. We do the same in PossibleImapMailbox().
nsCAutoString tempFolderName(folderPath);
nsCAutoString tokenStr, remStr, changedStr;
PRInt32 slashPos = tempFolderName.FindChar('/');
if (slashPos > 0)
{
tempFolderName.Left(tokenStr,slashPos);
tempFolderName.Right(remStr, tempFolderName.Length()-slashPos);
}
else
tokenStr.Assign(tempFolderName);
if ((nsCRT::strcasecmp(tokenStr.get(), "INBOX")==0) && (nsCRT::strcmp(tokenStr.get(), "INBOX") != 0))
changedStr.Append("INBOX");
else
changedStr.Append(tokenStr);
if (slashPos > 0 )
changedStr.Append(remStr);
rv = rootMsgFolder->FindSubFolder(changedStr.get(), getter_AddRefs(subFolder));
if (NS_SUCCEEDED(rv))
msgFolder = do_QueryInterface(subFolder);
}