From a9430b9bf2ffef654a18e26e12ab5f376fe8f76a Mon Sep 17 00:00:00 2001 From: "bienvenu%nventure.com" Date: Sat, 10 Feb 2007 23:24:34 +0000 Subject: [PATCH] fix spawning of several new 3 pane windows when following news: urls, and an infinite number when using a non-default folder view, 355633 sr=mscott --- mail/base/content/msgMail3PaneWindow.js | 3 ++- mailnews/news/src/nsNntpService.cpp | 26 +++++++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/mail/base/content/msgMail3PaneWindow.js b/mail/base/content/msgMail3PaneWindow.js index 6966e58ec2e..ab1a5c915fd 100644 --- a/mail/base/content/msgMail3PaneWindow.js +++ b/mail/base/content/msgMail3PaneWindow.js @@ -1011,7 +1011,8 @@ function loadStartFolder(initialUri) } catch(ex) { - if (initialUri) + // this is the case where we're trying to auto-subscribe to a folder. + if (initialUri && !startFolder.parent) { messenger.loadURL(window, initialUri); return; diff --git a/mailnews/news/src/nsNntpService.cpp b/mailnews/news/src/nsNntpService.cpp index e03357374e0..5f81f2e77af 100644 --- a/mailnews/news/src/nsNntpService.cpp +++ b/mailnews/news/src/nsNntpService.cpp @@ -1776,9 +1776,6 @@ nsNntpService::HandleContent(const char * aContentType, nsIInterfaceRequestor* a if (uri) { nsXPIDLCString uriStr; - nsCOMPtr mediator(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID, &rv)); - NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr window; nsCOMPtr msgFolder; nsCOMPtr protocol = do_QueryInterface(aChannel); if (protocol) @@ -1788,11 +1785,24 @@ nsNntpService::HandleContent(const char * aContentType, nsIInterfaceRequestor* a if (!uriStr.IsEmpty()) { - nsCOMPtr messengerWindowService = do_GetService(NS_MESSENGERWINDOWSERVICE_CONTRACTID,&rv); - NS_ENSURE_SUCCESS(rv, rv); - - rv = messengerWindowService->OpenMessengerWindowWithUri("mail:3pane", uriStr.get(), nsMsgKey_None); - NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr originalUri; + aChannel->GetOriginalURI(getter_AddRefs(originalUri)); + if (originalUri) + { + nsCOMPtr mailUrl = do_QueryInterface(originalUri); + if (mailUrl) + { + nsCOMPtr msgWindow; + mailUrl->GetMsgWindow(getter_AddRefs(msgWindow)); + if (msgWindow) + { + nsCOMPtr windowCommands; + msgWindow->GetWindowCommands(getter_AddRefs(windowCommands)); + if (windowCommands) + windowCommands->SelectFolder(uriStr); + } + } + } } } } else