зеркало из https://github.com/mozilla/gecko-dev.git
Update to latest version of nsIMsgMailNewsUrl which includes url listener registration and notification stuff.
This commit is contained in:
Родитель
6d41f9179c
Коммит
34eb2167dd
|
@ -33,6 +33,7 @@
|
|||
// that doesn't allow you to call ::nsISupports::IID() inside of a class
|
||||
// that multiply inherits from nsISupports
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_CID(kUrlListenerManagerCID, NS_URLLISTENERMANAGER_CID);
|
||||
|
||||
nsSmtpUrl::nsSmtpUrl(nsISupports* aContainer, nsIURLGroup* aGroup) : m_fileName(""), m_userName(""), m_userPassword("")
|
||||
{
|
||||
|
@ -71,6 +72,9 @@ nsSmtpUrl::nsSmtpUrl(nsISupports* aContainer, nsIURLGroup* aGroup) : m_fileName(
|
|||
m_errorMessage = nsnull;
|
||||
m_runningUrl = PR_FALSE;
|
||||
|
||||
nsServiceManager::GetService(kUrlListenerManagerCID, nsIUrlListenerManager::IID(),
|
||||
(nsISupports **)&m_urlListeners);
|
||||
|
||||
m_container = aContainer;
|
||||
NS_IF_ADDREF(m_container);
|
||||
// ParseURL(aSpec, aURL); // XXX whh
|
||||
|
@ -80,6 +84,8 @@ nsSmtpUrl::~nsSmtpUrl()
|
|||
{
|
||||
CleanupSmtpState();
|
||||
|
||||
NS_IF_RELEASE(m_urlListeners);
|
||||
|
||||
NS_IF_RELEASE(m_container);
|
||||
PR_FREEIF(m_errorMessage);
|
||||
|
||||
|
@ -124,6 +130,13 @@ nsresult nsSmtpUrl::QueryInterface(const nsIID &aIID, void** aInstancePtr)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aIID.Equals(nsIMsgMailNewsUrl::IID()))
|
||||
{
|
||||
*aInstancePtr = (void *) ((nsIMsgMailNewsUrl*) this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if defined(NS_DEBUG)
|
||||
/*
|
||||
* Check for the debug-only interface indicating thread-safety
|
||||
|
@ -139,8 +152,45 @@ nsresult nsSmtpUrl::QueryInterface(const nsIID &aIID, void** aInstancePtr)
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
// Begin nsISmtpUrl specific support
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult nsSmtpUrl::GetUrlState(PRBool * aRunningUrl)
|
||||
{
|
||||
if (aRunningUrl)
|
||||
*aRunningUrl = m_runningUrl;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsSmtpUrl::SetUrlState(PRBool aRunningUrl, nsresult aExitCode)
|
||||
{
|
||||
m_runningUrl = aRunningUrl;
|
||||
if (m_urlListeners)
|
||||
{
|
||||
if (m_runningUrl)
|
||||
m_urlListeners->OnStartRunningUrl(this);
|
||||
else
|
||||
m_urlListeners->OnStopRunningUrl(this, aExitCode);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsSmtpUrl::RegisterListener (nsIUrlListener * aUrlListener)
|
||||
{
|
||||
if (m_urlListeners)
|
||||
m_urlListeners->RegisterListener(aUrlListener);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsSmtpUrl::UnRegisterListener (nsIUrlListener * aUrlListener)
|
||||
{
|
||||
if (m_urlListeners)
|
||||
m_urlListeners->UnRegisterListener(aUrlListener);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsSmtpUrl::SetErrorMessage (char * errorMessage)
|
||||
{
|
||||
NS_LOCK_INSTANCE();
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "nsISmtpUrl.h"
|
||||
#include "nsINetlibURL.h" /* this should be temporary until Network N2 project lands */
|
||||
#include "nsIUrlListenerManager.h"
|
||||
|
||||
class nsSmtpUrl : public nsISmtpUrl, public nsINetlibURL
|
||||
{
|
||||
|
@ -56,7 +57,8 @@ public:
|
|||
NS_IMETHOD GetServerStatus(PRInt32 *status); // make obsolete
|
||||
NS_IMETHOD ToString(PRUnichar* *aString) const;
|
||||
|
||||
NS_IMPL_CLASS_GETSET(RunningUrlFlag, PRBool, m_runningUrl);
|
||||
NS_IMETHOD SetUrlState(PRBool aRunningUrl, nsresult aStatusCode);
|
||||
NS_IMETHOD GetUrlState(PRBool * aRunningUrl);
|
||||
|
||||
// from nsINetlibURL:
|
||||
|
||||
|
@ -103,15 +105,14 @@ public:
|
|||
NS_IMETHOD GetUserPassword(const nsString ** aUserPassword);
|
||||
NS_IMETHOD SetUserPassword(const nsString& aUserPassword);
|
||||
|
||||
// mscott: this interface really belongs in nsIURL and I will move it there after talking
|
||||
// it over with core netlib. This error message replaces the err_msg which was in the
|
||||
// old URL_struct. Also, it should probably be a nsString or a PRUnichar *. I don't know what
|
||||
// XP_GetString is going to return in mozilla.
|
||||
|
||||
// nsIMsgMailNewsUrl
|
||||
NS_IMETHOD SetErrorMessage (char * errorMessage);
|
||||
// caller must free using PR_FREE
|
||||
NS_IMETHOD GetErrorMessage (char ** errorMessage) const;
|
||||
|
||||
NS_IMETHOD RegisterListener (nsIUrlListener * aUrlListener);
|
||||
NS_IMETHOD UnRegisterListener (nsIUrlListener * aUrlListener);
|
||||
|
||||
// nsSmtpUrl
|
||||
|
||||
nsSmtpUrl(nsISupports* aContainer, nsIURLGroup* aGroup);
|
||||
|
@ -158,6 +159,9 @@ protected:
|
|||
PRInt32 m_port;
|
||||
nsISupports* m_container;
|
||||
|
||||
// manager of all of current url listeners....
|
||||
nsIUrlListenerManager * m_urlListeners;
|
||||
|
||||
/* Smtp specific event sinks */
|
||||
nsString m_userPassword;
|
||||
char *m_userNameString; // char * version of m_userName
|
||||
|
|
Загрузка…
Ссылка в новой задаче