Bug 259212 - Get All Messages is not working, r=Mnyromyr, sr=Neil

This commit is contained in:
Frank Wein 2008-12-16 22:38:32 +01:00
Родитель f846f0f663
Коммит dbaad85e8e
2 изменённых файлов: 43 добавлений и 65 удалений

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

@ -111,7 +111,7 @@ function CoalesceGetMsgsForPop3ServersByDestFolder(aCurrentServer,
aPOP3DownloadServersArray[index].AppendElement(aCurrentServer);
}
function MailTasksGetMessagesForAllServers(aMsgWindow, aDefaultServer)
function MailTasksGetMessagesForAllServers(aBiff, aMsgWindow, aDefaultServer)
{
// now log into any server
try
@ -131,26 +131,47 @@ function MailTasksGetMessagesForAllServers(aMsgWindow, aDefaultServer)
{
let protocolinfo = Components.classes["@mozilla.org/messenger/protocol/info;1?type=" + currentServer.type]
.getService(Components.interfaces.nsIMsgProtocolInfo);
if (protocolinfo.canLoginAtStartUp && currentServer.loginAtStartUp)
if (aBiff)
{
if (aDefaultServer &&
aDefaultServer.equals(currentServer) &&
!aDefaultServer.isDeferredTo &&
aDefaultServer.rootFolder == aDefaultServer.rootMsgFolder)
if (protocolinfo.canLoginAtStartUp && currentServer.loginAtStartUp)
{
dump(currentServer.serverURI + " ... skipping, already opened\n");
if (aDefaultServer &&
aDefaultServer.equals(currentServer) &&
!aDefaultServer.isDeferredTo &&
aDefaultServer.rootFolder == aDefaultServer.rootMsgFolder)
{
dump(currentServer.serverURI + " ... skipping, already opened\n");
}
else if (currentServer.type == "pop3" && currentServer.downloadOnBiff)
{
CoalesceGetMsgsForPop3ServersByDestFolder(currentServer,
pop3DownloadServersArray,
localFoldersToDownloadTo);
pop3Server = currentServer;
}
else
{
// check to see if there are new messages on the server
currentServer.performBiff(aMsgWindow);
}
}
else if (currentServer.type == "pop3" && currentServer.downloadOnBiff)
}
else
{
if (protocolinfo.canGetMessages && !currentServer.passwordPromptRequired)
{
CoalesceGetMsgsForPop3ServersByDestFolder(currentServer,
pop3DownloadServersArray,
localFoldersToDownloadTo);
pop3Server = currentServer;
}
else
{
// check to see if there are new messages on the server
currentServer.performBiff(aMsgWindow);
if (currentServer.type == "pop3")
{
CoalesceGetMsgsForPop3ServersByDestFolder(currentServer,
pop3DownloadServersArray,
localFoldersToDownloadTo);
pop3Server = currentServer;
}
else
{
// get new messages on the server for IMAP or RSS
GetMessagesForInboxOnServer(currentServer);
}
}
}
}
@ -239,7 +260,7 @@ function MailTasksOnLoad(aEvent)
return;
// still no excuse to refuse to use this ruse
MailTasksGetMessagesForAllServers(null, null);
MailTasksGetMessagesForAllServers(true, null, null);
}
function MailTasksOnUnload(aEvent)

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

@ -890,7 +890,7 @@ function MsgGetMessage()
function MsgGetMessagesForAllServers(defaultServer)
{
MailTasksGetMessagesForAllServers(msgWindow, defaultServer);
MailTasksGetMessagesForAllServers(true, msgWindow, defaultServer);
}
/**
@ -901,11 +901,9 @@ function MsgGetMessagesForAllServers(defaultServer)
*/
function MsgGetMessagesForAllAuthenticatedAccounts()
{
if(CheckOnline())
GetMessagesForAllAuthenticatedAccounts();
else if (DoGetNewMailWhenOffline())
GetMessagesForAllAuthenticatedAccounts();
}
if (CheckOnline() || DoGetNewMailWhenOffline())
MailTasksGetMessagesForAllServers(false, msgWindow, null);
}
/**
* Get messages for the account selected from Menu dropdowns.
@ -2099,47 +2097,6 @@ function SendUnsentMessages()
}
}
function GetMessagesForAllAuthenticatedAccounts()
{
// now log into any server
try
{
var allServers = accountManager.allServers;
var i;
// array of isupportsarrays of servers for a particular folder
var pop3DownloadServersArray = new Array();
// parallel isupports array of folders to download to...
var localFoldersToDownloadTo = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
var pop3Server;
for (i = 0; i < allServers.Count(); ++i)
{
var currentServer = allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer);
var protocolinfo = Components.classes["@mozilla.org/messenger/protocol/info;1?type=" + currentServer.type].getService(Components.interfaces.nsIMsgProtocolInfo);
if (protocolinfo.canGetMessages && !currentServer.passwordPromptRequired)
{
if (currentServer.type == "pop3")
{
CoalesceGetMsgsForPop3ServersByDestFolder(currentServer, pop3DownloadServersArray, localFoldersToDownloadTo);
pop3Server = currentServer.QueryInterface(Components.interfaces.nsIPop3IncomingServer);
}
else
// get new messages on the server for imap or rss
GetMessagesForInboxOnServer(currentServer);
}
}
for (i = 0; i < pop3DownloadServersArray.length; ++i)
{
// any ol' pop3Server will do - the serversArray specifies which servers to download from
pop3Server.downloadMailFromServers(pop3DownloadServersArray[i], msgWindow, localFoldersToDownloadTo.GetElementAt(i), null);
}
}
catch(ex)
{
dump(ex + "\n");
}
}
function GetMessagesForAccount(aEvent)
{
var uri = aEvent.target.id;