fix handling of online sub directories with imap namespaces, r/sr=mscott 219645

This commit is contained in:
bienvenu%nventure.com 2003-11-10 23:13:54 +00:00
Родитель ca61354c26
Коммит 4a0a6e3ea0
1 изменённых файлов: 13 добавлений и 8 удалений

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

@ -862,15 +862,20 @@ NS_IMETHODIMP nsImapUrl::AddOnlineDirectoryIfNecessary(const char *onlineMailbox
}
if (ns && (PL_strlen(ns->GetPrefix()) != 0) && !onlineDirWithDelimiter.Equals(ns->GetPrefix()))
{
// The namespace for this mailbox is the root ("").
// Prepend the online server directory
int finalLen = onlineDirWithDelimiter.Length() +
strlen(onlineMailboxName) + 1;
newOnlineName = (char *)PR_Malloc(finalLen);
if (newOnlineName)
// check that onlineMailboxName doesn't start with the namespace. If that's the case,
// we don't want to prepend the online dir.
if (PL_strncmp(onlineMailboxName, ns->GetPrefix(), PL_strlen(ns->GetPrefix())))
{
PL_strcpy(newOnlineName, onlineDirWithDelimiter.get());
PL_strcat(newOnlineName, onlineMailboxName);
// The namespace for this mailbox is the root ("").
// Prepend the online server directory
int finalLen = onlineDirWithDelimiter.Length() +
strlen(onlineMailboxName) + 1;
newOnlineName = (char *)PR_Malloc(finalLen);
if (newOnlineName)
{
PL_strcpy(newOnlineName, onlineDirWithDelimiter.get());
PL_strcat(newOnlineName, onlineMailboxName);
}
}
}
// just prepend the online server directory if it doesn't start with it already