add:   if (serverSettings.deferredToAccount.length > 0) { var account = parent.getAccountFromServerId(gServer.serverURI); var identity = account.defaultIdentity; var accountManager = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager); var account = accountManager.getAccount(serverSettings.deferredToAccount); if (identity.fccFolder == (pop3Server.serverURI + "/Sent")) identity.fccFolder = account.incomingServer.serverURI + "/Sent";  if (identity.draftFolder == (pop3Server.serverURI + "/Drafts")) identity.draftFolder = account.incomingServer.serverURI + "/Drafts";  if (identity.stationeryFolder == (pop3Server.serverURI + "/Templates")) identity.stationeryFolder = account.incomingServer.serverURI + "/Templates"; } 
context: function onAdvanced(){  dump("onAdvanced..\n");  var serverKeyElement = document.getElementById("identity.smtpServerKey");  var oldSmtpServerKey = serverKeyElement.getAttribute("value");  dump("selected key = " + oldSmtpServerKey + "\n");  var serverSettings = {};  serverSettings.smtpServerList = oldSmtpServerKey;  // Store the server type and, if an IMAP or POP3 server,  // the settings needed for the IMAP/POP3 tab into the array  var serverType = document.getElementById("server.type").getAttribute("value");  serverSettings.serverType = serverType;  if (serverType == "imap")  {    serverSettings.dualUseFolders = document.getElementById("imap.dualUseFolders").checked;    serverSettings.usingSubscription = document.getElementById("imap.usingSubscription").checked;    serverSettings.useIdle = document.getElementById("imap.useIdle").checked;    serverSettings.maximumConnectionsNumber = document.getElementById("imap.maximumConnectionsNumber").getAttribute("value");    // string prefs    serverSettings.personalNamespace = document.getElementById("imap.personalNamespace").getAttribute("value");    serverSettings.publicNamespace = document.getElementById("imap.publicNamespace").getAttribute("value");    serverSettings.serverDirectory = document.getElementById("imap.serverDirectory").getAttribute("value");    serverSettings.otherUsersNamespace = document.getElementById("imap.otherUsersNamespace").getAttribute("value");    serverSettings.overrideNamespaces = document.getElementById("imap.overrideNamespaces").checked;  }  else if (serverType == "pop3")  {    serverSettings.deferGetNewMail = document.getElementById("pop3.deferGetNewMail").checked;    serverSettings.deferredToAccount = document.getElementById("pop3.deferredToAccount").getAttribute("value");  }  window.openDialog("chrome://messenger/content/am-server-advanced.xul",                    "_blank", "chrome,modal,titlebar", serverSettings);  if (serverSettings.smtpServerList != oldSmtpServerKey)  {    // save the identity back to the page as a key    dump("Setting the smtp server to " + serverSettings.smtpServerList + "\n");    if (serverSettings.smtpServerList)      serverKeyElement.setAttribute("value", serverSettings.smtpServerList);    else      serverKeyElement.removeAttribute("value");  }  if (serverType == "imap")  {    document.getElementById("imap.dualUseFolders").checked = serverSettings.dualUseFolders;    document.getElementById("imap.usingSubscription").checked = serverSettings.usingSubscription;    document.getElementById("imap.useIdle").checked = serverSettings.useIdle;    document.getElementById("imap.maximumConnectionsNumber").setAttribute("value", serverSettings.maximumConnectionsNumber);    // string prefs    document.getElementById("imap.personalNamespace").setAttribute("value", serverSettings.personalNamespace);    document.getElementById("imap.publicNamespace").setAttribute("value", serverSettings.publicNamespace);    document.getElementById("imap.serverDirectory").setAttribute("value", serverSettings.serverDirectory);    document.getElementById("imap.otherUsersNamespace").setAttribute("value", serverSettings.otherUsersNamespace);    document.getElementById("imap.overrideNamespaces").checked = serverSettings.overrideNamespaces;  }  else if (serverType == "pop3")  {    document.getElementById("pop3.deferGetNewMail").checked = serverSettings.deferGetNewMail;    document.getElementById("pop3.deferredToAccount").setAttribute("value", serverSettings.deferredToAccount);    var pop3Server = gServer.QueryInterface(Components.interfaces.nsIPop3IncomingServer);    // we're explicitly setting this so we'll go through the SetDeferredToAccount method    pop3Server.deferredToAccount = serverSettings.deferredToAccount;  }}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/8415362046fb90ca8f731b94dca89f7735b68727/am-server.js/buggy/mailnews/base/prefs/resources/content/am-server.js