mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-12 02:50:13 +00:00
fix for #26768, r=mscott. get biff / get new msg to work properly if you have
two accounts on the same pop server.
This commit is contained in:
parent
3598825f45
commit
fe3fd02fd6
@ -76,22 +76,31 @@ NS_IMETHODIMP nsPop3Service::CheckForNewMail(nsIMsgWindow* aMsgWindow,
|
|||||||
nsIURI ** aURL)
|
nsIURI ** aURL)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
char * hostname = nsnull;
|
|
||||||
|
nsXPIDLCString popHost;
|
||||||
|
nsXPIDLCString popUser;
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||||
nsCOMPtr<nsIURI> url;
|
nsCOMPtr<nsIURI> url;
|
||||||
|
|
||||||
server = do_QueryInterface(popServer);
|
server = do_QueryInterface(popServer);
|
||||||
if (server)
|
|
||||||
server->GetHostName(&hostname);
|
if (!server) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
rv = server->GetHostName(getter_Copies(popHost));
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
if (!((const char *)popHost)) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
rv = server->GetUsername(getter_Copies(popUser));
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
if (!((const char *)popUser)) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && popServer && hostname)
|
if (NS_SUCCEEDED(rv) && popServer)
|
||||||
{
|
{
|
||||||
// now construct a pop3 url...
|
// now construct a pop3 url...
|
||||||
char * urlSpec = PR_smprintf("pop3://%s:%d?check", hostname, POP3_PORT);
|
char * urlSpec = PR_smprintf("pop3://%s@%s:%d?check", (const char *)popUser, (const char *)popHost, POP3_PORT);
|
||||||
rv = BuildPop3Url(urlSpec, inbox, popServer, aUrlListener, getter_AddRefs(url), aMsgWindow);
|
rv = BuildPop3Url(urlSpec, inbox, popServer, aUrlListener, getter_AddRefs(url), aMsgWindow);
|
||||||
PR_FREEIF(urlSpec);
|
PR_FREEIF(urlSpec);
|
||||||
if (hostname) PL_strfree(hostname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -113,21 +122,27 @@ nsresult nsPop3Service::GetNewMail(nsIMsgWindow *aMsgWindow, nsIUrlListener * aU
|
|||||||
nsIURI ** aURL)
|
nsIURI ** aURL)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
char * popHost = nsnull;
|
nsXPIDLCString popHost;
|
||||||
|
nsXPIDLCString popUser;
|
||||||
nsCOMPtr<nsIURI> url;
|
nsCOMPtr<nsIURI> url;
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||||
server = do_QueryInterface(popServer);
|
server = do_QueryInterface(popServer);
|
||||||
|
|
||||||
if (server)
|
if (!server) return NS_ERROR_FAILURE;
|
||||||
server->GetHostName(&popHost);
|
|
||||||
|
|
||||||
if (!popHost) return NS_ERROR_FAILURE;
|
rv = server->GetHostName(getter_Copies(popHost));
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
if (!((const char *)popHost)) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
rv = server->GetUsername(getter_Copies(popUser));
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
if (!((const char *)popUser)) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && popServer)
|
if (NS_SUCCEEDED(rv) && popServer)
|
||||||
{
|
{
|
||||||
// now construct a pop3 url...
|
// now construct a pop3 url...
|
||||||
char * urlSpec = PR_smprintf("pop3://%s:%d", popHost, POP3_PORT);
|
char * urlSpec = PR_smprintf("pop3://%s@%s:%d", (const char *)popUser, (const char *)popHost, POP3_PORT);
|
||||||
rv = BuildPop3Url(urlSpec, nsnull, popServer, aUrlListener, getter_AddRefs(url), aMsgWindow);
|
rv = BuildPop3Url(urlSpec, nsnull, popServer, aUrlListener, getter_AddRefs(url), aMsgWindow);
|
||||||
PR_FREEIF(urlSpec);
|
PR_FREEIF(urlSpec);
|
||||||
}
|
}
|
||||||
@ -140,8 +155,6 @@ nsresult nsPop3Service::GetNewMail(nsIMsgWindow *aMsgWindow, nsIUrlListener * aU
|
|||||||
rv = RunPopUrl(server, url);
|
rv = RunPopUrl(server, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (popHost) PL_strfree(popHost);
|
|
||||||
|
|
||||||
if (aURL && url) // we already have a ref count on pop3url...
|
if (aURL && url) // we already have a ref count on pop3url...
|
||||||
{
|
{
|
||||||
*aURL = url; // transfer ref count to the caller...
|
*aURL = url; // transfer ref count to the caller...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user