mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 09:45:41 +00:00
add get server support.
This commit is contained in:
parent
264a90f371
commit
e79d4ee94c
@ -21,6 +21,7 @@
|
||||
|
||||
interface nsIUrlListener;
|
||||
interface nsIMsgStatusFeedback;
|
||||
interface nsIMsgIncomingServer;
|
||||
|
||||
[scriptable, uuid(6CFFCEB0-CB8C-11d2-8065-006008128C4E)]
|
||||
interface nsIMsgMailNewsUrl : nsIURL {
|
||||
@ -43,6 +44,8 @@ interface nsIMsgMailNewsUrl : nsIURL {
|
||||
void SetUrlState(in boolean runningUrl, in nsresult aStatusCode);
|
||||
void GetUrlState(out boolean runningUrl);
|
||||
|
||||
void GetServer(out nsIMsgIncomingServer aIncomingServer);
|
||||
|
||||
// the ownership model for msg feedback
|
||||
void SetStatusFeedback(in nsIMsgStatusFeedback aMsgFeedback);
|
||||
void GetStatusFeedback(out nsIMsgStatusFeedback aMsgFeedback);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "nsMsgMailNewsUrl.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsIMsgMailSession.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
static NS_DEFINE_CID(kUrlListenerManagerCID, NS_URLLISTENERMANAGER_CID);
|
||||
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
|
||||
@ -150,6 +151,37 @@ nsresult nsMsgMailNewsUrl::GetErrorMessage (char ** errorMessage)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailNewsUrl::GetServer(nsIMsgIncomingServer ** aIncomingServer)
|
||||
{
|
||||
// mscott --> we could cache a copy of the server here....but if we did, we run
|
||||
// the risk of leaking the server if any single url gets leaked....of course that
|
||||
// shouldn't happen...but it could. so i'm going to look it up every time and
|
||||
// we can look at caching it later.
|
||||
|
||||
nsXPIDLCString host;
|
||||
nsXPIDLCString scheme;
|
||||
|
||||
nsresult rv = GetHost(getter_Copies(host));
|
||||
rv = GetScheme(getter_Copies(scheme));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, session, kMsgMailSessionCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager;
|
||||
rv = session->GetAccountManager(getter_AddRefs(accountManager));
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = accountManager->FindServer(GetUserName(),
|
||||
host,
|
||||
scheme,
|
||||
aIncomingServer);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailNewsUrl::SetStatusFeedback(nsIMsgStatusFeedback *aMsgFeedback)
|
||||
{
|
||||
if (aMsgFeedback)
|
||||
|
@ -65,6 +65,10 @@ public:
|
||||
NS_IMETHOD SetStatusFeedback(nsIMsgStatusFeedback *aMsgFeedback);
|
||||
NS_IMETHOD GetStatusFeedback(nsIMsgStatusFeedback **aMsgFeedback);
|
||||
|
||||
// This is just a stub implementation. It is the responsibility of derived
|
||||
// url classes to over-ride this method.
|
||||
NS_IMETHOD GetServer(nsIMsgIncomingServer ** aIncomingServer);
|
||||
|
||||
// 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...
|
||||
NS_IMETHOD SetUrlState(PRBool runningUrl, nsresult aStatusCode);
|
||||
@ -125,6 +129,9 @@ public:
|
||||
protected:
|
||||
virtual ~nsMsgMailNewsUrl();
|
||||
|
||||
// a helper function I needed from derived urls...
|
||||
virtual const char * GetUserName() = 0;
|
||||
|
||||
nsCOMPtr<nsIURL> m_baseURL;
|
||||
nsCOMPtr<nsIMsgStatusFeedback> m_statusFeedback;
|
||||
char *m_errorMessage;
|
||||
|
Loading…
Reference in New Issue
Block a user