fix warnings. fix bug #27458, add HaveData() interface for alecf

so he can check if there is data in the single signon database
for a given url.  r=alecf
This commit is contained in:
sspitzer%netscape.com 2000-02-12 00:28:46 +00:00
parent 70a674879d
commit da92793dad
7 changed files with 68 additions and 2 deletions

View File

@ -67,6 +67,7 @@ WalletEditorImpl::GetValue(PRUnichar** aValue)
return res;
}
#if 0
static void DOMWindowToWebShellWindow(
nsIDOMWindow *DOMWindow,
nsCOMPtr<nsIWebShellWindow> *webWindow)
@ -87,6 +88,7 @@ static void DOMWindowToWebShellWindow(
webshell->GetTopLevelWindow(getter_AddRefs(topLevelWindow));
*webWindow = do_QueryInterface(topLevelWindow);
}
#endif /* 0 */
NS_IMETHODIMP
WalletEditorImpl::SetValue(const PRUnichar* aValue, nsIDOMWindow* win)

View File

@ -59,6 +59,7 @@ interface nsIWalletService : nsISupports {
boolean PromptPasswordURL(in wstring text, out wstring pwd, in string urlname, in boolean stripUrl, in nsIPrompt dialog);
boolean PromptURL(in wstring text, in wstring defaultText, out wstring result, in string urlname, in boolean stripUrl, in nsIPrompt dialog);
void SI_RemoveUser(in string URLName, in boolean stripUrl, in wstring userName);
boolean haveData(in string url, in wstring userName, in boolean stripUrl);
[noscript] void WALLET_GetNopreviewListForViewer(in nsAutoStringRef aNopreviewList);
[noscript] void WALLET_GetNocaptureListForViewer(in nsAutoStringRef aNocaptureList);

View File

@ -374,3 +374,9 @@ nsWalletlibService::GetPassword(PRUnichar **password)
{
return Wallet_GetMasterPassword(password);
}
NS_IMETHODIMP
nsWalletlibService::HaveData(const char *url, const PRUnichar *userName, PRBool stripUrl, PRBool *_retval)
{
return ::SINGSIGN_HaveData(url, userName, stripUrl, _retval);
}

View File

@ -61,6 +61,7 @@ public:
const char *urlname, PRBool stripUrl, nsIPrompt* dialog, PRBool *_retval);
NS_IMETHOD SI_RemoveUser(const char *URLName, PRBool stripUrl, const PRUnichar *userName);
NS_IMETHOD HaveData(const char *url, const PRUnichar *userName, PRBool stripUrl, PRBool *_retval);
NS_IMETHOD WALLET_GetNopreviewListForViewer(nsAutoString& aNopreviewList);
NS_IMETHOD WALLET_GetNocaptureListForViewer(nsAutoString& aNocaptureList);

View File

@ -2866,6 +2866,54 @@ SINGSIGN_GetRejectListForViewer(nsAutoString& aRejectList)
aRejectList = buffer;
}
PUBLIC nsresult
SINGSIGN_HaveData(const char *url, const PRUnichar *userName, PRBool strip, PRBool *retval)
{
nsresult res;
nsAutoString data, usernameForLookup;
*retval = PR_FALSE;
if (!si_GetSignonRememberingPref()) {
return NS_OK;
}
NS_ASSERTION(strip == PR_FALSE, "this code needs to be finished for the strip case");
/* convert to a uri so we can parse out the username and hostname */
nsCOMPtr<nsIURL> uri;
nsComponentManager::CreateInstance(kStandardUrlCID, nsnull, NS_GET_IID(nsIURL), (void **) getter_AddRefs(uri));
res = uri->SetSpec(url);
if (NS_FAILED(res)) return res;
/* get host part of the uri */
nsXPIDLCString host;
if (strip) {
res = uri->GetHost(getter_Copies(host));
if (NS_FAILED(res)) {
return res;
}
} else {
res = MangleUrl(url, getter_Copies(host));
if (NS_FAILED(res)) return res;
}
if (strip) {
/* convert url to a uri so we can parse out the username and hostname */
/* if no username given, extract it from uri -- note: prehost is <username>:<password> */
return NS_ERROR_NOT_IMPLEMENTED;
}
/* get previous data used with this username, pick first user if no username found */
si_RestoreOldSignonDataFromBrowser((const char *)host, (usernameForLookup.Length() == 0), usernameForLookup, data);
if (data.Length()) {
*retval = PR_TRUE;
}
return NS_OK;
}
#ifdef APPLE_KEYCHAIN
/************************************

View File

@ -65,6 +65,10 @@ extern PRBool
SINGSIGN_RemoveUser
(const char *URLName, const PRUnichar *userName, PRBool strip);
extern nsresult
SINGSIGN_HaveData(const char *url, const PRUnichar *userName, PRBool strip, PRBool *retval);
XP_END_PROTOS
#endif /* !_SINGSIGN_H */

View File

@ -529,8 +529,9 @@ SI_GetCharPref(const char * prefname, char** aPrefvalue);
#ifdef AutoCapture
static const char *pref_captureForms = "wallet.captureForms";
#endif
#else
static const char *pref_WalletNotified = "wallet.Notified";
#endif /* AutoCapture */
static const char *pref_WalletKeyFileName = "wallet.KeyFileName";
static const char *pref_WalletSchemaValueFileName = "wallet.SchemaValueFileName";
static const char *pref_WalletServer = "wallet.Server";
@ -539,8 +540,9 @@ static const char *pref_WalletVersion = "wallet.version";
#ifdef AutoCapture
PRIVATE PRBool wallet_captureForms = PR_FALSE;
#endif
#else
PRIVATE PRBool wallet_Notified = PR_FALSE;
#endif
PRIVATE char * wallet_Server = nsnull;
#ifdef AutoCapture
@ -588,6 +590,7 @@ wallet_GetFormsCapturingPref(void)
}
#endif
#ifndef AutoCapture
PRIVATE void
wallet_SetWalletNotificationPref(PRBool x) {
SI_SetBoolPref(pref_WalletNotified, x);
@ -603,6 +606,7 @@ wallet_GetWalletNotificationPref(void) {
}
return wallet_Notified;
}
#endif /* ! AutoCapture */
/*************************************************************************/