Add SetUserName support which is going to be needed in order to figure out the server for a url.

This commit is contained in:
mscott%netscape.com 1999-08-10 18:12:37 +00:00
Родитель 18dcf8beb5
Коммит b236661949
5 изменённых файлов: 25 добавлений и 39 удалений

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

@ -44,8 +44,6 @@ nsresult NS_NewSmtpUrl(const nsIID &aIID, void ** aInstancePtrResult)
}
nsSmtpUrl::nsSmtpUrl() : nsMsgMailNewsUrl(),
m_userPassword(""),
m_userName(""),
m_fileName("")
{
// nsISmtpUrl specific state...
@ -64,14 +62,11 @@ nsSmtpUrl::nsSmtpUrl() : nsMsgMailNewsUrl(),
m_organizationPart = nsnull;
m_replyToPart = nsnull;
m_priorityPart = nsnull;
m_userNameString = nsnull;
}
nsSmtpUrl::~nsSmtpUrl()
{
CleanupSmtpState();
delete [] m_userNameString;
PR_FREEIF(m_toPart);
}
@ -302,46 +297,25 @@ nsresult nsSmtpUrl::GetUserEmailAddress(const char ** aUserName)
{
nsresult rv = NS_OK;
if (aUserName)
*aUserName = m_userNameString;
*aUserName = m_userName.GetBuffer();
else
rv = NS_ERROR_NULL_POINTER;
return rv;
}
nsresult nsSmtpUrl::GetUserPassword(const nsString ** aUserPassword)
nsresult nsSmtpUrl::SetUserEmailAddress(const char * aUserName)
{
nsresult rv = NS_OK;
if (aUserPassword)
*aUserPassword = &m_userPassword;
else
rv = NS_ERROR_NULL_POINTER;
return rv;
}
nsresult nsSmtpUrl::SetUserEmailAddress(const nsString& aUserName)
{
nsresult rv = NS_OK;
if (aUserName.GetUnicode())
if (aUserName)
{
m_userName = aUserName;
if (m_userNameString)
delete [] m_userNameString;
m_userNameString = m_userName.ToNewCString();
}
else
rv = NS_ERROR_NULL_POINTER;
return rv;
}
nsresult nsSmtpUrl::SetUserPassword(const nsString& aUserPassword)
{
nsresult rv = NS_OK;
if (aUserPassword.GetUnicode())
{
m_userPassword = aUserPassword;
}
return rv;
}
nsresult nsSmtpUrl::GetMessageContents(const char ** aToPart, const char ** aCcPart, const char ** aBccPart,
const char ** aFromPart, const char ** aFollowUpToPart, const char ** aOrganizationPart,

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

@ -67,9 +67,7 @@ public:
// interface here that would encapsulte things like username, domain, password,
// etc...
NS_IMETHOD GetUserEmailAddress(const char ** aUserName);
NS_IMETHOD SetUserEmailAddress(const nsString& aUserName);
NS_IMETHOD GetUserPassword(const nsString ** aUserPassword);
NS_IMETHOD SetUserPassword(const nsString& aUserPassword);
NS_IMETHOD SetUserEmailAddress(const char * aUserName);
// nsSmtpUrl
@ -79,6 +77,7 @@ protected:
virtual ~nsSmtpUrl();
// protocol specific code to parse a url...
virtual nsresult ParseUrl();
virtual const char * GetUserName() { return m_userName.GetBuffer();}
// data retrieved from parsing the url: (Note the url could be a post from file or it could be inthe url)
char *m_toPart;
@ -101,10 +100,7 @@ protected:
PRBool m_forcePlainText;
/* Smtp specific event sinks */
nsString m_userPassword;
char *m_userNameString; // char * version of m_userName
nsString m_userName;
nsCString m_userName;
nsFilePath m_fileName;
// it is possible to encode the message to parse in the form of a url.

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

@ -48,4 +48,5 @@ interface nsINntpUrl : nsISupports {
readonly attribute nsIMsgDBHdr messageHeader;
attribute nsMsgKey messageKey;
attribute string newsgroupName;
void SetUsername(in string aUserName);
};

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

@ -234,6 +234,17 @@ NS_IMETHODIMP nsNntpUrl::GetURI(char ** aURI)
}
}
NS_IMETHODIMP nsNntpUrl::SetUsername(const char *aUserName)
{
nsresult rv = NS_OK;
if (aUserName)
m_userName = aUserName;
else
rv = NS_ERROR_NULL_POINTER;
return rv;
}
////////////////////////////////////////////////////////////////////////////////////
// End nsINntpUrl specific support
////////////////////////////////////////////////////////////////////////////////////

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

@ -56,6 +56,8 @@ public:
NS_IMETHOD SetNewsgroupName(char * aNewsgroupName);
NS_IMETHOD GetNewsgroupName(char ** aNewsgroupName);
NS_IMETHOD SetUsername(const char *aUserName);
// from nsIMsgUriUrl
NS_IMETHOD GetURI(char ** aURI);
@ -67,8 +69,10 @@ public:
protected:
nsINNTPNewsgroupPost *m_newsgroupPost;
virtual const char * GetUserName() { return m_userName.GetBuffer();}
nsFileSpec *m_filePath;
nsCString m_userName;
/* NNTP specific event sinks */
nsINNTPHost * m_newsHost;