Bug 548088 - Messages marked as Junk not moved to Junk folder, r=bienvenu
authorKent James <kent@caspia.com>
Fri, 29 Apr 2011 13:34:36 -0700
changeset 7648 1fca5293e44d38ccf09e3b6b0c18969aea52e5f9
parent 7647 25b29b62976dc6ef78bd893af2b434888568c2cf
child 7649 1e34f71069bc891c1e2d392d7b5e2f9f1d97eaca
push idunknown
push userunknown
push dateunknown
reviewersbienvenu
bugs548088
Bug 548088 - Messages marked as Junk not moved to Junk folder, r=bienvenu
mailnews/base/test/unit/test_junkingWhenDisabled.js
mailnews/base/util/nsMsgIncomingServer.cpp
--- a/mailnews/base/test/unit/test_junkingWhenDisabled.js
+++ b/mailnews/base/test/unit/test_junkingWhenDisabled.js
@@ -164,19 +164,16 @@ function run_test() {
                   .getService(Ci.nsIPrefBranch);
   prefSvc.setBoolPref("mail.spam.manualMark", true);
   prefSvc.setIntPref("mail.spam.manualMarkMode", 0); // 0 == "move to junk folder", 1 == "delete"
 
   // Disable bayes filtering on the local account. That's the whole point of this test,
   //  to make sure that the junk move happens anyway.
   gLocalInboxFolder.server.spamSettings.level = 0;
 
-  // Spam settings needs to know the server to create the junk folder, and move to it
-  gLocalInboxFolder.server.spamSettings.actionTargetAccount = gLocalInboxFolder.server.serverURI;
-
   do_test_pending();
 
   // Add folder listeners that will capture async events
   let flags =
         nsIMFNService.msgsMoveCopyCompleted |
         nsIMFNService.folderAdded;
   let listener = new gMFListener();
   gMFNService.addListener(listener, flags);
--- a/mailnews/base/util/nsMsgIncomingServer.cpp
+++ b/mailnews/base/util/nsMsgIncomingServer.cpp
@@ -2055,16 +2055,24 @@ nsMsgIncomingServer::GetMsgFolderFromURI
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgIncomingServer::GetSpamSettings(nsISpamSettings **aSpamSettings)
 {
   NS_ENSURE_ARG_POINTER(aSpamSettings);
 
+  nsCAutoString spamActionTargetAccount;
+  GetCharValue("spamActionTargetAccount", spamActionTargetAccount);
+  if (spamActionTargetAccount.IsEmpty())
+  {
+    GetServerURI(spamActionTargetAccount);
+    SetCharValue("spamActionTargetAccount", spamActionTargetAccount);
+  }
+
   if (!mSpamSettings) {
     nsresult rv;
     mSpamSettings = do_CreateInstance(NS_SPAMSETTINGS_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv,rv);
     mSpamSettings->Initialize(this);
     NS_ENSURE_SUCCESS(rv,rv);
   }