зеркало из https://github.com/mozilla/pjs.git
Add SetUserName support which is going to be needed in order to figure out the server for a url.
This commit is contained in:
Родитель
18dcf8beb5
Коммит
b236661949
|
@ -44,8 +44,6 @@ nsresult NS_NewSmtpUrl(const nsIID &aIID, void ** aInstancePtrResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSmtpUrl::nsSmtpUrl() : nsMsgMailNewsUrl(),
|
nsSmtpUrl::nsSmtpUrl() : nsMsgMailNewsUrl(),
|
||||||
m_userPassword(""),
|
|
||||||
m_userName(""),
|
|
||||||
m_fileName("")
|
m_fileName("")
|
||||||
{
|
{
|
||||||
// nsISmtpUrl specific state...
|
// nsISmtpUrl specific state...
|
||||||
|
@ -64,14 +62,11 @@ nsSmtpUrl::nsSmtpUrl() : nsMsgMailNewsUrl(),
|
||||||
m_organizationPart = nsnull;
|
m_organizationPart = nsnull;
|
||||||
m_replyToPart = nsnull;
|
m_replyToPart = nsnull;
|
||||||
m_priorityPart = nsnull;
|
m_priorityPart = nsnull;
|
||||||
|
|
||||||
m_userNameString = nsnull;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSmtpUrl::~nsSmtpUrl()
|
nsSmtpUrl::~nsSmtpUrl()
|
||||||
{
|
{
|
||||||
CleanupSmtpState();
|
CleanupSmtpState();
|
||||||
delete [] m_userNameString;
|
|
||||||
PR_FREEIF(m_toPart);
|
PR_FREEIF(m_toPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,46 +297,25 @@ nsresult nsSmtpUrl::GetUserEmailAddress(const char ** aUserName)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
if (aUserName)
|
if (aUserName)
|
||||||
*aUserName = m_userNameString;
|
*aUserName = m_userName.GetBuffer();
|
||||||
else
|
else
|
||||||
rv = NS_ERROR_NULL_POINTER;
|
rv = NS_ERROR_NULL_POINTER;
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsSmtpUrl::GetUserPassword(const nsString ** aUserPassword)
|
nsresult nsSmtpUrl::SetUserEmailAddress(const char * aUserName)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
if (aUserPassword)
|
if (aUserName)
|
||||||
*aUserPassword = &m_userPassword;
|
{
|
||||||
else
|
|
||||||
rv = NS_ERROR_NULL_POINTER;
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult nsSmtpUrl::SetUserEmailAddress(const nsString& aUserName)
|
|
||||||
{
|
|
||||||
nsresult rv = NS_OK;
|
|
||||||
if (aUserName.GetUnicode())
|
|
||||||
{
|
|
||||||
m_userName = aUserName;
|
m_userName = aUserName;
|
||||||
if (m_userNameString)
|
|
||||||
delete [] m_userNameString;
|
|
||||||
m_userNameString = m_userName.ToNewCString();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
rv = NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
return rv;
|
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,
|
nsresult nsSmtpUrl::GetMessageContents(const char ** aToPart, const char ** aCcPart, const char ** aBccPart,
|
||||||
const char ** aFromPart, const char ** aFollowUpToPart, const char ** aOrganizationPart,
|
const char ** aFromPart, const char ** aFollowUpToPart, const char ** aOrganizationPart,
|
||||||
|
|
|
@ -67,9 +67,7 @@ public:
|
||||||
// interface here that would encapsulte things like username, domain, password,
|
// interface here that would encapsulte things like username, domain, password,
|
||||||
// etc...
|
// etc...
|
||||||
NS_IMETHOD GetUserEmailAddress(const char ** aUserName);
|
NS_IMETHOD GetUserEmailAddress(const char ** aUserName);
|
||||||
NS_IMETHOD SetUserEmailAddress(const nsString& aUserName);
|
NS_IMETHOD SetUserEmailAddress(const char * aUserName);
|
||||||
NS_IMETHOD GetUserPassword(const nsString ** aUserPassword);
|
|
||||||
NS_IMETHOD SetUserPassword(const nsString& aUserPassword);
|
|
||||||
|
|
||||||
// nsSmtpUrl
|
// nsSmtpUrl
|
||||||
|
|
||||||
|
@ -79,6 +77,7 @@ protected:
|
||||||
virtual ~nsSmtpUrl();
|
virtual ~nsSmtpUrl();
|
||||||
// protocol specific code to parse a url...
|
// protocol specific code to parse a url...
|
||||||
virtual nsresult ParseUrl();
|
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)
|
// data retrieved from parsing the url: (Note the url could be a post from file or it could be inthe url)
|
||||||
char *m_toPart;
|
char *m_toPart;
|
||||||
|
@ -101,10 +100,7 @@ protected:
|
||||||
PRBool m_forcePlainText;
|
PRBool m_forcePlainText;
|
||||||
|
|
||||||
/* Smtp specific event sinks */
|
/* Smtp specific event sinks */
|
||||||
nsString m_userPassword;
|
nsCString m_userName;
|
||||||
char *m_userNameString; // char * version of m_userName
|
|
||||||
nsString m_userName;
|
|
||||||
|
|
||||||
nsFilePath m_fileName;
|
nsFilePath m_fileName;
|
||||||
|
|
||||||
// it is possible to encode the message to parse in the form of a url.
|
// 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;
|
readonly attribute nsIMsgDBHdr messageHeader;
|
||||||
attribute nsMsgKey messageKey;
|
attribute nsMsgKey messageKey;
|
||||||
attribute string newsgroupName;
|
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
|
// End nsINntpUrl specific support
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -55,6 +55,8 @@ public:
|
||||||
// this should be an IDL attribute
|
// this should be an IDL attribute
|
||||||
NS_IMETHOD SetNewsgroupName(char * aNewsgroupName);
|
NS_IMETHOD SetNewsgroupName(char * aNewsgroupName);
|
||||||
NS_IMETHOD GetNewsgroupName(char ** aNewsgroupName);
|
NS_IMETHOD GetNewsgroupName(char ** aNewsgroupName);
|
||||||
|
|
||||||
|
NS_IMETHOD SetUsername(const char *aUserName);
|
||||||
|
|
||||||
// from nsIMsgUriUrl
|
// from nsIMsgUriUrl
|
||||||
NS_IMETHOD GetURI(char ** aURI);
|
NS_IMETHOD GetURI(char ** aURI);
|
||||||
|
@ -67,8 +69,10 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsINNTPNewsgroupPost *m_newsgroupPost;
|
nsINNTPNewsgroupPost *m_newsgroupPost;
|
||||||
|
virtual const char * GetUserName() { return m_userName.GetBuffer();}
|
||||||
|
|
||||||
nsFileSpec *m_filePath;
|
nsFileSpec *m_filePath;
|
||||||
|
nsCString m_userName;
|
||||||
|
|
||||||
/* NNTP specific event sinks */
|
/* NNTP specific event sinks */
|
||||||
nsINNTPHost * m_newsHost;
|
nsINNTPHost * m_newsHost;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче