From 4cb964ecf59e5514ccb8e0b655f7f62cb356ea38 Mon Sep 17 00:00:00 2001 From: "jefft%netscape.com" Date: Thu, 2 Mar 2000 03:21:15 +0000 Subject: [PATCH] fixed bug 29746 - startup imap folder cache bypassed; reset online folder name should only happen when rename; a=phil,r=bienvenu --- mailnews/imap/public/nsIMsgImapMailFolder.idl | 1 + mailnews/imap/src/nsImapMailFolder.cpp | 32 +++++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/mailnews/imap/public/nsIMsgImapMailFolder.idl b/mailnews/imap/public/nsIMsgImapMailFolder.idl index ee226eb9aab7..7c5f8bc97303 100644 --- a/mailnews/imap/public/nsIMsgImapMailFolder.idl +++ b/mailnews/imap/public/nsIMsgImapMailFolder.idl @@ -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; diff --git a/mailnews/imap/src/nsImapMailFolder.cpp b/mailnews/imap/src/nsImapMailFolder.cpp index 612d7c9dd1a4..d41b14a2f6ba 100644 --- a/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mailnews/imap/src/nsImapMailFolder.cpp @@ -283,11 +283,6 @@ NS_IMETHODIMP nsImapMailFolder::AddSubfolder(nsAutoString *name, *child = folder; NS_IF_ADDREF(*child); nsCOMPtr 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 aSupport; + nsCOMPtr 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;