b=52330 r=bienvenu sr=brendan a=dbaron

Support non-default SMTP Port
checking in for kye@gmx.de
This commit is contained in:
kaie%netscape.com 2002-03-18 04:29:17 +00:00
Родитель a8c4acc223
Коммит 6d50f9823c
11 изменённых файлов: 269 добавлений и 136 удалений

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

@ -178,6 +178,10 @@ function createSmtpTreeItem(server, isDefault)
var treecell = document.createElement("treecell");
var hostname = server.hostname;
if (server.port) {
hostname = hostname + ":" + server.port;
}
if (isDefault)
hostname += " " + gMessengerBundle.getString("defaultServerTag");

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

@ -43,6 +43,7 @@
var gSmtpUsername;
var gSmtpUsernameLabel;
var gSmtpHostname;
var gSmtpPort;
var gSmtpUseUsername;
var gSmtpAuthMethod;
var gSmtpTrySSL;
@ -54,12 +55,14 @@ function initSmtpSettings(server) {
gSmtpUsername = document.getElementById("smtp.username");
gSmtpUsernameLabel = document.getElementById("smtpusernamelabel");
gSmtpHostname = document.getElementById("smtp.hostname");
gSmtpPort = document.getElementById("smtp.port");
gSmtpUseUsername = document.getElementById("smtp.useUsername");
gSmtpAuthMethod = document.getElementById("smtp.authMethod");
gSmtpTrySSL = document.getElementById("smtp.trySSL");
if (server) {
gSmtpHostname.value = server.hostname;
gSmtpPort.value = server.port ? server.port : "";
gSmtpUsername.value = server.username;
gSmtpAuthMethod.setAttribute("value", server.authMethod);
@ -94,6 +97,7 @@ function saveSmtpSettings(server)
//dump("Saving to " + server + "\n");
if (server) {
server.hostname = gSmtpHostname.value;
server.port = gSmtpPort.value;
server.authMethod = (gSmtpUseUsername.checked ? 1 : 0);
//dump("Saved authmethod = " + server.authMethod +
// " but checked = " + gSmtpUseUsername.checked + "\n");

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

@ -32,12 +32,30 @@
<script src="smtpEditOverlay.js"/>
<vbox id="smtpServerEditor">
<hbox align="center">
<label value="&serverName.label;"/>
<textbox id="smtp.hostname" flex="1"
preftype="string"
prefstring="mail.smtpserver.%serverkey%.hostname"/>
</hbox>
<grid>
<columns>
<column/>
<column/>
</columns>
<rows>
<row align = "center">
<label value="&serverName.label;"/>
<textbox id="smtp.hostname" flex="1"
preftype="string"
prefstring="mail.smtpserver.%serverkey%.hostname"/>
</row>
<row align="center">
<hbox align="center">
<label value="&serverPort.label;"/>
</hbox>
<hbox align="center">
<textbox id="smtp.port" size="5"
preftype="int"
prefstring="mail.smtpserver.%serverkey%.port"/>
</hbox>
</row>
</rows>
</grid>
<!-- use a grid here when it's implemented -->
<vbox>
<!-- This hidden one will hold the integer version

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

@ -1,4 +1,5 @@
<!ENTITY serverName.label "Server Name:">
<!ENTITY serverPort.label "Port:">
<!ENTITY alwaysUseUsername.label "Use name and password">
<!ENTITY userName.label "User Name:">
<!ENTITY savePassword.label "Save my password">

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

@ -28,8 +28,10 @@ interface nsISmtpServer : nsISupports {
attribute string key; // unique identifier
attribute string hostname;
attribute PRInt32 port;
attribute string username;
attribute string password;
readonly attribute string displayname;
/* what kind of logon redirector to use for this server, if any */
attribute string redirectorType;

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

@ -37,11 +37,6 @@
#include "nsISupports.idl"
%{ C++
#define SMTP_PORT 25
%}
interface nsIMsgIdentity;
interface nsIPrompt;
interface nsIAuthPrompt;
@ -85,6 +80,8 @@ interface nsISmtpUrl : nsISupports {
attribute nsIAuthPrompt authPrompt;
attribute nsIInterfaceRequestor notificationCallbacks;
attribute nsISmtpServer smtpServer;
const PRInt32 DEFAULT_SMTP_PORT = 25;
};
[scriptable, uuid(5EE2AFF7-9C6F-11d3-98A3-001083010E9B)]

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

@ -154,7 +154,7 @@ nsSmtpDataSource::GetTarget(nsIRDFResource *aSource,
aProperty == kNC_Key.get()) {
if (aProperty == kNC_Name.get()) {
smtpServer->GetHostname(getter_Copies(str));
smtpServer->GetDisplayname(getter_Copies(str));
} else if (aProperty == kNC_Key.get()) {
smtpServer->GetKey(getter_Copies(str));
}

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

@ -256,7 +256,6 @@ void nsSmtpProtocol::Initialize(nsIURI * aURL)
m_prefAuthMethod = PREF_AUTH_NONE;
m_usernamePrompted = PR_FALSE;
m_prefTrySSL = PREF_SSL_TRY;
m_port = SMTP_PORT;
m_tlsInitiated = PR_FALSE;
m_urlErrorState = NS_ERROR_FAILURE;
@ -301,7 +300,7 @@ void nsSmtpProtocol::Initialize(nsIURI * aURL)
smtpServer->GetAuthMethod(&m_prefAuthMethod);
smtpServer->GetTrySSL(&m_prefTrySSL);
}
rv = RequestOverrideInfo(smtpServer);
// if we aren't waiting for a login override, then go ahead an
// open the network connection like we normally would have.

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

@ -161,7 +161,6 @@ private:
PRInt32 m_previousResponseCode;
PRInt32 m_continuationResponse;
nsCString m_responseText; /* text returned from Smtp server */
PRUint32 m_port;
char *m_addressCopy;
char *m_addresses;

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

@ -44,6 +44,7 @@
#include "nsIAuthPrompt.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsISmtpUrl.h"
NS_IMPL_ADDREF(nsSmtpServer)
NS_IMPL_RELEASE(nsSmtpServer)
@ -85,10 +86,14 @@ nsSmtpServer::GetHostname(char * *aHostname)
{
nsresult rv;
nsCAutoString pref;
NS_ENSURE_ARG_POINTER(aHostname);
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
getPrefString("hostname", pref);
rv = prefs->CopyCharPref(pref.get(), aHostname);
if (NS_FAILED(rv)) *aHostname=nsnull;
if (NS_FAILED(rv))
*aHostname=nsnull;
return NS_OK;
}
@ -98,6 +103,8 @@ nsSmtpServer::SetHostname(const char * aHostname)
nsresult rv;
nsCAutoString pref;
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
getPrefString("hostname", pref);
if (aHostname)
return prefs->SetCharPref(pref.get(), aHostname);
@ -106,6 +113,80 @@ nsSmtpServer::SetHostname(const char * aHostname)
return NS_OK;
}
// if GetPort returns 0, it means default port
NS_IMETHODIMP
nsSmtpServer::GetPort(PRInt32 *aPort)
{
nsresult rv;
nsCAutoString pref;
NS_ENSURE_ARG_POINTER(aPort);
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
getPrefString("port", pref);
rv = prefs->GetIntPref(pref.get(), aPort);
if (NS_FAILED(rv))
*aPort = 0;
return NS_OK;
}
NS_IMETHODIMP
nsSmtpServer::SetPort(PRInt32 aPort)
{
nsresult rv;
nsCAutoString pref;
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
getPrefString("port", pref);
if (aPort)
return prefs->SetIntPref(pref.get(), aPort);
else
prefs->ClearUserPref(pref.get());
return NS_OK;
}
NS_IMETHODIMP
nsSmtpServer::GetDisplayname(char * *aDisplayname)
{
nsresult rv;
NS_ENSURE_ARG_POINTER(aDisplayname);
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
nsCAutoString hpref;
getPrefString("hostname", hpref);
nsCAutoString ppref;
getPrefString("port", ppref);
nsXPIDLCString hostname;
rv = prefs->CopyCharPref(hpref.get(), getter_Copies(hostname));
if (NS_FAILED(rv)) {
*aDisplayname=nsnull;
return NS_OK;
}
PRInt32 port;
rv = prefs->GetIntPref(ppref.get(), &port);
if (NS_FAILED(rv))
port = 0;
if (port) {
nsCAutoString combined;
combined = hostname.get();
combined += ":";
combined.AppendInt(port);
*aDisplayname = ToNewCString(combined);
}
else {
*aDisplayname = ToNewCString(hostname);
}
return NS_OK;
}
NS_IMETHODIMP
nsSmtpServer::GetTrySSL(PRInt32 *trySSL)
{
@ -118,7 +199,7 @@ nsSmtpServer::GetTrySSL(PRInt32 *trySSL)
getPrefString("try_ssl", pref);
rv = prefs->GetIntPref(pref.get(), trySSL);
if (NS_FAILED(rv))
rv = getDefaultIntPref(prefs, 0, "try_ssl", trySSL);
getDefaultIntPref(prefs, 0, "try_ssl", trySSL);
return NS_OK;
}
@ -128,7 +209,8 @@ nsSmtpServer::SetTrySSL(PRInt32 trySSL)
nsresult rv;
nsCAutoString pref;
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv))
return rv;
getPrefString("try_ssl", pref);
return prefs->SetIntPref(pref.get(), trySSL);
}
@ -140,20 +222,21 @@ nsSmtpServer::GetAuthMethod(PRInt32 *authMethod)
nsCAutoString pref;
NS_ENSURE_ARG_POINTER(authMethod);
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv))
return rv;
*authMethod = 1;
getPrefString("auth_method", pref);
rv = prefs->GetIntPref(pref.get(), authMethod);
if (NS_FAILED(rv))
rv = getDefaultIntPref(prefs, 1, "auth_method", authMethod);
rv = getDefaultIntPref(prefs, 1, "auth_method", authMethod);
return rv;
}
nsresult
nsSmtpServer::getDefaultIntPref(nsIPref *prefs,
PRInt32 defVal,
const char *prefName,
PRInt32 *val)
PRInt32 defVal,
const char *prefName,
PRInt32 *val)
{
// mail.smtpserver.default.<prefName>
nsCAutoString fullPrefName;
@ -164,9 +247,8 @@ nsSmtpServer::getDefaultIntPref(nsIPref *prefs,
if (NS_FAILED(rv))
{ // last resort
*val = defVal;
rv = NS_OK;
}
return rv;
return NS_OK;
}
NS_IMETHODIMP
@ -185,10 +267,14 @@ nsSmtpServer::GetUsername(char * *aUsername)
{
nsresult rv;
nsCAutoString pref;
NS_ENSURE_ARG_POINTER(aUsername);
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
getPrefString("username", pref);
rv = prefs->CopyCharPref(pref.get(), aUsername);
if (NS_FAILED(rv)) *aUsername = nsnull;
if (NS_FAILED(rv))
*aUsername = nsnull;
return NS_OK;
}
@ -198,6 +284,8 @@ nsSmtpServer::SetUsername(const char * aUsername)
nsresult rv;
nsCAutoString pref;
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
getPrefString("username", pref);
if (aUsername)
return prefs->SetCharPref(pref.get(), aUsername);
@ -210,15 +298,15 @@ NS_IMETHODIMP
nsSmtpServer::GetPassword(char * *aPassword)
{
NS_ENSURE_ARG_POINTER(aPassword);
*aPassword = ToNewCString(m_password);
*aPassword = ToNewCString(m_password);
return NS_OK;
}
NS_IMETHODIMP
nsSmtpServer::SetPassword(const char * aPassword)
{
m_password = aPassword;
return NS_OK;
m_password = aPassword;
return NS_OK;
}
NS_IMETHODIMP
@ -231,38 +319,42 @@ nsSmtpServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
NS_ENSURE_ARG_POINTER(aPassword);
if (m_password.IsEmpty()) {
if (m_password.IsEmpty())
{
NS_ENSURE_ARG_POINTER(aDialog);
// prompt the user for the password
if (NS_SUCCEEDED(rv))
{
// prompt the user for the password
if (NS_SUCCEEDED(rv))
{
nsXPIDLString uniPassword;
PRBool okayValue = PR_TRUE;
nsXPIDLCString serverUri;
rv = GetServerURI(getter_Copies(serverUri));
if (NS_FAILED(rv)) return rv;
rv = aDialog->PromptPassword(aPromptTitle, aPromptMessage,
NS_ConvertASCIItoUCS2(serverUri).get(), nsIAuthPrompt::SAVE_PASSWORD_PERMANENTLY,
getter_Copies(uniPassword), &okayValue);
if (NS_FAILED(rv)) return rv;
if (!okayValue) // if the user pressed cancel, just return NULL;
{
*aPassword = nsnull;
return rv;
}
PRBool okayValue = PR_TRUE;
nsXPIDLCString serverUri;
rv = GetServerURI(getter_Copies(serverUri));
if (NS_FAILED(rv))
return rv;
rv = aDialog->PromptPassword(aPromptTitle, aPromptMessage,
NS_ConvertASCIItoUCS2(serverUri).get(), nsIAuthPrompt::SAVE_PASSWORD_PERMANENTLY,
getter_Copies(uniPassword), &okayValue);
if (NS_FAILED(rv))
return rv;
// we got a password back...so remember it
nsCString aCStr; aCStr.AssignWithConversion(uniPassword);
if (!okayValue) // if the user pressed cancel, just return NULL;
{
*aPassword = nsnull;
return rv;
}
rv = SetPassword(aCStr.get());
if (NS_FAILED(rv)) return rv;
} // if we got a prompt dialog
} // if the password is empty
// we got a password back...so remember it
nsCString aCStr; aCStr.AssignWithConversion(uniPassword);
rv = SetPassword(aCStr.get());
if (NS_FAILED(rv))
return rv;
} // if we got a prompt dialog
} // if the password is empty
rv = GetPassword(aPassword);
return rv;
return rv;
}
NS_IMETHODIMP
@ -288,11 +380,13 @@ nsSmtpServer::GetUsernamePasswordWithUI(const PRUnichar * aPromptMessage, const
PRBool okayValue = PR_TRUE;
nsXPIDLCString serverUri;
rv = GetServerURI(getter_Copies(serverUri));
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv))
return rv;
rv = aDialog->PromptUsernameAndPassword(aPromptTitle, aPromptMessage,
NS_ConvertASCIItoUCS2(serverUri).get(), nsIAuthPrompt::SAVE_PASSWORD_PERMANENTLY,
getter_Copies(uniUsername), getter_Copies(uniPassword), &okayValue);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv))
return rv;
if (!okayValue) // if the user pressed cancel, just return NULL;
{
@ -306,16 +400,19 @@ nsSmtpServer::GetUsernamePasswordWithUI(const PRUnichar * aPromptMessage, const
aCStr.AssignWithConversion(uniUsername);
rv = SetUsername(aCStr.get());
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv))
return rv;
aCStr.AssignWithConversion(uniPassword);
rv = SetPassword(aCStr.get());
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv))
return rv;
} // if we got a prompt dialog
} // if the password is empty
rv = GetUsername(aUsername);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv))
return rv;
rv = GetPassword(aPassword);
return rv;
}
@ -329,7 +426,8 @@ nsSmtpServer::ForgetPassword()
nsXPIDLCString serverUri;
rv = GetServerURI(getter_Copies(serverUri));
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), serverUri);
@ -395,6 +493,8 @@ nsSmtpServer::SetRedirectorType(const char *aRedirectorType)
nsresult rv;
nsCAutoString pref;
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
getPrefString("redirector_type", pref);
if (aRedirectorType)
return prefs->SetCharPref(pref.get(), aRedirectorType);
@ -409,6 +509,8 @@ nsSmtpServer::GetRedirectorType(char **aResult)
nsresult rv;
nsCAutoString pref;
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
getPrefString("redirector_type", pref);
rv = prefs->CopyCharPref(pref.get(), aResult);
if (NS_FAILED(rv)) *aResult=nsnull;

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

@ -80,6 +80,7 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
nsresult
NS_MsgBuildSmtpUrl(nsIFileSpec * aFilePath,
const char* aSmtpHostName,
PRInt32 aSmtpPort,
const char* aSmtpUserName,
const char* aRecipients,
nsIMsgIdentity * aSenderIdentity,
@ -134,20 +135,22 @@ nsresult nsSmtpService::SendMailMessage(nsIFileSpec * aFilePath,
if (NS_FAILED(rv) || !smtpServer)
rv = GetDefaultServer(getter_AddRefs(smtpServer));
if (NS_SUCCEEDED(rv) && smtpServer)
{
if (aPassword && *aPassword)
smtpServer->SetPassword(aPassword);
if (NS_SUCCEEDED(rv) && smtpServer)
{
if (aPassword && *aPassword)
smtpServer->SetPassword(aPassword);
nsXPIDLCString smtpHostName;
nsXPIDLCString smtpUserName;
PRInt32 smtpPort;
smtpServer->GetHostname(getter_Copies(smtpHostName));
smtpServer->GetUsername(getter_Copies(smtpUserName));
smtpServer->GetHostname(getter_Copies(smtpHostName));
smtpServer->GetUsername(getter_Copies(smtpUserName));
smtpServer->GetPort(&smtpPort);
if ((const char*)smtpHostName && (const char*)smtpHostName[0] != 0 && !CHECK_SIMULATED_ERROR(SIMULATED_SEND_ERROR_10))
{
rv = NS_MsgBuildSmtpUrl(aFilePath, smtpHostName, smtpUserName,
if (smtpHostName && smtpHostName.get()[0] && !CHECK_SIMULATED_ERROR(SIMULATED_SEND_ERROR_10))
{
rv = NS_MsgBuildSmtpUrl(aFilePath, smtpHostName, smtpPort, smtpUserName,
aRecipients, aSenderIdentity, aUrlListener, aStatusFeedback,
aNotificationCallbacks, &urlToRun); // this ref counts urlToRun
if (NS_SUCCEEDED(rv) && urlToRun)
@ -176,6 +179,7 @@ nsresult nsSmtpService::SendMailMessage(nsIFileSpec * aFilePath,
// short cut function for creating a mailto url...
nsresult NS_MsgBuildSmtpUrl(nsIFileSpec * aFilePath,
const char* aSmtpHostName,
PRInt32 aSmtpPort,
const char* aSmtpUserName,
const char * aRecipients,
nsIMsgIdentity * aSenderIdentity,
@ -184,103 +188,106 @@ nsresult NS_MsgBuildSmtpUrl(nsIFileSpec * aFilePath,
nsIInterfaceRequestor* aNotificationCallbacks,
nsIURI ** aUrl)
{
// mscott: this function is a convience hack until netlib actually dispatches smtp urls.
// in addition until we have a session to get a password, host and other stuff from, we need to use default values....
// ..for testing purposes....
nsresult rv = NS_OK;
nsCOMPtr <nsISmtpUrl> smtpUrl (do_CreateInstance(kCSmtpUrlCID, &rv));
// mscott: this function is a convience hack until netlib actually dispatches smtp urls.
// in addition until we have a session to get a password, host and other stuff from, we need to use default values....
// ..for testing purposes....
if (NS_SUCCEEDED(rv) && smtpUrl)
{
nsCAutoString urlSpec("smtp://");
if ((const char *)aSmtpUserName)
nsresult rv = NS_OK;
nsCOMPtr <nsISmtpUrl> smtpUrl (do_CreateInstance(kCSmtpUrlCID, &rv));
if (NS_SUCCEEDED(rv) && smtpUrl)
{
nsXPIDLCString escapedUsername;
*((char **)getter_Copies(escapedUsername)) = nsEscape((const char *)aSmtpUserName, url_XAlphas);
urlSpec += (const char *)escapedUsername;
urlSpec += '@';
}
nsCAutoString urlSpec("smtp://");
if (aSmtpUserName)
{
nsXPIDLCString escapedUsername;
*((char **)getter_Copies(escapedUsername)) = nsEscape(aSmtpUserName, url_XAlphas);
urlSpec += escapedUsername;
urlSpec += '@';
}
urlSpec += (const char*)aSmtpHostName;
urlSpec += ':';
urlSpec.AppendInt(SMTP_PORT);
urlSpec += aSmtpHostName;
if (!PL_strchr(aSmtpHostName, ':'))
{
urlSpec += ':';
urlSpec.AppendInt((aSmtpPort > 0) ? aSmtpPort : nsISmtpUrl::DEFAULT_SMTP_PORT);
}
if (urlSpec.get())
{
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(smtpUrl);
url->SetSpec(urlSpec);
if (urlSpec.get())
{
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(smtpUrl);
url->SetSpec(urlSpec);
smtpUrl->SetRecipients(aRecipients);
smtpUrl->SetPostMessageFile(aFilePath);
smtpUrl->SetSenderIdentity(aSenderIdentity);
smtpUrl->SetPostMessageFile(aFilePath);
smtpUrl->SetSenderIdentity(aSenderIdentity);
smtpUrl->SetNotificationCallbacks(aNotificationCallbacks);
nsCOMPtr<nsIPrompt> smtpPrompt(do_GetInterface(aNotificationCallbacks));
nsCOMPtr<nsIAuthPrompt> smtpAuthPrompt(do_GetInterface(aNotificationCallbacks));
if (!smtpPrompt || !smtpAuthPrompt)
{
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
if (wwatch) {
if (!smtpPrompt)
wwatch->GetNewPrompter(0, getter_AddRefs(smtpPrompt));
if (!smtpAuthPrompt)
wwatch->GetNewAuthPrompter(0, getter_AddRefs(smtpAuthPrompt));
}
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
if (wwatch) {
if (!smtpPrompt)
wwatch->GetNewPrompter(0, getter_AddRefs(smtpPrompt));
if (!smtpAuthPrompt)
wwatch->GetNewAuthPrompter(0, getter_AddRefs(smtpAuthPrompt));
}
}
smtpUrl->SetPrompt(smtpPrompt);
smtpUrl->SetAuthPrompt(smtpAuthPrompt);
url->RegisterListener(aUrlListener);
if (aStatusFeedback)
url->SetStatusFeedback(aStatusFeedback);
}
rv = smtpUrl->QueryInterface(NS_GET_IID(nsIURI), (void **) aUrl);
}
url->RegisterListener(aUrlListener);
if (aStatusFeedback)
url->SetStatusFeedback(aStatusFeedback);
}
rv = smtpUrl->QueryInterface(NS_GET_IID(nsIURI), (void **) aUrl);
}
return rv;
return rv;
}
nsresult NS_MsgLoadSmtpUrl(nsIURI * aUrl, nsISupports * aConsumer, nsIRequest ** aRequest)
{
// for now, assume the url is a news url and load it....
nsCOMPtr <nsISmtpUrl> smtpUrl;
nsSmtpProtocol *smtpProtocol = nsnull;
nsresult rv = NS_OK;
// for now, assume the url is a news url and load it....
nsCOMPtr <nsISmtpUrl> smtpUrl;
nsSmtpProtocol *smtpProtocol = nsnull;
nsresult rv = NS_OK;
if (!aUrl)
return rv;
if (!aUrl)
return rv;
// turn the url into an smtp url...
smtpUrl = do_QueryInterface(aUrl);
if (smtpUrl)
{
// almost there...now create a smtp protocol instance to run the url in...
smtpProtocol = new nsSmtpProtocol(aUrl);
if (smtpProtocol == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(smtpProtocol);
rv = smtpProtocol->LoadUrl(aUrl, aConsumer); // protocol will get destroyed when url is completed...
smtpProtocol->QueryInterface(NS_GET_IID(nsIRequest), (void **) aRequest);
NS_RELEASE(smtpProtocol);
}
smtpUrl = do_QueryInterface(aUrl);
if (smtpUrl)
{
// almost there...now create a smtp protocol instance to run the url in...
smtpProtocol = new nsSmtpProtocol(aUrl);
if (smtpProtocol == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
return rv;
NS_ADDREF(smtpProtocol);
rv = smtpProtocol->LoadUrl(aUrl, aConsumer); // protocol will get destroyed when url is completed...
smtpProtocol->QueryInterface(NS_GET_IID(nsIRequest), (void **) aRequest);
NS_RELEASE(smtpProtocol);
}
return rv;
}
NS_IMETHODIMP nsSmtpService::GetScheme(nsACString &aScheme)
{
aScheme = "mailto";
return NS_OK;
return NS_OK;
}
NS_IMETHODIMP nsSmtpService::GetDefaultPort(PRInt32 *aDefaultPort)
{
nsresult rv = NS_OK;
if (aDefaultPort)
*aDefaultPort = SMTP_PORT;
else
rv = NS_ERROR_NULL_POINTER;
return rv;
nsresult rv = NS_OK;
if (aDefaultPort)
*aDefaultPort = nsISmtpUrl::DEFAULT_SMTP_PORT;
else
rv = NS_ERROR_NULL_POINTER;
return rv;
}
NS_IMETHODIMP