fixed bug 29746 - startup imap folder cache bypassed; reset online folder name should only happen when rename; a=phil,r=bienvenu

This commit is contained in:
jefft%netscape.com 2000-03-02 03:21:15 +00:00
parent 8ca243538f
commit 4cb964ecf5
2 changed files with 26 additions and 7 deletions

View File

@ -29,6 +29,7 @@ interface nsIMsgImapMailFolder : nsISupports {
void CreateClientSubfolderInfo(in string folderName, in wchar hierarchyDelimiter);
void List();
void RenameLocal(in string newname);
void PrepareToRename();
attribute boolean verifiedAsOnlineFolder;
attribute boolean explicitlyVerify;
attribute wchar hierarchyDelimiter;

View File

@ -283,11 +283,6 @@ NS_IMETHODIMP nsImapMailFolder::AddSubfolder(nsAutoString *name,
*child = folder;
NS_IF_ADDREF(*child);
nsCOMPtr<nsIMsgImapMailFolder> imapFolder = do_QueryInterface(folder);
if (imapFolder)
{
// for renaming
imapFolder->SetOnlineName("");
}
return rv;
}
@ -907,8 +902,30 @@ NS_IMETHODIMP nsImapMailFolder::Rename (const PRUnichar *newName)
return rv;
}
NS_IMETHODIMP
nsImapMailFolder::RenameLocal(const char *newName)
NS_IMETHODIMP nsImapMailFolder::PrepareToRename()
{
PRUint32 cnt = 0, i;
if (mSubFolders)
{
nsCOMPtr<nsISupports> aSupport;
nsCOMPtr<nsIMsgImapMailFolder> folder;
mSubFolders->Count(&cnt);
if (cnt > 0)
{
for (i = 0; i < cnt; i++)
{
aSupport = getter_AddRefs(mSubFolders->ElementAt(i));
folder = do_QueryInterface(aSupport);
if (folder)
folder->PrepareToRename();
}
}
}
SetOnlineName("");
return NS_OK;
}
NS_IMETHODIMP nsImapMailFolder::RenameLocal(const char *newName)
{
nsCAutoString leafname = newName;
// newName always in the canonical form "greatparent/parentname/leafname"
@ -917,6 +934,7 @@ NS_IMETHODIMP
leafname.Cut(0, leafpos+1);
m_msgParser = null_nsCOMPtr();
PrepareToRename();
ForceDBClosed();
nsresult rv = NS_OK;