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
This commit is contained in:
bienvenu%nventure.com
2007-06-22 22:03:18 +00:00
parent 027a48b341
commit 25b54525b5
2 changed files with 16 additions and 5 deletions

View File

@@ -74,6 +74,7 @@ REQUIRES = xpcom \
uriloader \
windowwatcher \
embed_base \
exthandler \
$(NULL)
EXPORTS = \

View File

@@ -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 <nsIDocShell> docShell;
rv = window->GetRootDocShell(getter_AddRefs(docShell));
if (NS_SUCCEEDED(rv) && docShell)
nsCOMPtr<nsIExternalProtocolService> extProtService = do_GetService(NS_EXTERNALPROTOCOLSERVICE_CONTRACTID);
if (extProtService)
{
nsCAutoString scheme;
nsCOMPtr<nsIURI> 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