Bug 515927 - Marking message as not spam doesn't clear deleted flag from message; r+sr=bienvenu, a=standard8
authorKent James <kent@caspia.com>
Thu, 24 Sep 2009 09:57:19 -0700
changeset 3901 324e7b178ad79263d8ca6df6e2d4a8035aeb915b
parent 3900 7144ddadc4bfdaad972430a5bef0625b3394eddb
child 3902 2125ba488b0278924e59641b6279695756dbd4ce
push id3049
push userkent@caspia.com
push dateThu, 24 Sep 2009 17:27:10 +0000
treeherdercomm-central@324e7b178ad7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8
bugs515927
Bug 515927 - Marking message as not spam doesn't clear deleted flag from message; r+sr=bienvenu, a=standard8
mailnews/base/src/nsMsgDBView.cpp
--- a/mailnews/base/src/nsMsgDBView.cpp
+++ b/mailnews/base/src/nsMsgDBView.cpp
@@ -2852,21 +2852,32 @@ nsMsgDBView::ApplyCommandToIndices(nsMsg
       break;
     case nsMsgViewCommandType::junk:
         return imapFolder->StoreCustomKeywords(msgWindow,
                     NS_LITERAL_CSTRING("Junk"),
                     NS_LITERAL_CSTRING("NonJunk"),
                     imapUids.Elements(), imapUids.Length(),
                     nsnull);
     case nsMsgViewCommandType::unjunk:
+      {
+        nsCOMPtr<nsIMsgDBHdr> msgHdr;
+        GetHdrForFirstSelectedMessage(getter_AddRefs(msgHdr));
+        PRUint32 msgFlags = 0;
+        if (msgHdr)
+          msgHdr->GetFlags(&msgFlags);
+        if (msgFlags & nsMsgMessageFlags::IMAPDeleted)
+          imapFolder->StoreImapFlags(kImapMsgDeletedFlag, PR_FALSE,
+                                     imapUids.Elements(),
+                                     imapUids.Length(), nsnull);
         return imapFolder->StoreCustomKeywords(msgWindow,
                     NS_LITERAL_CSTRING("NonJunk"),
                     NS_LITERAL_CSTRING("Junk"),
                     imapUids.Elements(), imapUids.Length(),
                     nsnull);
+      }
 
     default:
       break;
     }
 
     if (flags != kNoImapMsgFlag)  // can't get here without thisIsImapThreadPane == TRUE
       imapFolder->StoreImapFlags(flags, addFlags, imapUids.Elements(), imapUids.Length(), nsnull);