mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-25 19:25:43 +00:00
fix for #71243. don't hard code the default values, get them from the
default prefs. fix by cavin@netscape.com. sr=spitzer
This commit is contained in:
parent
f55ec09bcb
commit
3c0cfdec3a
@ -102,7 +102,8 @@ nsSmtpServer::GetTrySSL(PRInt32 *trySSL)
|
||||
*trySSL= 0;
|
||||
getPrefString("try_ssl", pref);
|
||||
rv = prefs->GetIntPref(pref, trySSL);
|
||||
if (NS_FAILED(rv)) *trySSL = 1;
|
||||
if (NS_FAILED(rv))
|
||||
rv = getDefaultIntPref(prefs, 1, "try_ssl", trySSL);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -128,8 +129,29 @@ nsSmtpServer::GetAuthMethod(PRInt32 *authMethod)
|
||||
*authMethod = 1;
|
||||
getPrefString("auth_method", pref);
|
||||
rv = prefs->GetIntPref(pref, authMethod);
|
||||
if (NS_FAILED(rv)) *authMethod = 1;
|
||||
return NS_OK;
|
||||
if (NS_FAILED(rv))
|
||||
rv = getDefaultIntPref(prefs, 1, "auth_method", authMethod);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSmtpServer::getDefaultIntPref(nsIPref *prefs,
|
||||
PRInt32 defVal,
|
||||
const char *prefName,
|
||||
PRInt32 *val)
|
||||
{
|
||||
// mail.smtpserver.default.<prefName>
|
||||
nsCAutoString fullPrefName;
|
||||
fullPrefName = "mail.smtpserver.default.";
|
||||
fullPrefName.Append(prefName);
|
||||
nsresult rv = prefs->GetIntPref(fullPrefName, val);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
{ // last resort
|
||||
*val = defVal;
|
||||
rv = NS_OK;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -42,6 +42,7 @@ private:
|
||||
nsCString mKey;
|
||||
|
||||
nsresult getPrefString(const char *pref, nsCAutoString& result);
|
||||
nsresult getDefaultIntPref(nsIPref *prefs, PRInt32 defVal, const char *prefName, PRInt32 *val);
|
||||
nsCString m_password;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user