From 25b54525b52f9d90af6e448e350c04df1711ba39 Mon Sep 17 00:00:00 2001 From: "bienvenu%nventure.com" Date: Fri, 22 Jun 2007 22:03:18 +0000 Subject: [PATCH] open imap server admin urls in browser, patch by brian.lu@sun.com, r=bienvenu, sr=mscott 353188 git-svn-id: svn://10.0.0.236/trunk@228603 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/mailnews/imap/src/Makefile.in | 1 + .../mailnews/imap/src/nsImapMailFolder.cpp | 20 ++++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/mozilla/mailnews/imap/src/Makefile.in b/mozilla/mailnews/imap/src/Makefile.in index 8198a5362de..433e8f61d79 100644 --- a/mozilla/mailnews/imap/src/Makefile.in +++ b/mozilla/mailnews/imap/src/Makefile.in @@ -74,6 +74,7 @@ REQUIRES = xpcom \ uriloader \ windowwatcher \ embed_base \ + exthandler \ $(NULL) EXPORTS = \ diff --git a/mozilla/mailnews/imap/src/nsImapMailFolder.cpp b/mozilla/mailnews/imap/src/nsImapMailFolder.cpp index 5a80a29b236..07b4e2cd773 100644 --- a/mozilla/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mozilla/mailnews/imap/src/nsImapMailFolder.cpp @@ -117,6 +117,8 @@ #include "nsIMsgIdentity.h" #include "nsIMsgFolderNotificationService.h" #include "nsNativeCharsetUtils.h" +#include "nsIExternalProtocolService.h" +#include "nsCExternalHandlerService.h" static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID); @@ -3443,15 +3445,23 @@ NS_IMETHODIMP nsImapMailFolder::FolderPrivileges(nsIMsgWindow *window) #endif if (!m_adminUrl.IsEmpty()) { - nsCOMPtr docShell; - rv = window->GetRootDocShell(getter_AddRefs(docShell)); - if (NS_SUCCEEDED(rv) && docShell) + nsCOMPtr extProtService = do_GetService(NS_EXTERNALPROTOCOLSERVICE_CONTRACTID); + if (extProtService) { + nsCAutoString scheme; nsCOMPtr uri; if (NS_FAILED(rv = NS_NewURI(getter_AddRefs(uri), m_adminUrl.get()))) return rv; - rv = docShell->LoadURI(uri, nsnull, nsIWebNavigation::LOAD_FLAGS_IS_LINK, PR_FALSE); - + uri->GetScheme(scheme); + if (!scheme.IsEmpty()) + { + // if the URL scheme does not correspond to an exposed protocol, then we + // need to hand this link click over to the external protocol handler. + PRBool isExposed; + rv = extProtService->IsExposedProtocol(scheme.get(), &isExposed); + if (NS_SUCCEEDED(rv) && !isExposed) + return extProtService->LoadUrl(uri); + } } } else