rem: gNextMessageViewIndexAfterDelete = -2; 
add:   var treeSelection = GetThreadTree().view.selection;  if (treeSelection.currentIndex != gSelectedIndexWhenDeleting) gNextMessageViewIndexAfterDelete = -2; 
context: function OnMsgLoaded(aUrl){    if (!aUrl)      return;    var folder = aUrl.folder;    var msgURI = GetLoadedMessage();    var msgHdr = null;        if (!folder || !msgURI)      return;    // If we are in the middle of a delete or move operation, make sure that    // if the user clicks on another message then that message stays selected    // and the selection does not "snap back" to the message chosen by    // SetNextMessageAfterDelete() when the operation completes (bug 243532).    gNextMessageViewIndexAfterDelete = -2;    if (!(/type=application\/x-message-display/.test(msgURI)))      msgHdr = messenger.messageServiceFromURI(msgURI).messageURIToMsgHdr(msgURI);         gMessageNotificationBar.setJunkMsg(msgHdr);    // we just finished loading a message. set a timer to actually mark the message is read after n seconds    // where n can be configured by the user.    var markReadOnADelay = gPrefBranch.getBoolPref("mailnews.mark_message_read.delay");    if (msgHdr && !msgHdr.isRead)    {      var wintype = document.documentElement.getAttribute('windowtype');      if (markReadOnADelay && wintype == "mail:3pane") // only use the timer if viewing using the 3-pane preview pane and the user has set the pref      {        ClearPendingReadTimer();        gMarkViewedMessageAsReadTimer = setTimeout(MarkCurrentMessageAsRead, gPrefBranch.getIntPref("mailnews.mark_message_read.delay.interval") * 1000);      }      else        MarkCurrentMessageAsRead();    }    // See if MDN was requested but has not been sent.    HandleMDNResponse(aUrl);    var currentMsgFolder = folder.QueryInterface(Components.interfaces.nsIMsgFolder);    if (!IsImapMessage(msgURI))      return;    var imapServer = currentMsgFolder.server.QueryInterface(Components.interfaces.nsIImapIncomingServer);    var storeReadMailInPFC = imapServer.storeReadMailInPFC;    if (storeReadMailInPFC)    {      var messageID;      var copyToOfflineFolder = true;      // look in read mail PFC for msg with same msg id - if we find one,      // don't put this message in the read mail pfc.      var outputPFC = imapServer.GetReadMailPFC(true);      if (msgHdr)      {        messageID = msgHdr.messageId;        if (messageID.length > 0)        {          var readMailDB = outputPFC.getMsgDatabase(msgWindow);          if (readMailDB)          {            var hdrInDestDB = readMailDB.getMsgHdrForMessageID(messageID);            if (hdrInDestDB)              copyToOfflineFolder = false;          }        }      }      if (copyToOfflineFolder)      {        var messages = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);        messages.AppendElement(msgHdr);        res = outputPFC.copyMessages(currentMsgFolder, messages, false /*isMove*/, msgWindow /* nsIMsgWindow */, null /* listener */, false /* isFolder */, false /*allowUndo*/ );      }   }}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/a16282566c4eae2354df3098d9ce31c0d3d88884/mailWindowOverlay.js/clean/mail/base/content/mailWindowOverlay.js