mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Bug #100167: Added server name to a few connection error msgs for imap, news and pop. Also fixed two obsolete imap error numbers (1 & 2). r=bienvenu, sr=sspitzer.
This commit is contained in:
parent
45d9bafe78
commit
ecdeca711f
@ -210,9 +210,9 @@ saveLabel=Save
|
||||
|
||||
# Connection Error Messages
|
||||
101=Unknown Error
|
||||
102=Failed to connect to the server.
|
||||
103=Could not connect to the server; the connection was refused.
|
||||
104=Connection to the server timed out.
|
||||
102=Failed to connect to server %S.
|
||||
103=Could not connect to server %S; the connection was refused.
|
||||
104=Connection to server %S timed out.
|
||||
|
||||
recipientSearchCriteria=Subject or Recipient contains:
|
||||
senderSearchCriteria=Subject or Sender contains:
|
||||
|
@ -184,8 +184,11 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetServer(nsIMsgIncomingServer ** aIncomingServe
|
||||
rv = GetScheme(getter_Copies(scheme));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (nsCRT::strcmp((const char *)scheme, "pop") == 0)
|
||||
scheme.Adopt(nsCRT::strdup("pop3"));
|
||||
if (scheme.Equals("pop"))
|
||||
scheme.Assign("pop3");
|
||||
// we use "nntp" in the server list so translate it here.
|
||||
if (scheme.Equals("news"))
|
||||
scheme.Assign("nntp");
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager =
|
||||
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -74,6 +74,8 @@ NS_INTERFACE_MAP_BEGIN(nsMsgProtocol)
|
||||
NS_INTERFACE_MAP_END_THREADSAFE
|
||||
|
||||
static PRUnichar *GetStringByID(PRInt32 stringID);
|
||||
static PRUnichar *FormatStringWithHostNameByID(PRInt32 stringID, nsIMsgMailNewsUrl *msgUri);
|
||||
|
||||
|
||||
nsMsgProtocol::nsMsgProtocol(nsIURI * aURL)
|
||||
{
|
||||
@ -334,7 +336,7 @@ NS_IMETHODIMP nsMsgProtocol::OnStopRequest(nsIRequest *request, nsISupports *ctx
|
||||
|
||||
NS_ASSERTION(errorID != UNKNOWN_ERROR, "unknown error, but don't alert user.");
|
||||
if (errorID != UNKNOWN_ERROR) {
|
||||
PRUnichar *errorMsg = GetStringByID(errorID);
|
||||
PRUnichar *errorMsg = FormatStringWithHostNameByID(errorID, msgUrl);
|
||||
if (errorMsg == nsnull) {
|
||||
nsAutoString resultString(NS_LITERAL_STRING("[StringID "));
|
||||
resultString.AppendInt(errorID, 10);
|
||||
@ -1219,7 +1221,7 @@ PRUnichar *GetStringByID(PRInt32 stringID)
|
||||
nsCOMPtr <nsIStringBundle> sBundle = nsnull;
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> sBundleService =
|
||||
do_GetService(kStringBundleServiceCID, &rv);
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv) || (nsnull == sBundleService))
|
||||
return nsnull;
|
||||
|
||||
@ -1236,3 +1238,37 @@ PRUnichar *GetStringByID(PRInt32 stringID)
|
||||
return (ptrv);
|
||||
}
|
||||
|
||||
PRUnichar *FormatStringWithHostNameByID(PRInt32 stringID, nsIMsgMailNewsUrl *msgUri)
|
||||
{
|
||||
if (! msgUri)
|
||||
return nsnull;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr <nsIStringBundle> sBundle = nsnull;
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> sBundleService =
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv) || (! sBundleService))
|
||||
return nsnull;
|
||||
|
||||
rv = sBundleService->CreateBundle(MSGS_URL, getter_AddRefs(sBundle));
|
||||
if (NS_FAILED(rv))
|
||||
return nsnull;
|
||||
|
||||
PRUnichar *ptrv = nsnull;
|
||||
nsXPIDLCString hostName;
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = msgUri->GetServer(getter_AddRefs(server));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && server)
|
||||
rv = server->GetRealHostName(getter_Copies(hostName));
|
||||
|
||||
nsAutoString hostStr;
|
||||
hostStr.AssignWithConversion(hostName.get());
|
||||
const PRUnichar *params[] = { hostStr.get() };
|
||||
rv = sBundle->FormatStringFromID(stringID, params, 1, &ptrv);
|
||||
if (NS_FAILED(rv))
|
||||
return nsnull;
|
||||
|
||||
return (ptrv);
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ interface nsIImapServerSink : nsISupports {
|
||||
void loadNextQueuedUrl(out boolean urlRun);
|
||||
|
||||
void getImapStringByID(in long aMsgId, out wstring aString);
|
||||
void formatStringWithHostNameByID(in long aMsgId, out wstring aString);
|
||||
void fEAlert(in wstring aString, in nsIMsgWindow aMsgWindow);
|
||||
void fEAlertFromServer(in string aString, in nsIMsgWindow aMsgWindow);
|
||||
void commitNamespaces();
|
||||
|
@ -169,7 +169,7 @@
|
||||
|
||||
## @name IMAP_LOGIN_FAILED
|
||||
## @loc None
|
||||
5035=Login failed.
|
||||
5035=Login to server %S failed.
|
||||
|
||||
## @name IMAP_RECEIVING_MESSAGE_HEADERS_OF
|
||||
## @loc None
|
||||
@ -250,7 +250,7 @@
|
||||
## @name IMAP_SERVER_NOT_IMAP4
|
||||
## @loc None
|
||||
# LOCALIZATION NOTE (Error 5048): Do not translate the word "IMAP4" below.
|
||||
5048=This mail server is not an IMAP4 mail server.
|
||||
5048=Mail server %S is not an IMAP4 mail server.
|
||||
|
||||
## @name IMAP_SERVER_SAID
|
||||
## @loc None
|
||||
@ -266,15 +266,15 @@
|
||||
|
||||
## @name IMAP_UNKNOWN_HOST_ERROR
|
||||
## @loc None
|
||||
5052=Failed to connect to the server.
|
||||
5052=Failed to connect to server %S.
|
||||
|
||||
## @name IMAP_IMAP_CONNECTION_REFUSED_ERROR
|
||||
## @loc None
|
||||
5053=Could not connect to the mail server; the connection was refused.
|
||||
5053=Could not connect to mail server %S; the connection was refused.
|
||||
|
||||
## @name IMAP_NET_TIMEOUT_ERROR
|
||||
## @loc None
|
||||
5054=Connection to the server timed out.
|
||||
5054=Connection to server %S timed out.
|
||||
|
||||
## @name IMAP_MOVE_FOLDER_TO_TRASH
|
||||
## @loc None
|
||||
@ -312,3 +312,7 @@
|
||||
## @name IMAP_SPECIAL_CHAR
|
||||
## @loc None
|
||||
5065= The %c character is reserved on this imap server. Please choose another name.
|
||||
|
||||
## @name IMAP_SERVER_DISCONNECTED
|
||||
## @loc None
|
||||
5066= Server %S has disconnected. The server may have gone down or there may be a network problem.
|
||||
|
@ -201,9 +201,6 @@ public:
|
||||
nsIMAPNamespace *namespaceForFolder;
|
||||
};
|
||||
|
||||
const int kImapServerDisconnected = 1;
|
||||
const int kImapOutOfMemory = 2;
|
||||
const int kImapDownloadingMessage = 3;
|
||||
|
||||
typedef struct _GenericInfo {
|
||||
char *c, *hostName;
|
||||
|
@ -2048,33 +2048,44 @@ nsresult nsImapIncomingServer::GetStringBundle()
|
||||
|
||||
NS_IMETHODIMP nsImapIncomingServer::GetImapStringByID(PRInt32 aMsgId, PRUnichar **aString)
|
||||
{
|
||||
nsAutoString resultString(NS_LITERAL_STRING("???"));
|
||||
nsresult res = NS_OK;
|
||||
|
||||
GetStringBundle();
|
||||
if (m_stringBundle)
|
||||
{
|
||||
PRUnichar *ptrv = nsnull;
|
||||
res = m_stringBundle->GetStringFromID(aMsgId, &ptrv);
|
||||
|
||||
if (NS_FAILED(res))
|
||||
{
|
||||
resultString.Assign(NS_LITERAL_STRING("[StringID"));
|
||||
resultString.AppendInt(aMsgId, 10);
|
||||
resultString.Assign(NS_LITERAL_STRING("?]"));
|
||||
res = m_stringBundle->GetStringFromID(aMsgId, aString);
|
||||
if (NS_SUCCEEDED(res))
|
||||
return res;
|
||||
}
|
||||
nsAutoString resultString(NS_LITERAL_STRING("String ID "));
|
||||
resultString.AppendInt(aMsgId);
|
||||
*aString = ToNewUnicode(resultString);
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
|
||||
NS_IMETHODIMP nsImapIncomingServer::FormatStringWithHostNameByID(PRInt32 aMsgId, PRUnichar **aString)
|
||||
{
|
||||
*aString = ptrv;
|
||||
nsresult res = NS_OK;
|
||||
|
||||
GetStringBundle();
|
||||
if (m_stringBundle)
|
||||
{
|
||||
nsXPIDLCString hostName;
|
||||
res = GetRealHostName(getter_Copies(hostName));
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
nsAutoString hostStr;
|
||||
hostStr.AssignWithConversion(hostName.get());
|
||||
const PRUnichar *params[] = { hostStr.get() };
|
||||
res = m_stringBundle->FormatStringFromID(aMsgId, params, 1, aString);
|
||||
if (NS_SUCCEEDED(res))
|
||||
return res;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res = NS_OK;
|
||||
nsAutoString resultString(NS_LITERAL_STRING("String ID "));
|
||||
resultString.AppendInt(aMsgId);
|
||||
*aString = ToNewUnicode(resultString);
|
||||
}
|
||||
return res;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsImapIncomingServer::ResetFoldersToUnverified(nsIFolder *parentFolder)
|
||||
|
@ -4068,7 +4068,7 @@ nsImapProtocol::AlertUserEventUsingId(PRUint32 aMessageId)
|
||||
if (!suppressErrorMsg)
|
||||
{
|
||||
PRUnichar *progressString = nsnull;
|
||||
m_imapServerSink->GetImapStringByID(aMessageId, &progressString);
|
||||
m_imapServerSink->FormatStringWithHostNameByID(aMessageId, &progressString);
|
||||
nsCOMPtr<nsIMsgWindow> msgWindow;
|
||||
GetMsgWindow(getter_AddRefs(msgWindow));
|
||||
m_imapServerSink->FEAlert(progressString, msgWindow);
|
||||
|
@ -127,7 +127,7 @@ PRBool nsImapServerResponseParser::GetNextLineForParser(char **nextLine)
|
||||
// we'd really like to try to silently reconnect, but we shouldn't put this
|
||||
// message up just in the interrupt case
|
||||
if (fServerConnection.GetConnectionStatus() <= 0 && !fServerConnection.DeathSignalReceived())
|
||||
fServerConnection.AlertUserEventUsingId(kImapServerDisconnected);
|
||||
fServerConnection.AlertUserEventUsingId(IMAP_SERVER_DISCONNECTED);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -285,10 +285,7 @@ void nsImapServerResponseParser::ParseIMAPServerResponse(const char *currentComm
|
||||
|
||||
void nsImapServerResponseParser::HandleMemoryFailure()
|
||||
{
|
||||
#ifdef DEBUG_chrisf
|
||||
PR_ASSERT(PR_FALSE);
|
||||
#endif
|
||||
fServerConnection.AlertUserEventUsingId(kImapOutOfMemory);
|
||||
fServerConnection.AlertUserEventUsingId(IMAP_OUT_OF_MEMORY);
|
||||
nsIMAPGenericParser::HandleMemoryFailure();
|
||||
}
|
||||
|
||||
|
@ -107,4 +107,5 @@ NS_END_EXTERN_C
|
||||
#define IMAP_PFC_READ_MAIL 5063
|
||||
#define IMAP_PFC_SENT_MAIL 5064
|
||||
#define IMAP_SPECIAL_CHAR 5065
|
||||
#define IMAP_SERVER_DISCONNECTED 5066
|
||||
#endif /* _nsImapStringBundle_H__ */
|
||||
|
@ -178,7 +178,7 @@
|
||||
|
||||
## @name POP3_SERVER_SAID
|
||||
## @loc None
|
||||
4025= The mail server responded:
|
||||
4025= Mail server %S responded:
|
||||
|
||||
## @name DELETING_MSGS_STATUS
|
||||
## @loc None
|
||||
|
@ -854,7 +854,22 @@ nsPop3Protocol::Error(PRInt32 err_code)
|
||||
else
|
||||
{
|
||||
nsXPIDLString serverSaidPrefix;
|
||||
mStringService->GetStringByID(POP3_SERVER_SAID,getter_Copies(serverSaidPrefix));
|
||||
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_pop3Server);
|
||||
nsXPIDLCString hostName;
|
||||
// Fomat string with hostname.
|
||||
if (server)
|
||||
rv = server->GetRealHostName(getter_Copies(hostName));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsAutoString hostStr;
|
||||
hostStr.AssignWithConversion(hostName.get());
|
||||
const PRUnichar *params[] = { hostStr.get() };
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
rv = mStringService->GetBundle(getter_AddRefs(bundle));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
bundle->FormatStringFromID(POP3_SERVER_SAID, params, 1, getter_Copies(serverSaidPrefix));
|
||||
}
|
||||
|
||||
nsAutoString message(alertString + NS_LITERAL_STRING(" ") +
|
||||
serverSaidPrefix + NS_LITERAL_STRING(" ") +
|
||||
NS_ConvertASCIItoUCS2(m_commandResponse));
|
||||
|
Loading…
Reference in New Issue
Block a user