apps/email/js/ext/mailapi/composite/configurator.js
// - copies are done, find the UIDs
copies are done, find the UIDs
copies are done find the UIDs
function copiedMessages_findNewUIDs() {
            var fetcher = targetConn._conn.fetch(
              uidnext + ':*',
              {
                request: {
                  headers: ['MESSAGE-ID'],
                  struct: false,
                  body: false
                }
              });
            fetcher.on('message', function(msg) {
              msg.on('end', fetchedMessageData);
            });
            fetcher.on('error', function(err) {
              aggrErr = err;
              perFolderDone();
            });
            fetcher.on('end', function() {
              if (reportedHeaders < namers.length) {
                if (--retriesLeft === 0) {
                  aggrErr = 'aborted-retry';
                  perFolderDone();
                  return;
                }
                window.setTimeout(copiedMessages_findNewUIDs, 500);
              }
            });
          }
function copiedMessages_findNewUIDs ( ) { var fetcher = targetConn . _conn . fetch ( uidnext + ':*' , { request : { headers : [ 'MESSAGE-ID' ] , struct : false , body : false } } ) ; fetcher . on ( 'message' , function ( msg ) { msg . on ( 'end' , fetchedMessageData ) ; } ) ; fetcher . on ( 'error' , function ( err ) { aggrErr = err ; perFolderDone ( ) ; } ) ; fetcher . on ( 'end' , function ( ) { if ( reportedHeaders < namers . length ) { if ( -- retriesLeft === 0 ) { aggrErr = 'aborted-retry' ; perFolderDone ( ) ; return ; } window . setTimeout ( copiedMessages_findNewUIDs , 500 ) ; } } ) ; }
copies are done, find the UIDs
copies are done find the UIDs
// because we aren't waiting for body data, we can just process the // 'message' event directly without registering for an 'end' event // on it. // We don't need to wait for 'end' since we know how many of these // we care about. // If we didn't hear about all the headers, let's retry in // a little bit.