Fix for #100385. Reset 3 control variables of nsMessengerMigrator object in turbo mode. r=bhuvav, sr=sspitzer, a=asa.

This commit is contained in:
cavin%netscape.com 2002-03-14 00:51:46 +00:00
parent abe192dbf6
commit 2d9017b586
2 changed files with 21 additions and 5 deletions

View File

@ -351,10 +351,7 @@ static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
NS_IMPL_ISUPPORTS2(nsMessengerMigrator, nsIMessengerMigrator, nsIObserver)
nsMessengerMigrator::nsMessengerMigrator() :
m_haveShutdown(PR_FALSE),
m_oldMailType(-1),
m_alreadySetNntpDefaultLocalPath(PR_FALSE),
m_alreadySetImapDefaultLocalPath(PR_FALSE)
m_haveShutdown(PR_FALSE)
{
NS_INIT_REFCNT();
@ -394,7 +391,7 @@ nsresult nsMessengerMigrator::Init()
rv = getPrefService();
if (NS_FAILED(rv)) return rv;
rv = m_prefs->GetIntPref(PREF_4X_MAIL_SERVER_TYPE, &m_oldMailType);
rv = ResetState();
return rv;
}
@ -612,6 +609,20 @@ nsMessengerMigrator::CreateLocalMailAccount(PRBool migrating)
return NS_OK;
}
nsresult
nsMessengerMigrator::ResetState()
{
m_alreadySetNntpDefaultLocalPath = PR_FALSE;
m_alreadySetImapDefaultLocalPath = PR_FALSE;
// Reset 'm_oldMailType' in case the prefs file has changed. This is possible in quick launch
// mode where the profile to be migrated is IMAP type but the current working profile is POP.
nsresult rv = m_prefs->GetIntPref(PREF_4X_MAIL_SERVER_TYPE, &m_oldMailType);
if (NS_FAILED(rv))
m_oldMailType = -1;
return rv;
}
NS_IMETHODIMP
nsMessengerMigrator::UpgradePrefs()
{
@ -620,6 +631,9 @@ nsMessengerMigrator::UpgradePrefs()
rv = getPrefService();
if (NS_FAILED(rv)) return rv;
// Reset some control vars, necessary in turbo mode.
ResetState();
// because mail.server_type defaults to 0 (pop) it will look the user
// has something to migrate, even with an empty prefs.js file
// ProceedWithMigration will check if there is something to migrate

View File

@ -140,6 +140,8 @@ private:
nsresult getPrefService();
nsresult initializeStrings();
nsresult ResetState();
nsCOMPtr <nsIPref> m_prefs;
PRBool m_haveShutdown;