зеркало из https://github.com/mozilla/pjs.git
step 2 on 30057 - make get new mail on pop3 deferred account download mail into inbox of deferred to account, sr=mscott
This commit is contained in:
Родитель
1969c19d54
Коммит
ff2a77ff29
|
@ -897,12 +897,8 @@ nsMsgAccountManagerDataSource::createServerResources(nsISupports *element,
|
|||
|
||||
// add the resource to the array
|
||||
nsCOMPtr<nsIRDFResource> serverResource = do_QueryInterface(serverFolder);
|
||||
if(!serverResource)
|
||||
return PR_TRUE;
|
||||
|
||||
rv = servers->AppendElement(serverResource);
|
||||
if (NS_FAILED(rv)) return PR_TRUE;
|
||||
|
||||
if(serverResource)
|
||||
(void) servers->AppendElement(serverResource);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@ interface nsIPop3IncomingServer : nsISupports {
|
|||
void addUidlToMarkDeleted(in string aUidl);
|
||||
void markMessagesDeleted(in boolean aDeleteMsgs);
|
||||
attribute boolean authenticated;
|
||||
/* account to which this server defers storage, for global inbox */
|
||||
attribute string deferredToAccount;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -2235,7 +2235,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::GetNewMessages(nsIMsgWindow *aWindow, nsIUrl
|
|||
|
||||
nsCOMPtr<nsIMsgFolder> inbox;
|
||||
nsCOMPtr<nsIMsgFolder> rootFolder;
|
||||
rv = GetRootFolder(getter_AddRefs(rootFolder));
|
||||
rv = server->GetRootMsgFolder(getter_AddRefs(rootFolder));
|
||||
if(NS_SUCCEEDED(rv) && rootFolder)
|
||||
{
|
||||
PRUint32 numFolders;
|
||||
|
@ -2982,7 +2982,7 @@ nsMsgLocalMailFolder::MarkMsgsOnPop3Server(nsISupportsArray *aMessages, PRBool a
|
|||
PRUint32 srcCount;
|
||||
aMessages->Count(&srcCount);
|
||||
|
||||
for (PRInt32 i = 0; header && (i < srcCount); i++)
|
||||
for (PRInt32 i = 0; i < srcCount; i++)
|
||||
{
|
||||
/* get uidl for this message */
|
||||
uidl = nsnull;
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "nsIFileSpec.h"
|
||||
#include "nsPop3Protocol.h"
|
||||
#include "nsIMsgLocalMailFolder.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
|
||||
static NS_DEFINE_CID(kCPop3ServiceCID, NS_POP3SERVICE_CID);
|
||||
|
||||
|
@ -105,6 +106,10 @@ NS_IMPL_SERVERPREF_INT(nsPop3IncomingServer,
|
|||
"num_days_to_leave_on_server")
|
||||
|
||||
|
||||
NS_IMPL_SERVERPREF_STR(nsPop3IncomingServer,
|
||||
DeferredToAccount,
|
||||
"deferred_to_account")
|
||||
|
||||
//NS_IMPL_GETSET(nsPop3IncomingServer, Authenticated, PRBool, m_authenticated);
|
||||
|
||||
NS_IMETHODIMP nsPop3IncomingServer::GetAuthenticated(PRBool *aAuthenticated)
|
||||
|
@ -142,6 +147,42 @@ nsPop3IncomingServer::GetLocalStoreType(char **type)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPop3IncomingServer::GetRootMsgFolder(nsIMsgFolder **aRootMsgFolder)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRootMsgFolder);
|
||||
nsresult rv = NS_OK;
|
||||
if (!m_rootMsgFolder)
|
||||
{
|
||||
nsXPIDLCString deferredToAccount;
|
||||
GetDeferredToAccount(getter_Copies(deferredToAccount));
|
||||
if (deferredToAccount.IsEmpty())
|
||||
{
|
||||
rv = CreateRootFolder();
|
||||
m_rootMsgFolder = m_rootFolder;
|
||||
}
|
||||
else
|
||||
{
|
||||
nsCOMPtr <nsIMsgAccountManager> accountManager = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
nsCOMPtr <nsIMsgAccount> account;
|
||||
rv = accountManager->GetAccount(deferredToAccount, getter_AddRefs(account));
|
||||
if (account)
|
||||
{
|
||||
nsCOMPtr <nsIMsgIncomingServer> incomingServer;
|
||||
rv = account->GetIncomingServer(getter_AddRefs(incomingServer));
|
||||
// make sure we're not deferred to ourself...
|
||||
if (incomingServer && incomingServer != this)
|
||||
rv = incomingServer->GetRootMsgFolder(getter_AddRefs(m_rootMsgFolder));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aRootMsgFolder = m_rootMsgFolder);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPop3IncomingServer::PerformBiff(nsIMsgWindow *aMsgWindow)
|
||||
{
|
||||
nsresult rv;
|
||||
|
|
|
@ -64,10 +64,12 @@ public:
|
|||
NS_IMETHOD GetCanBeDefaultServer(PRBool *canBeDefaultServer);
|
||||
NS_IMETHOD GetCanSearchMessages(PRBool *canSearchMessages);
|
||||
NS_IMETHOD GetOfflineSupportLevel(PRInt32 *aSupportLevel);
|
||||
NS_IMETHOD GetRootMsgFolder(nsIMsgFolder **aRootMsgFolder);
|
||||
private:
|
||||
PRUint32 m_capabilityFlags;
|
||||
PRBool m_authenticated;
|
||||
nsCOMPtr <nsIPop3Protocol> m_runningProtocol;
|
||||
nsCOMPtr <nsIMsgFolder> m_rootMsgFolder;
|
||||
nsCStringArray m_uidlsToMarkDeleted;
|
||||
};
|
||||
|
||||
|
|
|
@ -167,21 +167,9 @@ nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, nsIMsgWindow *aMsgWindow, PRB
|
|||
else
|
||||
return NS_MSG_FOLDER_BUSY;
|
||||
|
||||
if (uidlDownload)
|
||||
{
|
||||
nsCOMPtr<nsIFileSpec> path;
|
||||
m_folder->GetPath(getter_AddRefs(path));
|
||||
path->GetFileSpec(&fileSpec);
|
||||
}
|
||||
else
|
||||
{
|
||||
nsCOMPtr<nsIFileSpec> mailDirectory;
|
||||
rv = server->GetLocalPath(getter_AddRefs(mailDirectory));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mailDirectory->GetFileSpec(&fileSpec);
|
||||
fileSpec += "Inbox";
|
||||
}
|
||||
nsCOMPtr<nsIFileSpec> path;
|
||||
m_folder->GetPath(getter_AddRefs(path));
|
||||
path->GetFileSpec(&fileSpec);
|
||||
m_outFileStream = new nsIOFileStream(fileSpec /*, PR_CREATE_FILE */);
|
||||
|
||||
// The following (!m_outFileStream etc) was added to make sure that we don't write somewhere
|
||||
|
|
Загрузка…
Ссылка в новой задаче