SetErrorMessage takes a const char *, stub out Set/GetErrorMessage

add accessors for nsIMsgStatusFeedback.
This commit is contained in:
mscott%netscape.com 1999-08-04 20:29:22 +00:00
Родитель 7b31aa58fa
Коммит af877474fd
2 изменённых файлов: 38 добавлений и 18 удалений

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

@ -123,26 +123,35 @@ nsresult nsMsgMailNewsUrl::UnRegisterListener (nsIUrlListener * aUrlListener)
return NS_OK;
}
nsresult nsMsgMailNewsUrl::SetErrorMessage (char * errorMessage)
nsresult nsMsgMailNewsUrl::SetErrorMessage (const char * errorMessage)
{
if (errorMessage)
{
PR_FREEIF(m_errorMessage);
m_errorMessage = errorMessage;
}
// functionality has been moved to nsIMsgStatusFeedback
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult nsMsgMailNewsUrl::GetErrorMessage (char ** errorMessage)
{
// functionality has been moved to nsIMsgStatusFeedback
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMsgMailNewsUrl::SetStatusFeedback(nsIMsgStatusFeedback *aMsgFeedback)
{
if (aMsgFeedback)
m_statusFeedback = aMsgFeedback; // don't ref count this...we don't own it
return NS_OK;
}
nsresult nsMsgMailNewsUrl::GetErrorMessage (char ** errorMessage) const
NS_IMETHODIMP nsMsgMailNewsUrl::GetStatusFeedback(nsIMsgStatusFeedback **aMsgFeedback)
{
if (errorMessage)
{
if (m_errorMessage)
*errorMessage = nsCRT::strdup(m_errorMessage);
else
*errorMessage = nsnull;
}
return NS_OK;
// note: it is okay to return a null status feedback and not return an error
// it's possible the url really doesn't have status feedback
nsresult rv = NS_OK;
if (aMsgFeedback)
*aMsgFeedback = m_statusFeedback;
else
rv = NS_ERROR_NULL_POINTER;
return rv;
}
////////////////////////////////////////////////////////////////////////////////////

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

@ -25,6 +25,7 @@
#include "nsIUrlListenerManager.h"
#include "nsCOMPtr.h"
#include "nsIMsgMailNewsUrl.h"
#include "nsIMsgStatusFeedback.h"
#include "nsIURL.h"
///////////////////////////////////////////////////////////////////////////////////
@ -57,9 +58,12 @@ public:
// Getters and Setters for the nsMsgMailNewsUrl specific info....
///////////////////////////////////////////////////////////////////////////////
NS_IMETHOD SetErrorMessage (char * errorMessage);
NS_IMETHOD SetErrorMessage (const char * errorMessage);
// caller must free using PR_FREE
NS_IMETHOD GetErrorMessage (char ** errorMessage) const;
NS_IMETHOD GetErrorMessage (char ** errorMessage);
NS_IMETHOD SetStatusFeedback(nsIMsgStatusFeedback *aMsgFeedback);
NS_IMETHOD GetStatusFeedback(nsIMsgStatusFeedback **aMsgFeedback);
// if you really want to know what the current state of the url is (running or not
// running) you should look into becoming a urlListener...
@ -122,8 +126,15 @@ protected:
virtual ~nsMsgMailNewsUrl();
nsCOMPtr<nsIURL> m_baseURL;
char *m_errorMessage;
// ownership model --> the status feedback has the same lifetime as the
// root webshell for the window. This has a life time greater than all
// mailnews urls running in that root window. So we should NOT own the status
// feedback object in the individual urls. Please don't change this to a com ptr
// without thinking long and hard about why you need to do it.
nsIMsgStatusFeedback * m_statusFeedback;
char *m_errorMessage;
PRBool m_runningUrl;
// manager of all of current url listeners....