Distinguish between pop and smtp user name. Remove old user_name field which has these new, more specific fields instead.

This commit is contained in:
mscott%netscape.com 1999-03-12 03:54:13 +00:00
Родитель b46dc22a74
Коммит 7ce84d495d
3 изменённых файлов: 42 добавлений и 15 удалений

Просмотреть файл

@ -49,10 +49,13 @@ public:
// user name, pwd, mail server to use, etc....
//////////////////////////////////////////////////////////////////////////////////
NS_IMETHOD GetRootFolderPath(const char ** aRootFolderPath) = 0;
NS_IMETHOD GetPopName(const char ** aPopName) = 0; // right now it is pop & smtp user name
NS_IMETHOD GetSmtpName(const char ** aSmtpName) = 0;
NS_IMETHOD GetOrganization(const char ** aOrganization) = 0;
NS_IMETHOD GetUserFullName(const char ** aUserFullName) = 0; // User real name
NS_IMETHOD GetUserEmail(const char ** aUserEmail) = 0;
NS_IMETHOD GetUserName(const char ** aUserName) = 0; // right now it is pop & smtp user name
NS_IMETHOD GetPopPassword(const char ** aUserPassword) = 0;
NS_IMETHOD GetPopServer(const char ** aHostName) = 0;
NS_IMETHOD GetSmtpServer(const char ** aHostName) = 0;

Просмотреть файл

@ -29,23 +29,28 @@ NS_IMPL_ISUPPORTS(nsMsgIdentity, nsIMsgIdentity::GetIID());
nsMsgIdentity::nsMsgIdentity()
{
NS_INIT_REFCNT();
m_popName = nsnull;
m_smtpName = nsnull;
m_smtpHost = nsnull;
m_popHost = nsnull;
m_organization = nsnull;
m_userFullName = nsnull;
m_userEmail = nsnull;
m_userName = nsnull;
m_userPassword = nsnull;
m_smtpHost = nsnull;
m_popHost = nsnull;
m_rootPath = nsnull;
InitializeIdentity();
}
nsMsgIdentity::~nsMsgIdentity()
{
PR_FREEIF(m_smtpName);
PR_FREEIF(m_popName);
PR_FREEIF(m_organization);
PR_FREEIF(m_userFullName);
PR_FREEIF(m_userEmail);
PR_FREEIF(m_userName);
PR_FREEIF(m_userPassword);
PR_FREEIF(m_smtpHost);
PR_FREEIF(m_popHost);
@ -90,9 +95,14 @@ void nsMsgIdentity::InitializeIdentity()
m_smtpHost = PL_strdup(prefValue);
prefLength = PREF_LENGTH;
rv = prefs->GetCharPref("mailnews.user_name", prefValue, &prefLength);
rv = prefs->GetCharPref("mailnews.pop_name", prefValue, &prefLength);
if (NS_SUCCEEDED(rv) && prefLength > 0)
m_userName = PL_strdup(prefValue);
m_popName = PL_strdup(prefValue);
prefLength = PREF_LENGTH;
rv = prefs->GetCharPref("mailnews.smtp_name", prefValue, &prefLength);
if (NS_SUCCEEDED(rv) && prefLength > 0)
m_smtpName = PL_strdup(prefValue);
prefLength = PREF_LENGTH;
rv = prefs->GetCharPref("mailnews.pop_password", prefValue, &prefLength);
@ -103,6 +113,24 @@ void nsMsgIdentity::InitializeIdentity()
}
}
nsresult nsMsgIdentity::GetPopName(const char ** aUserName)
{
if (aUserName)
*aUserName = m_popName;
return NS_OK;
}
nsresult nsMsgIdentity::GetSmtpName(const char ** aSmtpName)
{
if (aSmtpName)
{
if (m_smtpName && *m_smtpName)
*aSmtpName = m_smtpName;
else // if we don't have a smtp name use the pop name...
return GetPopName(aSmtpName);
}
}
nsresult nsMsgIdentity::GetOrganization(const char ** aOrganization)
{
if (aOrganization)
@ -131,12 +159,6 @@ nsresult nsMsgIdentity::GetPopPassword(const char ** aUserPassword)
return NS_OK;
}
nsresult nsMsgIdentity::GetUserName(const char ** aUserName)
{
if (aUserName)
*aUserName = m_userName;
return NS_OK;
}
nsresult nsMsgIdentity::GetPopServer(const char ** aHostName)
{

Просмотреть файл

@ -41,19 +41,21 @@ public:
// user name, pwd, mail server to use, etc....
//////////////////////////////////////////////////////////////////////////////////
NS_IMETHOD GetRootFolderPath(const char ** aRootFolderPath);
NS_IMETHOD GetPopName(const char ** aPopName); // right now it is pop & smtp user name
NS_IMETHOD GetSmtpName(const char ** aSmtpName);
NS_IMETHOD GetOrganization(const char ** aOrganization);
NS_IMETHOD GetUserFullName(const char ** aUserFullName); // User real name
NS_IMETHOD GetUserEmail(const char ** aUserEmail);
NS_IMETHOD GetUserName(const char ** aUserName); // right now it is pop & smtp user name
NS_IMETHOD GetPopPassword(const char ** aUserPassword);
NS_IMETHOD GetPopServer(const char ** aHostName);
NS_IMETHOD GetSmtpServer(const char ** aHostName);
protected:
char *m_popName;
char *m_smtpName;
char *m_organization;
char *m_userFullName;
char *m_userEmail;
char *m_userName;
char *m_userPassword;
char *m_smtpHost;
char *m_popHost;