From c6a7cf8cf3534751a202f7bd49c53b2264ddbf59 Mon Sep 17 00:00:00 2001 From: "valeski%netscape.com" Date: Fri, 10 Sep 1999 16:01:36 +0000 Subject: [PATCH] adding FTP dir listing stream conv registration --- docshell/base/nsWebShell.cpp | 50 +++++++++++++++++++++++++----------- webshell/src/nsWebShell.cpp | 50 +++++++++++++++++++++++++----------- 2 files changed, 70 insertions(+), 30 deletions(-) diff --git a/docshell/base/nsWebShell.cpp b/docshell/base/nsWebShell.cpp index f4c99c30f4a3..07786f94c1d2 100644 --- a/docshell/base/nsWebShell.cpp +++ b/docshell/base/nsWebShell.cpp @@ -73,7 +73,8 @@ #include "nsIDOMRange.h" #include "nsIFrameReflow.h" -#include "nsMultiMixedConv.h" // for +#include "nsMultiMixedConv.h" +#include "nsFTPDirListingConv.h" #include "nsIRegistry.h" static NS_DEFINE_CID(kRegistryCID, NS_REGISTRY_CID); @@ -1194,6 +1195,24 @@ nsWebShell::Init(nsNativeWidget aNativeParent, } // STREAM CONVERTER REGISTRATION + + nsIRegistry *registry; + rv = nsServiceManager::GetService(kRegistryCID, NS_GET_IID(nsIRegistry), (nsISupports**) ®istry); + if (NS_FAILED(rv)) goto done; + + + + // open the registry + rv = registry->OpenWellKnownRegistry(nsIRegistry::ApplicationComponentRegistry); + if (NS_FAILED(rv)) goto done; + + // set the key + nsIRegistry::Key key, key1; + + // root key addition + rv = registry->AddSubtree(nsIRegistry::Common, NS_ISTREAMCONVERTER_KEY, &key); + if (NS_FAILED(rv)) goto done; + // multipart mixed converter registration nsIFactory *multiMixedFactSup; rv = nsComponentManager::FindFactory(kMultiMixedConverterCID, &multiMixedFactSup); @@ -1205,23 +1224,24 @@ nsWebShell::Init(nsNativeWidget aNativeParent, PR_TRUE); if (NS_FAILED(rv)) goto done; - nsIRegistry *registry; - rv = nsServiceManager::GetService(kRegistryCID, NS_GET_IID(nsIRegistry), (nsISupports**) ®istry); - if (NS_FAILED(rv)) goto done; - - // open the registry - rv = registry->OpenWellKnownRegistry(nsIRegistry::ApplicationComponentRegistry); - if (NS_FAILED(rv)) goto done; - - // set the key - nsIRegistry::Key key, key1; - - rv = registry->AddSubtree(nsIRegistry::Common, NS_ISTREAMCONVERTER_KEY, &key); - if (NS_FAILED(rv)) goto done; - rv = registry->AddSubtreeRaw(key, "?from=multipart/x-mixed-replace?to=text/html", &key1); if (NS_FAILED(rv)) goto done; } + + // FTP directory listing converter registration + nsIFactory *FTPDirListingFactSup; + rv = nsComponentManager::FindFactory(kFTPDirListingConverterCID, &FTPDirListingFactSup); + if (NS_SUCCEEDED(rv)) { + rv = nsComponentManager::RegisterFactory(kFTPDirListingConverterCID, + "FTPDirListingConverter", + NS_ISTREAMCONVERTER_KEY "?from=text/ftp-dir-unix?to=application/http-index-format", + FTPDirListingFactSup, + PR_TRUE); + if (NS_FAILED(rv)) goto done; + + rv = registry->AddSubtreeRaw(key, "?from=text/ftp-dir-unix?to=application/http-index-format", &key1); + if (NS_FAILED(rv)) goto done; + } // END STREAM CONVERTER REGISTRATION done: diff --git a/webshell/src/nsWebShell.cpp b/webshell/src/nsWebShell.cpp index f4c99c30f4a3..07786f94c1d2 100644 --- a/webshell/src/nsWebShell.cpp +++ b/webshell/src/nsWebShell.cpp @@ -73,7 +73,8 @@ #include "nsIDOMRange.h" #include "nsIFrameReflow.h" -#include "nsMultiMixedConv.h" // for +#include "nsMultiMixedConv.h" +#include "nsFTPDirListingConv.h" #include "nsIRegistry.h" static NS_DEFINE_CID(kRegistryCID, NS_REGISTRY_CID); @@ -1194,6 +1195,24 @@ nsWebShell::Init(nsNativeWidget aNativeParent, } // STREAM CONVERTER REGISTRATION + + nsIRegistry *registry; + rv = nsServiceManager::GetService(kRegistryCID, NS_GET_IID(nsIRegistry), (nsISupports**) ®istry); + if (NS_FAILED(rv)) goto done; + + + + // open the registry + rv = registry->OpenWellKnownRegistry(nsIRegistry::ApplicationComponentRegistry); + if (NS_FAILED(rv)) goto done; + + // set the key + nsIRegistry::Key key, key1; + + // root key addition + rv = registry->AddSubtree(nsIRegistry::Common, NS_ISTREAMCONVERTER_KEY, &key); + if (NS_FAILED(rv)) goto done; + // multipart mixed converter registration nsIFactory *multiMixedFactSup; rv = nsComponentManager::FindFactory(kMultiMixedConverterCID, &multiMixedFactSup); @@ -1205,23 +1224,24 @@ nsWebShell::Init(nsNativeWidget aNativeParent, PR_TRUE); if (NS_FAILED(rv)) goto done; - nsIRegistry *registry; - rv = nsServiceManager::GetService(kRegistryCID, NS_GET_IID(nsIRegistry), (nsISupports**) ®istry); - if (NS_FAILED(rv)) goto done; - - // open the registry - rv = registry->OpenWellKnownRegistry(nsIRegistry::ApplicationComponentRegistry); - if (NS_FAILED(rv)) goto done; - - // set the key - nsIRegistry::Key key, key1; - - rv = registry->AddSubtree(nsIRegistry::Common, NS_ISTREAMCONVERTER_KEY, &key); - if (NS_FAILED(rv)) goto done; - rv = registry->AddSubtreeRaw(key, "?from=multipart/x-mixed-replace?to=text/html", &key1); if (NS_FAILED(rv)) goto done; } + + // FTP directory listing converter registration + nsIFactory *FTPDirListingFactSup; + rv = nsComponentManager::FindFactory(kFTPDirListingConverterCID, &FTPDirListingFactSup); + if (NS_SUCCEEDED(rv)) { + rv = nsComponentManager::RegisterFactory(kFTPDirListingConverterCID, + "FTPDirListingConverter", + NS_ISTREAMCONVERTER_KEY "?from=text/ftp-dir-unix?to=application/http-index-format", + FTPDirListingFactSup, + PR_TRUE); + if (NS_FAILED(rv)) goto done; + + rv = registry->AddSubtreeRaw(key, "?from=text/ftp-dir-unix?to=application/http-index-format", &key1); + if (NS_FAILED(rv)) goto done; + } // END STREAM CONVERTER REGISTRATION done: