don't try and index expunged messages. (This tends to happen when a message
authorAndrew Sutherland <asutherland@asutherland.org>
Wed, 08 Oct 2008 21:39:10 -0700
changeset 968 772a38efff65e2f1eaf42fe30256db226c134deb
parent 967 aa83bf9d9c7198db135d6fe8a9dca92d426b5b32
child 969 588eb7390fb72088e8ccb24928308ea700bce890
push idunknown
push userunknown
push dateunknown
don't try and index expunged messages. (This tends to happen when a message is automatically marked as spam. We get a property change notification followed by a move notification. The property change notification then tries to index the expunged message, which lacks a sucbject, sender, etc.)
modules/indexer.js
--- a/modules/indexer.js
+++ b/modules/indexer.js
@@ -127,16 +127,17 @@ function fixIterator(aEnum, aIface) {
       while (aEnum.hasMoreElements())
         yield aEnum.getNext().QueryInterface(face);
     }
     return { __iterator__: iter };
   } catch(ex) {}
 }
 
 const MSG_FLAG_OFFLINE = 0x80;
+const MSG_FLAG_EXPUNGED = 0x08;
 
 /**
  * @class Capture the indexing batch concept explicitly.
  *
  * @param aJobType The type of thing we are indexing.  Current choices are:
  *   "folder" and "message".  Previous choices included "account".  The indexer
  *   currently knows too much about these; they should be de-coupled.
  * @param aDeltaType -1 for deletion, 0 for move, 1 for addition/new.
@@ -1156,17 +1157,18 @@ var GlodaIndexer = {
     //  for offline processing...
     
     for (let msgHdr in this._indexingIterator) {
       // per above, we want to periodically release control while doing all
       //  this header traversal/investigation.
       if (++aJob.offset % HEADER_CHECK_BLOCK_SIZE == 0)
         yield this.kWorkSync;
       
-      if (isLocal || msgHdr.flags&MSG_FLAG_OFFLINE) {
+      if ((isLocal || msgHdr.flags&MSG_FLAG_OFFLINE) &&
+          !msgHdr.flags&MSG_FLAG_EXPUNGED) {
         // this returns 0 when missing
         let glodaMessageId = msgHdr.getUint32Property(
                              this.GLODA_MESSAGE_ID_PROPERTY);
         
         // if it has a gloda message id, it has been indexed, but it still
         //  could be dirty.
         if (glodaMessageId != 0) {
           // (returns 0 when missing)
@@ -1206,17 +1208,17 @@ var GlodaIndexer = {
       let msgHdr;
       if (typeof item[1] == "number")
         msgHdr = this._indexingFolder.GetMessageHeader(item[1]);
       else
         // same deal as in move processing.
         // TODO fixme to not assume singular message-id's.
         msgHdr = this._indexingDatabase.getMsgHdrForMessageID(item[1]);
       
-      if (msgHdr)
+      if (msgHdr && !msgHdr.flags&MSG_FLAG_EXPUNGED)
         yield this._indexMessage(msgHdr);
       else
         yield this.kWorkSync;
     }
     yield this.kWorkDone;
   },
   
   /**