partial fixes for #40662 and #41170 for jefft.

twisting open an imap server / folder needs to do some discovery.

also, catch an exception caused by tooltips & twisties.
putterman owns the real bug, but this will prevent noise to the console.

also, some bullet proofing code to prevent a random crash I was seeing.
(now we just assert.)
This commit is contained in:
sspitzer%netscape.com 2000-06-03 00:22:07 +00:00
parent e1ba86da1b
commit 06dbb8d512
6 changed files with 65 additions and 10 deletions

View File

@ -726,7 +726,15 @@ function FillInFolderTooltip(cellNode)
var unreadCountProperty = RDF.GetResource('http://home.netscape.com/NC-rdf#TotalUnreadMessages');
var totalCountProperty = RDF.GetResource('http://home.netscape.com/NC-rdf#TotalMessages');
var nameResult = db.GetTarget(folderResource, nameProperty , true);
var nameResult;
try {
nameResult = db.GetTarget(folderResource, nameProperty , true);
}
catch (ex) {
//dump("failed to get the name of the folder for the tooltip: "+ex+"\n");
return;
}
nameResult = nameResult.QueryInterface(Components.interfaces.nsIRDFLiteral);
var name = nameResult.Value;

View File

@ -675,6 +675,19 @@ function FolderPaneOnClick(event)
server.PerformExpand(msgWindow);
}
}
else {
var isImap = (treeitem.getAttribute('ServerType') == "imap");
if (isImap) {
var uri = treeitem.getAttribute("id");
var folder = GetMsgFolderFromUri(uri);
if (folder) {
var imapFolder = folder.QueryInterface(Components.interfaces.nsIMsgImapMailFolder);
if (imapFolder) {
imapFolder.PerformExpand(msgWindow);
}
}
}
}
}
}
}

View File

@ -23,6 +23,8 @@
#include "nsISupports.idl"
#include "nsIMsgFolder.idl"
interface nsIMsgWindow;
[scriptable, uuid(FBFEBE79-C1DD-11d2-8A40-0060B0FC04D2)]
interface nsIMsgImapMailFolder : nsISupports {
void RemoveSubFolder(in nsIMsgFolder folder);
@ -30,6 +32,8 @@ interface nsIMsgImapMailFolder : nsISupports {
void List();
void RenameLocal(in string newname);
void PrepareToRename();
void PerformExpand(in nsIMsgWindow aMsgWindow);
attribute boolean verifiedAsOnlineFolder;
attribute boolean explicitlyVerify;
attribute wchar hierarchyDelimiter;

View File

@ -634,10 +634,30 @@ NS_IMETHODIMP nsImapIncomingServer::ResetConnection(const char* folderName)
NS_IMETHODIMP
nsImapIncomingServer::PerformExpand(nsIMsgWindow *aMsgWindow)
{
#ifdef DEBUG_jefft
printf("jefft, implement me\n");
#endif
return NS_OK;
nsresult rv;
nsCOMPtr<nsIFolder> rootFolder;
rv = GetRootFolder(getter_AddRefs(rootFolder));
if (NS_FAILED(rv)) return rv;
if (!rootFolder) return NS_ERROR_FAILURE;
nsCOMPtr<nsIMsgFolder> rootMsgFolder = do_QueryInterface(rootFolder,
&rv);
if (NS_FAILED(rv)) return rv;
if (!rootMsgFolder) return NS_ERROR_FAILURE;
nsCOMPtr<nsIImapService> imapService = do_GetService(kImapServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
if (!imapService) return NS_ERROR_FAILURE;
nsCOMPtr<nsIEventQueue> queue;
// get the Event Queue for this thread...
NS_WITH_SERVICE(nsIEventQueueService, pEventQService, kEventQueueServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
if (!pEventQService) return NS_ERROR_FAILURE;
rv = pEventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(queue));
if (NS_FAILED(rv)) return rv;
rv = imapService->DiscoverAllFolders(queue, rootMsgFolder, nsnull, nsnull);
return rv;
}
NS_IMETHODIMP nsImapIncomingServer::PerformBiff()

View File

@ -66,6 +66,7 @@
#include "nsIMessenger.h"
#include "nsIImapMockChannel.h"
#include "nsIProgressEventSink.h"
#include "nsIMsgWindow.h"
static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
@ -4058,3 +4059,10 @@ NS_IMETHODIMP nsImapMailFolder::SetFolderNeedsAdded(PRBool bVal)
return NS_OK;
}
NS_IMETHODIMP nsImapMailFolder::PerformExpand(nsIMsgWindow *aMsgWindow)
{
#ifdef DEBUG_jefft
printf("jefft, finish me\n");
#endif
return NS_OK;
}

View File

@ -1492,11 +1492,13 @@ NS_IMETHODIMP nsImapProtocol::CanHandleUrl(nsIImapUrl * aImapUrl,
else if (isBusy)
{
nsImapState curUrlImapState;
m_runningUrl->GetRequiredImapState(&curUrlImapState);
if (curUrlImapState == nsIImapUrl::nsImapSelectedState)
{
curUrlFolderName = OnCreateServerSourceFolderPathString();
inSelectedState = PR_TRUE;
NS_ASSERTION(m_runningUrl,"isBusy, but no running url.");
if (m_runningUrl) {
m_runningUrl->GetRequiredImapState(&curUrlImapState);
if (curUrlImapState == nsIImapUrl::nsImapSelectedState) {
curUrlFolderName = OnCreateServerSourceFolderPathString();
inSelectedState = PR_TRUE;
}
}
}