rv = MigrateOldPopPrefs(server, hostname);
rv = MigrateOldMailPrefs(server);
nsMsgAccountManager::MigratePopAccount(nsIMsgIdentity *identity){  nsresult rv;    nsCOMPtr<nsIMsgAccount> account;  nsCOMPtr<nsIMsgIncomingServer> server;  rv = CreateAccount(getter_AddRefs(account));  if (NS_FAILED(rv)) return rv;  rv = CreateIncomingServer("pop3", getter_AddRefs(server));  if (NS_FAILED(rv)) return rv;  // create the identity  nsCOMPtr<nsIMsgIdentity> copied_identity;  rv = CreateIdentity(getter_AddRefs(copied_identity));  if (NS_FAILED(rv)) return rv;  // make this new identity to copy of the identity  // that we created out of the 4.x prefs  rv = CopyIdentity(identity,copied_identity);  if (NS_FAILED(rv)) return rv;  rv = SetMailCcAndFccValues(copied_identity);  if (NS_FAILED(rv)) return rv;  // hook them together  account->SetIncomingServer(server);  account->AddIdentity(copied_identity);    // now upgrade all the prefs  nsCOMPtr <nsIFileSpec> mailDir;  nsFileSpec dir;  PRBool dirExists;  server->SetType("pop3");  char *hostname=nsnull;  rv = m_prefs->CopyCharPref(PREF_4X_NETWORK_HOSTS_POP_SERVER, &hostname);  if (NS_SUCCEEDED(rv)) {    server->SetHostName(hostname);  }  else {    return rv;  }  rv = MigrateOldPopPrefs(server, hostname);  if (NS_FAILED(rv)) return rv;  char *mail_directory_value = nsnull;  // if they used -installer, this pref will point to where their files got copied  rv = m_prefs->CopyCharPref(PREF_MAIL_DIRECTORY, &mail_directory_value);  // create the directory structure for old 4.x pop mail  // under <profile dir>/Mail/<pop host name> or  // <"mail.directory" pref>/<pop host name>  //  // if the "mail.directory" pref is set, use that.  if (NS_SUCCEEDED(rv) && mail_directory_value && (PL_strlen(mail_directory_value) > 0)) {    dir = mail_directory_value;    PR_FREEIF(mail_directory_value);  }  else {    nsFileSpec profileDir;        NS_WITH_SERVICE(nsIProfile, profile, kProfileCID, &rv);    if (NS_FAILED(rv)) return rv;        rv = profile->GetCurrentProfileDir(&profileDir);    if (NS_FAILED(rv)) return rv;    dir = profileDir;        // we wan't <profile>/Mail, not <profile>    dir += NEW_MAIL_DIR_NAME;    // create <profile>/Mail if it doesn't exist    if (!dir.Exists()) {      dir.CreateDir();    }  }  rv = NS_NewFileSpecWithSpec(dir, getter_AddRefs(mailDir));  if (NS_FAILED(rv)) return rv;  // set the default local path for "pop3"  rv = server->SetDefaultLocalPath(mailDir);  if (NS_FAILED(rv)) return rv;  rv = mailDir->Exists(&dirExists);  if (!dirExists) {    mailDir->CreateDir();  }  // we want .../Mail/<hostname>, not .../Mail  rv = mailDir->AppendRelativeUnixPath(hostname);  PR_FREEIF(hostname);  if (NS_FAILED(rv)) return rv;    // set the local path for this "pop3" server  rv = server->SetLocalPath(mailDir);  if (NS_FAILED(rv)) return rv;      rv = mailDir->Exists(&dirExists);  if (!dirExists) {    mailDir->CreateDir();  }      return NS_OK;}