bug 113540, remove mailnews dependency on password manager, r=mscott,sspitzer,jag,law
git-svn-id: svn://10.0.0.236/trunk@112919 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
461edc33ef
commit
7d3edf79d1
@ -63,7 +63,8 @@
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIWebShellWindow.h"
|
||||
#include "nsIAuthPrompt.h"
|
||||
#include "nsIWalletService.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
@ -80,7 +81,6 @@
|
||||
|
||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kWalletServiceCID, NS_WALLETSERVICE_CID);
|
||||
static NS_DEFINE_CID(kMsgFilterServiceCID, NS_MSGFILTERSERVICE_CID);
|
||||
|
||||
#define OFFLINE_STATUS_CHANGED_TOPIC "network:offline-status-changed"
|
||||
@ -771,37 +771,39 @@ nsMsgIncomingServer::StorePassword()
|
||||
rv = GetPassword(getter_Copies(pwd));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIWalletService> walletservice =
|
||||
do_GetService(kWalletServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIObserverService> os = do_GetService("@mozilla.org/observer-service;1");
|
||||
if (os) {
|
||||
nsXPIDLCString serverSpec;
|
||||
rv = GetServerURI(getter_Copies(serverSpec));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLCString serverUri;
|
||||
rv = GetServerURI(getter_Copies(serverUri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), serverSpec);
|
||||
|
||||
rv = os->NotifyObservers(uri, "login-succeeded", PromiseFlatString(NS_ConvertUTF8toUCS2(pwd)).get());
|
||||
}
|
||||
|
||||
nsAutoString password; password.AssignWithConversion((const char *)pwd);
|
||||
rv = walletservice->SI_StorePassword((const char *)serverUri, nsnull, password.get());
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::ForgetPassword()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIWalletService> walletservice =
|
||||
do_GetService(kWalletServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
||||
nsXPIDLCString serverUri;
|
||||
rv = GetServerURI(getter_Copies(serverUri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIObserverService> os = do_GetService("@mozilla.org/observer-service;1");
|
||||
if (os) {
|
||||
nsXPIDLCString serverSpec;
|
||||
rv = GetServerURI(getter_Copies(serverSpec));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), serverSpec);
|
||||
|
||||
rv = os->NotifyObservers(uri, "login-failed", nsnull);
|
||||
}
|
||||
|
||||
rv = SetPassword("");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
rv = walletservice->SI_RemoveUser((const char *)serverUri, nsnull);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@ -79,7 +79,9 @@
|
||||
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
#include "nsIWalletService.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIAuthPrompt.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsINntpUrl.h"
|
||||
@ -100,7 +102,6 @@ static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kCNewsDB, NS_NEWSDB_CID);
|
||||
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
|
||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
||||
static NS_DEFINE_CID(kWalletServiceCID, NS_WALLETSERVICE_CID);
|
||||
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
|
||||
|
||||
// ###tw This really ought to be the most
|
||||
@ -1270,37 +1271,39 @@ nsresult nsMsgNewsFolder::CreateNewsgroupUrlForSignon(const char *inUriStr, cons
|
||||
|
||||
NS_IMETHODIMP nsMsgNewsFolder::ForgetGroupUsername()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIWalletService> walletservice =
|
||||
do_GetService(kWalletServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIObserverService> os = do_GetService("@mozilla.org/observer-service;1");
|
||||
if (os) {
|
||||
rv = SetGroupUsername(nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = SetGroupUsername(nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsXPIDLCString signonURL;
|
||||
rv = CreateNewsgroupUsernameUrlForSignon(mURI, getter_Copies(signonURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLCString signonURL;
|
||||
rv = CreateNewsgroupUsernameUrlForSignon(mURI, getter_Copies(signonURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = walletservice->SI_RemoveUser((const char *)signonURL, nsnull);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), signonURL);
|
||||
rv = os->NotifyObservers(uri, "login-failed", nsnull);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgNewsFolder::ForgetGroupPassword()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIWalletService> walletservice =
|
||||
do_GetService(kWalletServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIObserverService> os = do_GetService("@mozilla.org/observer-service;1");
|
||||
if (os) {
|
||||
rv = SetGroupPassword(nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = SetGroupPassword(nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsXPIDLCString signonURL;
|
||||
rv = CreateNewsgroupPasswordUrlForSignon(mURI, getter_Copies(signonURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLCString signonURL;
|
||||
rv = CreateNewsgroupPasswordUrlForSignon(mURI, getter_Copies(signonURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = walletservice->SI_RemoveUser((const char *)signonURL, nsnull);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), signonURL);
|
||||
rv = os->NotifyObservers(uri, "login-failed", nsnull);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user