Bug 592235 - Alert on active folder should identify Mail Account or Folder for "This folder is being processed... to get messages.". r=mkmelin, ui-r=bwinton, a=RyanVM
authorSuyash Agarwal <syshagarwal@gmail.com>
Thu, 22 Aug 2013 10:08:09 -0400
changeset 16423 8e9531bfd45a2f6aed1cb855305b0b8ed37445ee
parent 16422 da15545442101589d9d95aef025bf1973135a299
child 16424 339bc9eac2fce242fcb4354fd1505e94a3fe8edf
push id1019
push userbugzilla@standard8.plus.com
push dateMon, 28 Oct 2013 22:08:40 +0000
treeherdercomm-beta@c81d5f517a5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin, bwinton, RyanVM
bugs592235
Bug 592235 - Alert on active folder should identify Mail Account or Folder for "This folder is being processed... to get messages.". r=mkmelin, ui-r=bwinton, a=RyanVM CLOSED TREE
mail/locales/en-US/chrome/messenger/localMsgs.properties
mailnews/local/src/nsPop3Protocol.cpp
mailnews/local/src/nsPop3Service.cpp
suite/locales/en-US/chrome/mailnews/localMsgs.properties
--- a/mail/locales/en-US/chrome/messenger/localMsgs.properties
+++ b/mail/locales/en-US/chrome/messenger/localMsgs.properties
@@ -92,17 +92,19 @@ pop3StatFail=The STAT command did not su
 #LOCALIZATION NOTE (pop3ServerSaid): Do not remove the leading space during translation.
 pop3ServerSaid= Mail server %S responded: 
 
 copyingMessagesStatus=Copying %S of %S messages to %S
 
 movingMessagesStatus=Moving %S of %S messages to %S
 
 # Status - write error occurred
-pop3MessageFolderBusy=This folder is being processed. Please wait until processing is complete to get messages.
+# LOCALIZATION NOTE (pop3ServerBusy): Do not translate the word "%S" below.
+# Place %S where the account name should appear.
+pop3ServerBusy=The account %S is being processed. Please wait until processing is complete to get messages.
 
 movemailCantOpenSpoolFile=Unable to open mail spool file %S.
 
 movemailCantCreateLock=Unable to create lock file %S. For movemail to work, it is necessary to create lock files in the mail spool directory. On many systems, this is best accomplished by making the spool directory be mode 01777.
 
 movemailCantDeleteLock=Unable to delete lock file %S.
 
 movemailCantTruncateSpoolFile=Unable to truncate spool file %S.
--- a/mailnews/local/src/nsPop3Protocol.cpp
+++ b/mailnews/local/src/nsPop3Protocol.cpp
@@ -2360,17 +2360,17 @@ nsPop3Protocol::GetStat()
         rv = mailnewsUrl->GetMsgWindow(getter_AddRefs(msgWindow));
 //      NS_ASSERTION(NS_SUCCEEDED(rv) && msgWindow, "no msg window");
 
       rv = m_nsIPop3Sink->BeginMailDelivery(m_pop3ConData->only_uidl != nullptr, msgWindow,
                                                     &m_pop3ConData->msg_del_started);
       if (NS_FAILED(rv))
       {
         m_nsIPop3Sink->AbortMailDelivery(this);
-        return Error(rv == NS_MSG_FOLDER_BUSY ? "pop3MessageFolderBusy" :
+        return Error(rv == NS_MSG_FOLDER_BUSY ? "pop3ServerBusy" :
                                                 "pop3MessageWriteError");
       }
 
       if(!m_pop3ConData->msg_del_started)
         return Error("pop3MessageWriteError");
   }
 
   m_pop3ConData->next_state = POP3_SEND_LIST;
--- a/mailnews/local/src/nsPop3Service.cpp
+++ b/mailnews/local/src/nsPop3Service.cpp
@@ -247,17 +247,17 @@ nsresult nsPop3Service::RunPopUrl(nsIMsg
   // we store the username unescaped in the server
   // so there is no need to unescape it
   nsresult rv = aServer->GetRealUsername(userName);
 
   // find out if the server is busy or not...if the server is busy, we are
   // *NOT* going to run the url
   bool serverBusy = false;
   rv = aServer->GetServerBusy(&serverBusy);
-
+  NS_ENSURE_SUCCESS(rv, rv);
   if (!serverBusy)
   {
     nsRefPtr<nsPop3Protocol> protocol = new nsPop3Protocol(aUrlToRun);
     if (protocol)
     {
       // the protocol stores the unescaped username, so there is no need to escape it.
       protocol->SetUsername(userName.get());
       rv = protocol->LoadUrl(aUrlToRun);
@@ -436,36 +436,48 @@ NS_IMETHODIMP nsPop3Service::NewURI(cons
 }
 
 void nsPop3Service::AlertServerBusy(nsIMsgMailNewsUrl *url)
 {
   nsresult rv;
   nsCOMPtr<nsIStringBundleService> bundleService =
     mozilla::services::GetStringBundleService();
   if (!bundleService)
-    return void(0);
+    return;
   nsCOMPtr<nsIStringBundle> bundle;
   rv = bundleService->CreateBundle("chrome://messenger/locale/localMsgs.properties", getter_AddRefs(bundle));
-  NS_ENSURE_SUCCESS(rv, void(0));
+  NS_ENSURE_SUCCESS_VOID(rv);
 
   nsCOMPtr<nsIMsgWindow> msgWindow;
   nsCOMPtr<nsIPrompt> dialog;
   rv = url->GetMsgWindow(getter_AddRefs(msgWindow)); //it is ok to have null msgWindow, for example when biffing
   if (NS_FAILED(rv) || !msgWindow)
     return;
 
   rv = msgWindow->GetPromptDialog(getter_AddRefs(dialog));
-  NS_ENSURE_SUCCESS(rv, void(0));
+  NS_ENSURE_SUCCESS_VOID(rv);
 
+  nsString accountName;
+  nsCOMPtr<nsIMsgIncomingServer> server;
+  rv = url->GetServer(getter_AddRefs(server));
+  NS_ENSURE_SUCCESS_VOID(rv);
+  rv = server->GetPrettyName(accountName);
+  NS_ENSURE_SUCCESS_VOID(rv);
+
+  const PRUnichar *params[] = { accountName.get() };
   nsString alertString;
-  bundle->GetStringFromName(
-    NS_LITERAL_STRING("pop3MessageFolderBusy").get(),
-    getter_Copies(alertString));
+  nsString dialogTitle;
+  bundle->FormatStringFromName(
+    NS_LITERAL_STRING("pop3ServerBusy").get(),
+    params, 1, getter_Copies(alertString));
+  bundle->FormatStringFromName(
+    NS_LITERAL_STRING("pop3ErrorDialogTitle").get(),
+    params, 1, getter_Copies(dialogTitle));
   if (!alertString.IsEmpty())
-    dialog->Alert(nullptr, alertString.get());
+    dialog->Alert(dialogTitle.get(), alertString.get());
 }
 
 NS_IMETHODIMP nsPop3Service::NewChannel(nsIURI *aURI, nsIChannel **_retval)
 {
   NS_ENSURE_ARG_POINTER(aURI);
   nsresult rv;
 
   nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(aURI, &rv);
--- a/suite/locales/en-US/chrome/mailnews/localMsgs.properties
+++ b/suite/locales/en-US/chrome/mailnews/localMsgs.properties
@@ -67,17 +67,19 @@ pop3UsernameFailure=Sending of username 
 #LOCALIZATION NOTE (pop3PasswordFailed): Do not translate "%1$S" below.
 # Place the word %1$S where the user name should appear.
 pop3PasswordFailed=Sending of password for user %1$S did not succeed.
 
 # Status - write error occurred
 pop3MessageWriteError=Unable to write the email to the mailbox. Make sure the file system allows you write privileges, and you have enough disk space to copy the mailbox.
 
 # Status - write error occurred
-pop3MessageFolderBusy=This folder is being processed. Please wait until processing is complete to get messages.
+# LOCALIZATION NOTE (pop3ServerBusy): Do not translate the word "%S" below.
+# Place %S where the account name should appear.
+pop3ServerBusy=The account %S is being processed. Please wait until processing is complete to get messages.
 
 # Status - retr failure from the server
 pop3RetrFailure=The RETR command did not succeed. Error retrieving a message.
 
 # Status - password undefined 
 pop3PasswordUndefined=Error getting mail password.
 
 # Status - username undefined