}
rv = CreateLocalMailAccount(identity, PR_TRUE); if (NS_FAILED(rv)) return rv; }
nsMsgAccountManager::UpgradePrefs(){    nsresult rv;    PRInt32 oldMailType;    rv = getPrefService();    if (NS_FAILED(rv)) return rv;    rv = m_prefs->GetIntPref(PREF_4X_MAIL_SERVER_TYPE, &oldMailType);    if (NS_FAILED(rv)) {#ifdef DEBUG_ACCOUNTMANAGER        printf("Tried to upgrade old prefs, but couldn't find server type!\n");#endif        return rv;    }    // 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    // if not, NS_FAILED(rv) will be true, and we'll return.    // this plays nicely with msgMail3PaneWindow.js, which will launch the    // Account Manager if UpgradePrefs() fails.    rv = ProceedWithMigration(oldMailType);    if (NS_FAILED(rv)) {#ifdef DEBUG_ACCOUNTMANAGER      printf("FAIL:  don't proceed with migration.\n");#endif      // return NS_ERROR_FAILURE because we failed to upgrade the pref.js      // by returning a failure code, this will case the Account Wizard      // to be automatically opened.      return rv;    }#ifdef DEBUG_ACCOUNTMANAGER    else {        printf("PASS:  proceed with migration.\n");    }#endif     // create a dummy identity, for migration only    nsCOMPtr<nsIMsgIdentity> identity;    rv = createKeyedIdentity("migration", getter_AddRefs(identity));    if (NS_FAILED(rv)) return rv;    rv = MigrateIdentity(identity);    if (NS_FAILED(rv)) return rv;            if ( oldMailType == POP_4X_MAIL_TYPE) {      // in 4.x, you could only have one pop account      rv = MigratePopAccount(identity);      if (NS_FAILED(rv)) return rv;	}    else if (oldMailType == IMAP_4X_MAIL_TYPE) {      rv = MigrateImapAccounts(identity);      if (NS_FAILED(rv)) return rv;            // if they had IMAP, they also had one "Local Mail"      // we need to migrate that, too.        rv = MigrateLocalMailAccount(identity);      if (NS_FAILED(rv)) return rv;	}    else if (oldMailType == MOVEMAIL_4X_MAIL_TYPE) {      printf("sorry, migration of movemail not supported yet.\n");      NS_ASSERTION(0, "movemail migration not supported yet.");      return NS_ERROR_UNEXPECTED;    }    else {#ifdef DEBUG_ACCOUNTMANAGER      printf("Unrecognized server type %d\n", oldMailType);#endif      return NS_ERROR_UNEXPECTED;    }	rv = MigrateNewsAccounts(identity);    if (NS_FAILED(rv)) return rv;    // remove dummy migration identity    return NS_OK;}