add rootMsgFolder accessor to incoming server, make rootFolder interCaps r/sr=sspitzer 119579

This commit is contained in:
bienvenu%netscape.com 2002-01-14 22:59:02 +00:00
Родитель d8cb6449b2
Коммит d38a3fb2f2
4 изменённых файлов: 24 добавлений и 16 удалений

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

@ -40,6 +40,7 @@
interface nsIFileSpec; interface nsIFileSpec;
interface nsIFolder; interface nsIFolder;
interface nsIMsgFolder;
interface nsIMsgFolderCache; interface nsIMsgFolderCache;
interface nsIMsgWindow; interface nsIMsgWindow;
interface nsIMsgFilterList; interface nsIMsgFilterList;
@ -149,7 +150,10 @@ interface nsIMsgIncomingServer : nsISupports {
readonly attribute string serverURI; readonly attribute string serverURI;
/* the root folder for this server */ /* the root folder for this server */
attribute nsIFolder RootFolder; attribute nsIFolder rootFolder;
/* handy accessor when we want a msg folder */
readonly attribute nsIMsgFolder rootMsgFolder;
/* are we already getting new Messages on the current server.. /* are we already getting new Messages on the current server..
This is used to help us prevent multiple get new msg commands from This is used to help us prevent multiple get new msg commands from

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

@ -419,8 +419,7 @@ function GetWindowMediator()
function GetInboxFolder(server) function GetInboxFolder(server)
{ {
try { try {
var rootFolder = server.RootFolder; var rootMsgFolder = server.rootMsgFolder;
var rootMsgFolder = rootFolder.QueryInterface(Components.interfaces.nsIMsgFolder);
//now find Inbox //now find Inbox
var outNumFolders = new Object(); var outNumFolders = new Object();
@ -794,9 +793,7 @@ function getDestinationFolder(preselectedFolder, server)
var isCreateSubfolders = preselectedFolder.canCreateSubfolders; var isCreateSubfolders = preselectedFolder.canCreateSubfolders;
if (!isCreateSubfolders) if (!isCreateSubfolders)
{ {
var tmpDestFolder = server.RootFolder; destinationFolder = server.rootMsgFolder;
destinationFolder
= tmpDestFolder.QueryInterface(Components.interfaces.nsIMsgFolder);
var verifyCreateSubfolders = null; var verifyCreateSubfolders = null;
if (destinationFolder) if (destinationFolder)
@ -809,9 +806,7 @@ function getDestinationFolder(preselectedFolder, server)
try { try {
var account = accountManager.defaultAccount; var account = accountManager.defaultAccount;
var defaultServer = account.incomingServer; var defaultServer = account.incomingServer;
var tmpDefaultFolder = defaultServer.RootFolder; var defaultFolder = defaultServer.rootMsgFolder;
var defaultFolder
= tmpDefaultFolder.QueryInterface(Components.interfaces.nsIMsgFolder);
var checkCreateSubfolders = null; var checkCreateSubfolders = null;
if (defaultFolder) if (defaultFolder)

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

@ -370,7 +370,7 @@ function ServerContainsFolder(server, folder)
function SelectServer(server) function SelectServer(server)
{ {
SelectFolder(server.RootFolder.URI); SelectFolder(server.rootFolder.URI);
} }
// we have this incoming server listener in case we need to // we have this incoming server listener in case we need to
@ -520,8 +520,7 @@ function loadStartFolder(initialUri)
var defaultAccount = accountManager.defaultAccount; var defaultAccount = accountManager.defaultAccount;
defaultServer = defaultAccount.incomingServer; defaultServer = defaultAccount.incomingServer;
var rootFolder = defaultServer.RootFolder; var rootMsgFolder = defaultServer.rootMsgFolder;
var rootMsgFolder = rootFolder.QueryInterface(Components.interfaces.nsIMsgFolder);
startFolderResource = rootMsgFolder.QueryInterface(Components.interfaces.nsIRDFResource); startFolderResource = rootMsgFolder.QueryInterface(Components.interfaces.nsIRDFResource);

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

@ -158,6 +158,18 @@ nsMsgIncomingServer::GetRootFolder(nsIFolder * *aRootFolder)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsMsgIncomingServer::GetRootMsgFolder(nsIMsgFolder **aRootMsgFolder)
{
NS_ENSURE_ARG_POINTER(aRootMsgFolder);
nsCOMPtr <nsIFolder> rootFolder;
nsresult rv = GetRootFolder(getter_AddRefs(rootFolder));
if (NS_SUCCEEDED(rv) && rootFolder)
rv = rootFolder->QueryInterface(NS_GET_IID(nsIMsgFolder), (void **) aRootMsgFolder);
return rv;
}
NS_IMETHODIMP NS_IMETHODIMP
nsMsgIncomingServer::PerformExpand(nsIMsgWindow *aMsgWindow) nsMsgIncomingServer::PerformExpand(nsIMsgWindow *aMsgWindow)
{ {
@ -989,10 +1001,8 @@ nsMsgIncomingServer::GetFilterList(nsIMsgFilterList **aResult)
nsresult rv; nsresult rv;
if (!mFilterList) { if (!mFilterList) {
nsCOMPtr<nsIFolder> folder; nsCOMPtr<nsIMsgFolder> msgFolder;
rv = GetRootFolder(getter_AddRefs(folder)); rv = GetRootMsgFolder(getter_AddRefs(msgFolder));
nsCOMPtr<nsIMsgFolder> msgFolder(do_QueryInterface(folder, &rv));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIFileSpec> thisFolder; nsCOMPtr<nsIFileSpec> thisFolder;