rem:   while (!done) { nextFolderURI = FindNextFolder(startAtURI); if (!nextFolderURI) { if (i == numServers) {  done = true; } else {  startAtURI = allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer).serverURI; i++; } } else {  done = true; 
add:   nextFolderURI = FindNextFolder(startAtURI);    if (!nextFolderURI) {  rootFolders = GetRootFoldersInFolderPaneOrder(); for (i=0;i<rootFolders.length;i++) { if (rootFolders[i].URI == gDBView.msgFolder.server.serverURI) break; }  for (j=i+1; j<rootFolders.length; j++) { nextFolderURI = FindNextFolder(rootFolders[j].URI); if (nextFolderURI) break; }    if (!nextFolderURI) { for (j=0; j<rootFolders.length; j++) { nextFolderURI = FindNextFolder(rootFolders[j].URI); if (nextFolderURI) break; 
context: function CrossFolderNavigation(type, supportsFolderPane ){  if (type != nsMsgNavigationType.nextUnreadMessage)   {      // only do cross folder navigation for "next unread message"      return null;  }  var nextMode = pref.GetIntPref("mailnews.nav_crosses_folders");  // 0: "next" goes to the next folder, without prompting  // 1: "next" goes to the next folder, and prompts (the default)  // 2: "next" does nothing when there are no unread messages  // not crossing folders, don't find next  if (nextMode == 2) return null;  var originalFolderURI = gDBView.msgFolder.URI;  var nextFolderURI = null;  var done = false;  var startAtURI = originalFolderURI;  var i = 0;  var allServers = accountManager.allServers;  var numServers = allServers.Count();  // XXX fix this  // this will search the originalFolderURI server twice  while (!done)   {     nextFolderURI = FindNextFolder(startAtURI);     if (!nextFolderURI)      {       if (i == numServers)        {          // no more servers, we're done          done = true;       }       else        {         // get the uri for the next server and start there         startAtURI = allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer).serverURI;         i++;        }      }      else       {         // got a folder with unread messages, start with it         done = true;          }    }    if (nextFolderURI && (originalFolderURI != nextFolderURI))     {      var nextFolderResource = RDF.GetResource(nextFolderURI);      var nextFolder = nextFolderResource.QueryInterface(Components.interfaces.nsIMsgFolder);      switch (nextMode)       {        case 0:            // do this unconditionally            gNextMessageAfterLoad = type;            if (supportsFolderPane)              SelectFolder(nextFolderURI);            break;        case 1:        default:            var promptText = gMessengerBundle.getFormattedString("advanceNextPrompt", [ nextFolder.name ], 1);             if (promptService.confirm(window, promptText, promptText)) {                gNextMessageAfterLoad = type;                if (supportsFolderPane)                  SelectFolder(nextFolderURI);            }            break;        }    }    return nextFolderURI;}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/08c99a8091153c5c186914388bf9a5d42e87e6c9/msgViewNavigation.js/buggy/mailnews/base/resources/content/msgViewNavigation.js