don't assert about new hdr not in flag state but in db in partial uid fetch case, r/sr=dmose, 455963
authorDavid Bienvenu <bienvenu@nventure.com>
Tue, 23 Sep 2008 20:54:50 -0700
changeset 418 9d63c42db6aab8c284bc4a694d423632ca72191f
parent 417 37fa1b54be81302ecfc684a41c8465fe4eb39ea6
child 419 1c56991ab099a37952139abe85202757306d2725
push idunknown
push userunknown
push dateunknown
bugs455963
don't assert about new hdr not in flag state but in db in partial uid fetch case, r/sr=dmose, 455963
mailnews/imap/src/nsImapMailFolder.cpp
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -3722,16 +3722,19 @@ void nsImapMailFolder::FindKeysToAdd(con
   PRBool showDeletedMessages = ShowDeletedMessages();
   int dbIndex=0; // current index into existingKeys
   PRInt32 existTotal, numberOfKnownKeys;
   PRInt32 messageIndex;
 
   numNewUnread = 0;
   existTotal = numberOfKnownKeys = existingKeys.Length();
   flagState->GetNumberOfMessages(&messageIndex);
+  PRBool partialUIDFetch;
+  flagState->GetPartialUIDFetch(&partialUIDFetch);
+
   for (PRInt32 flagIndex=0; flagIndex < messageIndex; flagIndex++)
   {
     PRUint32 uidOfMessage;
     flagState->GetUidOfMessage(flagIndex, &uidOfMessage);
     while ( (flagIndex < numberOfKnownKeys) && (dbIndex < existTotal) &&
         existingKeys[dbIndex] < uidOfMessage)
       dbIndex++;
 
@@ -3744,19 +3747,21 @@ void nsImapMailFolder::FindKeysToAdd(con
       imapMessageFlagsType flags;
       flagState->GetMessageFlags(flagIndex, &flags);
       NS_ASSERTION(uidOfMessage != nsMsgKey_None, "got invalid msg key");
       if (uidOfMessage && uidOfMessage != nsMsgKey_None && (showDeletedMessages || ! (flags & kImapMsgDeletedFlag)))
       {
         if (mDatabase)
         {
           PRBool dbContainsKey;
-          if (NS_SUCCEEDED(mDatabase->ContainsKey(uidOfMessage, &dbContainsKey)) && dbContainsKey)
+          if (NS_SUCCEEDED(mDatabase->ContainsKey(uidOfMessage, &dbContainsKey)) &&
+              dbContainsKey)
           {
-            NS_ASSERTION(PR_FALSE, "db has key - flagState messed up?");
+            // this is expected in the partial uid fetch case.
+            NS_ASSERTION(!partialUIDFetch, "db has key - flagState messed up?");
             continue;
           }
         }
         keysToFetch.AppendElement(uidOfMessage);
         if (! (flags & kImapMsgSeenFlag))
           numNewUnread++;
       }
     }