From e7f7cf4dcb183da716518920085f25a870f1229e Mon Sep 17 00:00:00 2001 From: "cavin%netscape.com" Date: Fri, 7 Sep 2001 21:55:38 +0000 Subject: [PATCH] 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. --- mailnews/imap/src/nsImapService.cpp | 36 ++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/mailnews/imap/src/nsImapService.cpp b/mailnews/imap/src/nsImapService.cpp index 23d7e50bced..2a3de2eb52c 100644 --- a/mailnews/imap/src/nsImapService.cpp +++ b/mailnews/imap/src/nsImapService.cpp @@ -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 msgFolder; nsCOMPtr 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); }