зеркало из https://github.com/mozilla/gecko-dev.git
fix for #39584. user should be asked to remove non existing newsgroups, like in 4.x
r/sr=bienvenu
This commit is contained in:
Родитель
4e91454ef0
Коммит
45d773762b
|
@ -112,7 +112,7 @@ interface nsINntpIncomingServer : nsISupports {
|
|||
readonly attribute string firstGroupNeedingExtraInfo;
|
||||
void setGroupNeedsExtraInfo(in string name, in boolean needsExtraInfo);
|
||||
|
||||
void groupNotFound(in string group, in boolean opening);
|
||||
void groupNotFound(in nsIMsgWindow window, in string group, in boolean opening);
|
||||
|
||||
void setPrettyNameForGroup(in string name, in string prettyName);
|
||||
};
|
||||
|
|
|
@ -49,8 +49,7 @@ downloadingArticlesForOffline=Downloading articles %S-%S in %S
|
|||
onlyCancelOneMessage=You can only cancel one article at a time.
|
||||
|
||||
# LOCALIZATION NOTE (autoUnsubscribeText): %1$S is the newsgroup and %2$S is the newsgroup-server it is being removed from.
|
||||
autoUnsubscribeText=The group %1$S could not be updated, because it could not be found on the server %2$S. The group may no longer exist, or the server may have stopped carrying it.
|
||||
autoUnsubscribeButtonText=Unsubscribe
|
||||
autoUnsubscribeText=The newsgroup %1$S does not appear to exist on the host %2$S. Would you like to unsubscribe from it?
|
||||
|
||||
# LOCALIZATION NOTE (Error -304): In the following item, don't translate "NNTP"
|
||||
# Error - server error
|
||||
|
|
|
@ -2161,7 +2161,7 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommandResponse()
|
|||
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) group (%s) not found, so unset m_currentGroup",this,(const char *)group_name));
|
||||
m_currentGroup = "";
|
||||
|
||||
m_nntpServer->GroupNotFound((const char *)group_name, PR_TRUE /* opening */);
|
||||
m_nntpServer->GroupNotFound(m_msgWindow, group_name.get(), PR_TRUE /* opening */);
|
||||
}
|
||||
|
||||
/* if the server returned a 400 error then it is an expected
|
||||
|
@ -2522,6 +2522,8 @@ nsresult nsNNTPProtocol::MarkCurrentMsgRead()
|
|||
msgHdr->GetIsRead(&isRead);
|
||||
if (!isRead)
|
||||
msgHdr->MarkRead(PR_TRUE);
|
||||
|
||||
printf("do work here\n");
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
|
@ -4088,7 +4090,7 @@ PRInt32 nsNNTPProtocol::DisplayNewsRCResponse()
|
|||
rv = m_newsFolder->GetAsciiName(getter_Copies(name));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
m_nntpServer->GroupNotFound((const char *)name, PR_FALSE);
|
||||
m_nntpServer->GroupNotFound(m_msgWindow, name.get(), PR_FALSE);
|
||||
}
|
||||
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) NO_GROUP, so unset m_currentGroup", this));
|
||||
|
|
|
@ -54,6 +54,9 @@
|
|||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsInt64.h"
|
||||
#include "nsMsgUtils.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nntpCore.h"
|
||||
|
||||
#define INVALID_VERSION 0
|
||||
#define VALID_VERSION 1
|
||||
|
@ -1562,11 +1565,52 @@ nsNntpIncomingServer::SetGroupNeedsExtraInfo(const char *name, PRBool needsExtra
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::GroupNotFound(const char *name, PRBool opening)
|
||||
nsNntpIncomingServer::GroupNotFound(nsIMsgWindow *aMsgWindow, const char *aName, PRBool aOpening)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(name);
|
||||
printf("alert, asking if the user wants to auto unsubscribe from %s\n", name);
|
||||
return NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(aName);
|
||||
NS_ENSURE_ARG_POINTER(aMsgWindow);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr <nsIPrompt> prompt;
|
||||
rv = aMsgWindow->GetPromptDialog(getter_AddRefs(prompt));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr <nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID,&rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr <nsIStringBundle> bundle;
|
||||
rv = bundleService->CreateBundle(NEWS_MSGS_URL, getter_AddRefs(bundle));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsAutoString groupStr;
|
||||
groupStr.AssignWithConversion(aName);
|
||||
|
||||
nsXPIDLCString hostname;
|
||||
rv = GetHostName(getter_Copies(hostname));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsAutoString hostStr;
|
||||
hostStr.AssignWithConversion(hostname.get());
|
||||
|
||||
const PRUnichar *formatStrings[2] = { groupStr.get(), hostStr.get() };
|
||||
nsXPIDLString confirmText;
|
||||
rv = bundle->FormatStringFromName(
|
||||
NS_LITERAL_STRING("autoUnsubscribeText").get(),
|
||||
formatStrings, 2,
|
||||
getter_Copies(confirmText));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
PRBool confirmResult = PR_FALSE;
|
||||
rv = prompt->Confirm(nsnull, confirmText, &confirmResult);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (confirmResult) {
|
||||
rv = Unsubscribe(groupStr.get());
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
Загрузка…
Ссылка в новой задаче