add msgWindow param to verifyLogon, and return URL that gets run, r/sr=neil, 480026

This commit is contained in:
David Bienvenu 2009-03-02 13:09:13 -08:00
Родитель 75f060f374
Коммит ea361defd4
14 изменённых файлов: 88 добавлений и 49 удалений

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

@ -51,6 +51,7 @@ interface nsIMsgFilterPlugin;
interface nsIUrlListener;
interface nsIMsgDBHdr;
interface nsILocalFile;
interface nsIURI;
/*
* Interface for incoming mail/news host
@ -203,12 +204,13 @@ interface nsIMsgIncomingServer : nsISupports {
void setDefaultLocalPath(in nsILocalFile aDefaultLocalPath);
/**
* Verify that we can logon
* Verify that we can logon
*
* @param aUrlListener - gets called back with success or failure.
*
* @param aMsgWindow nsIMsgWindow to use for notification callbacks.
* @return - the url that we run.
*/
void verifyLogon(in nsIUrlListener aUrlListener);
nsIURI verifyLogon(in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow);
/* do a biff */
void performBiff(in nsIMsgWindow aMsgWindow);

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

@ -184,9 +184,9 @@ nsMsgIncomingServer::PerformExpand(nsIMsgWindow *aMsgWindow)
return NS_OK;
}
NS_IMETHODIMP
nsMsgIncomingServer::VerifyLogon(nsIUrlListener *aUrlListener)
nsMsgIncomingServer::VerifyLogon(nsIUrlListener *aUrlListener, nsIMsgWindow *aMsgWindow,
nsIURI **aURL)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

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

@ -40,6 +40,8 @@
interface nsIAuthPrompt;
interface nsIUrlListener;
interface nsIURI;
interface nsIMsgWindow;
/**
* This interface represents a single SMTP Server. A SMTP server instance may be
@ -48,7 +50,7 @@ interface nsIUrlListener;
* Most of the attributes will set/get preferences from the main preferences
* file.
*/
[scriptable, uuid(67725a6a-ddab-4fed-97f1-e58105c23c0e)]
[scriptable, uuid(cf300e82-9def-43b0-b663-be08437960eb)]
interface nsISmtpServer : nsISupports {
/// A unique identifier for the server.
@ -156,10 +158,10 @@ interface nsISmtpServer : nsISupports {
*
* @param aPassword - password to use
* @param aUrlListener - gets called back with success or failure.
* @return - the url that we run.
*
*/
void verifyLogon(in nsIUrlListener aUrlListener);
nsIURI verifyLogon(in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow);
/// Call this to clear all preference values for this server.
void clearAllValues();

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

@ -47,8 +47,9 @@ interface nsIFile;
interface nsIMsgStatusFeedback;
interface nsIRequest;
interface nsISimpleEnumerator;
interface nsIMsgWindow;
[scriptable, uuid(7b1c1604-7aad-451e-ae55-a7984c1fd0d9)]
[scriptable, uuid(8c5c5d5b-3b69-4a80-bf4b-d6c22865a3c3)]
interface nsISmtpService : nsISupports {
/**
* Sends a mail message via the given parameters. This function builds an
@ -100,8 +101,11 @@ interface nsISmtpService : nsISupports {
* @param aSmtpServer Server to try to logon to.
* @param aUrlListener Listener that will get notified whether logon
* was successful or not.
* @param aMsgWindow nsIMsgWindow to use for notification callbacks.
* @return - the url that we run.
*/
void verifyLogon(in nsISmtpServer aServer, in nsIUrlListener aListener);
nsIURI verifyLogon(in nsISmtpServer aServer, in nsIUrlListener aListener,
in nsIMsgWindow aMsgWindow);
/**
* Return the SMTP server that is associated with an identity.

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

@ -415,12 +415,13 @@ nsSmtpServer::GetPassword(nsACString& aPassword)
}
NS_IMETHODIMP
nsSmtpServer::VerifyLogon(nsIUrlListener *aUrlListener)
nsSmtpServer::VerifyLogon(nsIUrlListener *aUrlListener, nsIMsgWindow *aMsgWindow,
nsIURI **aURL)
{
nsresult rv;
nsCOMPtr<nsISmtpService> smtpService(do_GetService(NS_SMTPSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
return smtpService->VerifyLogon(this, aUrlListener);
return smtpService->VerifyLogon(this, aUrlListener, aMsgWindow, aURL);
}

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

@ -242,7 +242,7 @@ nsresult NS_MsgLoadSmtpUrl(nsIURI * aUrl, nsISupports * aConsumer, nsIRequest **
{
// for now, assume the url is an smtp url and load it....
nsCOMPtr <nsISmtpUrl> smtpUrl;
nsSmtpProtocol *smtpProtocol = nsnull;
nsSmtpProtocol *smtpProtocol = nsnull;
nsresult rv = NS_OK;
if (!aUrl)
@ -267,7 +267,9 @@ nsresult NS_MsgLoadSmtpUrl(nsIURI * aUrl, nsISupports * aConsumer, nsIRequest **
}
NS_IMETHODIMP nsSmtpService::VerifyLogon(nsISmtpServer *aServer,
nsIUrlListener *aUrlListener)
nsIUrlListener *aUrlListener,
nsIMsgWindow *aMsgWindow,
nsIURI **aURL)
{
NS_ENSURE_ARG_POINTER(aServer);
nsCString popHost;
@ -275,10 +277,17 @@ NS_IMETHODIMP nsSmtpService::VerifyLogon(nsISmtpServer *aServer,
nsCOMPtr <nsIURI> urlToRun;
nsresult rv = NS_MsgBuildSmtpUrl(nsnull, aServer,
nsnull, nsnull, aUrlListener, nsnull,
nsnull, nsnull, aUrlListener, nsnull,
nsnull , getter_AddRefs(urlToRun), PR_FALSE);
if (NS_SUCCEEDED(rv) && urlToRun)
if (NS_SUCCEEDED(rv) && urlToRun)
{
nsCOMPtr<nsIMsgMailNewsUrl> url(do_QueryInterface(urlToRun, &rv));
NS_ENSURE_SUCCESS(rv, rv);
url->SetMsgWindow(aMsgWindow);
rv = NS_MsgLoadSmtpUrl(urlToRun, nsnull, nsnull /* aRequest */);
if (aURL)
urlToRun.forget(aURL);
}
return rv;
}

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

@ -58,7 +58,7 @@ interface nsIMsgWindow;
interface nsIImapIncomingServer;
interface nsICacheSession;
[scriptable, uuid(a12113ff-0cc4-41ba-ae98-fe31cf2411ce)]
[scriptable, uuid(9308fe9b-bc6c-4e5a-93a8-a8f7d4d75ba1)]
interface nsIImapService : nsISupports
{
// You can pass in null for the url listener and the url if you don't require either.....
@ -117,10 +117,19 @@ interface nsIImapService : nsISupports
in nsIMsgFolder aImapMailFolder,
in nsIUrlListener aUrlListener);
void verifyLogon(in nsIMsgFolder aImapMailFolder,
in nsIUrlListener aUrlListener);
/**
* Verify that we can login.
*
* @param aImapMailFolder - any old imap folder - we just need it to
* set url sinks.
* @param aMsgWindow - nsIMsgWindow to use for notification callbacks.
* @return - the url that we run.
*/
nsIURI verifyLogon(in nsIMsgFolder aImapMailFolder,
in nsIUrlListener aUrlListener,
in nsIMsgWindow aMsgWindow);
void biff(in nsIEventTarget aClientEventTarget,
void biff(in nsIEventTarget aClientEventTarget,
in nsIMsgFolder aImapMailFolder,
in nsIUrlListener aUrlListener,
out nsIURI aURL,

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

@ -933,7 +933,8 @@ nsImapIncomingServer::PerformExpand(nsIMsgWindow *aMsgWindow)
}
NS_IMETHODIMP
nsImapIncomingServer::VerifyLogon(nsIUrlListener *aUrlListener)
nsImapIncomingServer::VerifyLogon(nsIUrlListener *aUrlListener,
nsIMsgWindow *aMsgWindow, nsIURI **aURL)
{
nsresult rv;
@ -944,10 +945,9 @@ nsImapIncomingServer::VerifyLogon(nsIUrlListener *aUrlListener)
// do anything on disk.
rv = GetRootFolder(getter_AddRefs(rootFolder));
NS_ENSURE_SUCCESS(rv, rv);
return imapService->VerifyLogon(rootFolder, aUrlListener);
return imapService->VerifyLogon(rootFolder, aUrlListener, aMsgWindow, aURL);
}
NS_IMETHODIMP nsImapIncomingServer::PerformBiff(nsIMsgWindow* aMsgWindow)
{
nsCOMPtr<nsIMsgFolder> rootMsgFolder;

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

@ -97,7 +97,8 @@ public:
NS_IMETHOD ForgetSessionPassword();
NS_IMETHOD GetMsgFolderFromURI(nsIMsgFolder *aFolderResource, const nsACString& aURI, nsIMsgFolder **aFolder);
NS_IMETHOD SetSocketType(PRInt32 aSocketType);
NS_IMETHOD VerifyLogon(nsIUrlListener *aUrlListener);
NS_IMETHOD VerifyLogon(nsIUrlListener *aUrlListener, nsIMsgWindow *aMsgWindow,
nsIURI **aURL);
protected:
nsresult GetFolder(const nsACString& name, nsIMsgFolder** pFolder);

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

@ -1503,31 +1503,33 @@ nsresult nsImapService::FolderCommand(nsIEventTarget *clientEventTarget,
}
NS_IMETHODIMP
nsImapService::VerifyLogon(nsIMsgFolder *aFolder, nsIUrlListener *aUrlListener)
nsImapService::VerifyLogon(nsIMsgFolder *aFolder, nsIUrlListener *aUrlListener,
nsIMsgWindow *aMsgWindow, nsIURI **aURL)
{
nsCOMPtr<nsIImapUrl> aImapUrl;
nsCOMPtr<nsIImapUrl> imapUrl;
nsCAutoString urlSpec;
PRUnichar delimiter = '/'; // shouldn't matter what is is.
nsresult rv = CreateStartOfImapUrl(EmptyCString(), getter_AddRefs(aImapUrl), aFolder,
nsresult rv = CreateStartOfImapUrl(EmptyCString(), getter_AddRefs(imapUrl), aFolder,
aUrlListener, urlSpec, delimiter);
if (NS_SUCCEEDED(rv) && aImapUrl)
if (NS_SUCCEEDED(rv) && imapUrl)
{
nsCOMPtr<nsIURI> uri = do_QueryInterface(aImapUrl);
nsCOMPtr<nsIMsgMailNewsUrl> mailNewsUrl = do_QueryInterface(aImapUrl);
nsCOMPtr<nsIURI> uri = do_QueryInterface(imapUrl);
nsCOMPtr<nsIMsgMailNewsUrl> mailNewsUrl = do_QueryInterface(imapUrl);
mailNewsUrl->SetSuppressErrorMsgs(PR_TRUE);
rv = SetImapUrlSink(aFolder, aImapUrl);
mailNewsUrl->SetMsgWindow(aMsgWindow);
rv = SetImapUrlSink(aFolder, imapUrl);
urlSpec.Append("/verifyLogon");
rv = uri->SetSpec(urlSpec);
if (NS_SUCCEEDED(rv))
rv = GetImapConnectionAndLoadUrl(NS_GetCurrentThread(), aImapUrl, nsnull, nsnull);
rv = GetImapConnectionAndLoadUrl(NS_GetCurrentThread(), imapUrl, nsnull, nsnull);
if (aURL)
uri.forget(aURL);
}
return rv;
}
// Noop, used to update a folder (causes server to send changes).
NS_IMETHODIMP nsImapService::Noop(nsIEventTarget *aClientEventTarget,
nsIMsgFolder *aImapMailFolder,

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

@ -47,9 +47,9 @@ interface nsIMsgFolder;
/*
* The Pop3 Service is an interface designed to make building and running
* pop3 urls easier.
* pop3 urls easier.
*/
[scriptable, uuid(d3b0eead-a0aa-47bd-a751-aa01e01c1ff7)]
[scriptable, uuid(b6594f64-4f9d-4655-9e96-ed927823fb73)]
interface nsIPop3Service : nsISupports {
/*
* All of these functions build pop3 urls and run them. If you want
@ -74,14 +74,15 @@ interface nsIPop3Service : nsISupports {
in nsIMsgFolder inbox, in nsIPop3IncomingServer popServer);
/**
* Verify that we can logon
*
* Verify that we can logon
*
* @param aServer - pop3 server we're logging on to.
* @param aUrlListener - gets called back with success or failure.
* @param aMsgWindow - nsIMsgWindow to use for notification callbacks.
* @return - the url that we run.
*
*/
void verifyLogon(in nsIMsgIncomingServer aServer,
in nsIUrlListener aUrlListener);
nsIURI verifyLogon(in nsIMsgIncomingServer aServer,
in nsIUrlListener aUrlListener,
in nsIMsgWindow aMsgWindow);
};

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

@ -418,12 +418,13 @@ nsPop3IncomingServer::GetCanCreateFoldersOnServer(PRBool *aCanCreateFoldersOnSer
}
NS_IMETHODIMP
nsPop3IncomingServer::VerifyLogon(nsIUrlListener *aUrlListener)
nsPop3IncomingServer::VerifyLogon(nsIUrlListener *aUrlListener,
nsIMsgWindow *aMsgWindow, nsIURI **aURL)
{
nsresult rv;
nsCOMPtr<nsIPop3Service> pop3Service = do_GetService(kCPop3ServiceCID, &rv);
NS_ENSURE_SUCCESS(rv,rv);
return pop3Service->VerifyLogon(this, aUrlListener);
return pop3Service->VerifyLogon(this, aUrlListener, aMsgWindow, aURL);
}
NS_IMETHODIMP nsPop3IncomingServer::DownloadMailFromServers(nsISupportsArray *aServers,

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

@ -68,7 +68,8 @@ public:
NS_IMETHOD GetRootMsgFolder(nsIMsgFolder **aRootMsgFolder);
NS_IMETHOD GetCanFileMessagesOnServer(PRBool *aCanFileMessagesOnServer);
NS_IMETHOD GetCanCreateFoldersOnServer(PRBool *aCanCreateFoldersOnServer);
NS_IMETHOD VerifyLogon(nsIUrlListener *aUrlListener);
NS_IMETHOD VerifyLogon(nsIUrlListener *aUrlListener, nsIMsgWindow *aMsgWindow,
nsIURI **aURL);
NS_IMETHOD GetNewMessages(nsIMsgFolder *aFolder, nsIMsgWindow *aMsgWindow,
nsIUrlListener *aUrlListener);

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

@ -170,7 +170,9 @@ nsresult nsPop3Service::GetMail(PRBool downloadNewMail,
}
NS_IMETHODIMP nsPop3Service::VerifyLogon(nsIMsgIncomingServer *aServer,
nsIUrlListener *aUrlListener)
nsIUrlListener *aUrlListener,
nsIMsgWindow *aMsgWindow,
nsIURI **aURL)
{
NS_ENSURE_ARG_POINTER(aServer);
nsCString popHost;
@ -204,11 +206,15 @@ NS_IMETHODIMP nsPop3Service::VerifyLogon(nsIMsgIncomingServer *aServer,
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIURI> url;
rv = BuildPop3Url(urlSpec, nsnull, popServer, aUrlListener,
getter_AddRefs(url), nsnull);
getter_AddRefs(url), aMsgWindow);
PR_smprintf_free(urlSpec);
if (NS_SUCCEEDED(rv) && url)
{
rv = RunPopUrl(aServer, url);
if (NS_SUCCEEDED(rv) && aURL)
url.forget(aURL);
}
return rv;
}