Bug #360702 --> Look for ISP RDF files in extension directories that contain "isp" sub directories. This should make it easy for extensions to make account setup easy for ISPs. sr=bienvenu
git-svn-id: svn://10.0.0.236/trunk@216539 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
cf0865ef8c
commit
bea3b02a66
@ -45,21 +45,16 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = newsblog
|
||||
|
||||
EXPORT_DIR = $(DIST)/bin/defaults/isp
|
||||
EXPORT_DIR_L10N = $(DIST)/bin/defaults/isp/$(AB_CD)
|
||||
EXPORT_DIR = $(DIST)/bin/isp
|
||||
|
||||
GARBAGE += $(EXPORT_DIR)/rss.rdf \
|
||||
$(EXPORT_DIR_L10N)/rss.rdf
|
||||
GARBAGE += $(EXPORT_DIR)/rss.rdf
|
||||
|
||||
libs:: rss.rdf
|
||||
$(INSTALL) $^ $(EXPORT_DIR)
|
||||
$(INSTALL) $^ $(EXPORT_DIR_L10N)
|
||||
|
||||
install:: rss.rdf
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/isp
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/isp/$(AB_CD)
|
||||
|
||||
EXTRA_COMPONENTS = js/newsblog.js
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
@ -180,6 +180,15 @@ defaults/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/
|
||||
defaults/profile/extensions/Extensions.rdf
|
||||
defaults/profile/extensions/installed-extensions.txt
|
||||
defaults/profile/extensions/
|
||||
defaults/isp/rss.rdf
|
||||
defaults/isp/movemail.rdf
|
||||
defaults/isp/dotmac.rdf
|
||||
defaults/isp/en-US/rss.rdf
|
||||
defaults/isp/en-US/movemail.rdf
|
||||
defaults/isp/en-US/dotmac.rdf
|
||||
defaults/isp/en-US/
|
||||
defaults/isp/
|
||||
|
||||
@DLL_PREFIX@zlib@DLL_SUFFIX@
|
||||
#Remove Talkback files from old location (in case user updates from 1.0.x)
|
||||
components/BrandRes.dll
|
||||
|
||||
@ -42,8 +42,12 @@ VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
ifdef MOZ_XUL_APP
|
||||
EXPORT_DIR = $(DIST)/bin/isp
|
||||
else
|
||||
EXPORT_DIR = $(DIST)/bin/defaults/isp
|
||||
EXPORT_DIR_L10N = $(DIST)/bin/defaults/isp/$(AB_CD)
|
||||
endif
|
||||
|
||||
EXPORT_RESOURCE_FILES = \
|
||||
$(NULL)
|
||||
@ -58,16 +62,24 @@ endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
GARBAGE += $(addprefix $(EXPORT_DIR)/, $(EXPORT_RESOURCE_FILES)) \
|
||||
$(addprefix $(EXPORT_DIR_L10N)/, $(EXPORT_RESOURCE_FILES))
|
||||
GARBAGE += $(addprefix $(EXPORT_DIR)/, $(EXPORT_RESOURCE_FILES))
|
||||
|
||||
ifndef MOZ_XUL_APP
|
||||
GARBAGE += $(addprefix $(EXPORT_DIR_L10N)/, $(EXPORT_RESOURCE_FILES))
|
||||
endif
|
||||
|
||||
ifneq ($(EXPORT_RESOURCE_FILES),$(NULL))
|
||||
libs:: $(EXPORT_RESOURCE_FILES)
|
||||
$(INSTALL) $^ $(EXPORT_DIR)
|
||||
$(INSTALL) $^ $(EXPORT_DIR_L10N)
|
||||
|
||||
install:: $(EXPORT_RESOURCE_FILES)
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/isp
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/isp/$(AB_CD)
|
||||
endif
|
||||
|
||||
ifndef MOZ_XUL_APP
|
||||
libs:: $(EXPORT_RESOURCE_FILES)
|
||||
$(INSTALL) $^ $(EXPORT_DIR_L10N)
|
||||
|
||||
install:: $(EXPORT_RESOURCE_FILES)
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/isp/$(AB_CD)
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -46,7 +46,6 @@
|
||||
<NC:sampleEmail>steve@mac.com</NC:sampleEmail>
|
||||
<NC:sampleUserName>steve</NC:sampleUserName>
|
||||
<NC:emailIDDescription>.Mac username:</NC:emailIDDescription>
|
||||
<NC:emailIDFieldTitle>username</NC:emailIDFieldTitle>
|
||||
<NC:showServerDetailsOnWizardSummary>true</NC:showServerDetailsOnWizardSummary>
|
||||
</NC:nsIMsgAccount>
|
||||
</NC:providers>
|
||||
|
||||
@ -85,6 +85,7 @@ REQUIRES = xpcom \
|
||||
windowwatcher \
|
||||
webbrwsr \
|
||||
exthandler \
|
||||
xulapp \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
@ -156,6 +157,10 @@ ifneq (,$(filter $(MOZ_GFX_TOOLKIT),gtk gtk2))
|
||||
CPPSRCS += nsMessengerUnixIntegration.cpp
|
||||
endif
|
||||
|
||||
ifdef MOZ_XUL_APP
|
||||
CPPSRCS += nsMailDirProvider.cpp
|
||||
endif
|
||||
|
||||
ifdef MOZ_LDAP_XPCOM
|
||||
REQUIRES += mozldap \
|
||||
$(NULL)
|
||||
@ -167,6 +172,7 @@ endif
|
||||
EXPORTS = \
|
||||
nsMsgRDFDataSource.h \
|
||||
nsMsgRDFUtils.h \
|
||||
nsMailDirServiceDefs.h \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
|
||||
172
mozilla/mailnews/base/src/nsMailDirProvider.cpp
Executable file
172
mozilla/mailnews/base/src/nsMailDirProvider.cpp
Executable file
@ -0,0 +1,172 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Mail Directory Provider.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Scott MacGregor <mscott@mozilla.org>.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
#include "nsMailDirProvider.h"
|
||||
#include "nsMailDirServiceDefs.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsString.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
|
||||
#include "nsICategoryManager.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsMailDirProvider,
|
||||
nsIDirectoryServiceProvider,
|
||||
nsIDirectoryServiceProvider2)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailDirProvider::GetFile(const char *aKey, PRBool *aPersist,
|
||||
nsIFile* *aResult)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailDirProvider::GetFiles(const char *aKey,
|
||||
nsISimpleEnumerator* *aResult)
|
||||
{
|
||||
if (strcmp(aKey, ISP_SEARCH_DIRECTORY_LIST) != 0) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIProperties> dirSvc =
|
||||
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
|
||||
if (!dirSvc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> list;
|
||||
nsresult rv = dirSvc->Get(XRE_EXTENSIONS_DIR_LIST,
|
||||
NS_GET_IID(nsISimpleEnumerator),
|
||||
getter_AddRefs(list));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> e = new AppendingEnumerator(list);
|
||||
if (!e)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
*aResult = nsnull;
|
||||
e.swap(*aResult);
|
||||
return NS_SUCCESS_AGGREGATE_RESULT;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsMailDirProvider::AppendingEnumerator,
|
||||
nsISimpleEnumerator)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailDirProvider::AppendingEnumerator::HasMoreElements(PRBool *aResult)
|
||||
{
|
||||
*aResult = mNext ? PR_TRUE : PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailDirProvider::AppendingEnumerator::GetNext(nsISupports* *aResult)
|
||||
{
|
||||
if (aResult)
|
||||
NS_ADDREF(*aResult = mNext);
|
||||
|
||||
mNext = nsnull;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
// Ignore all errors
|
||||
|
||||
PRBool more;
|
||||
while (NS_SUCCEEDED(mBase->HasMoreElements(&more)) && more) {
|
||||
nsCOMPtr<nsISupports> nextbasesupp;
|
||||
mBase->GetNext(getter_AddRefs(nextbasesupp));
|
||||
|
||||
nsCOMPtr<nsIFile> nextbase(do_QueryInterface(nextbasesupp));
|
||||
if (!nextbase)
|
||||
continue;
|
||||
|
||||
nextbase->Clone(getter_AddRefs(mNext));
|
||||
if (!mNext)
|
||||
continue;
|
||||
|
||||
mNext->AppendNative(NS_LITERAL_CSTRING("isp"));
|
||||
|
||||
PRBool exists;
|
||||
rv = mNext->Exists(&exists);
|
||||
if (NS_SUCCEEDED(rv) && exists)
|
||||
break;
|
||||
|
||||
mNext = nsnull;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsMailDirProvider::AppendingEnumerator::AppendingEnumerator
|
||||
(nsISimpleEnumerator* aBase) :
|
||||
mBase(aBase)
|
||||
{
|
||||
// Initialize mNext to begin
|
||||
GetNext(nsnull);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsMailDirProvider::Register(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath, const char *aLoaderStr,
|
||||
const char *aType,
|
||||
const nsModuleComponentInfo *aInfo)
|
||||
{
|
||||
nsCOMPtr<nsICategoryManager> catMan =
|
||||
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
|
||||
if (!catMan)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return catMan->AddCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY,
|
||||
"mail-directory-provider",
|
||||
NS_MAILDIRPROVIDER_CONTRACTID, PR_TRUE, PR_TRUE, nsnull);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsMailDirProvider::Unregister(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath,
|
||||
const char *aLoaderStr,
|
||||
const nsModuleComponentInfo *aInfo)
|
||||
{
|
||||
nsCOMPtr<nsICategoryManager> catMan =
|
||||
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
|
||||
if (!catMan)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return catMan->DeleteCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY,
|
||||
"mail-directory-provider",
|
||||
PR_TRUE);
|
||||
}
|
||||
77
mozilla/mailnews/base/src/nsMailDirProvider.h
Normal file
77
mozilla/mailnews/base/src/nsMailDirProvider.h
Normal file
@ -0,0 +1,77 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Mail Directory Provider.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* the Mozilla Foundation <http://www.mozilla.org>.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Scott MacGregor <mscott@mozilla.org> (Original Code)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsMailDirProvider_h__
|
||||
#define nsMailDirProvider_h__
|
||||
|
||||
#include "nsIDirectoryService.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
|
||||
class nsMailDirProvider : public nsIDirectoryServiceProvider2
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
|
||||
NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
|
||||
|
||||
static NS_METHOD Register(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath, const char *aLoaderStr,
|
||||
const char *aType,
|
||||
const nsModuleComponentInfo *aInfo);
|
||||
|
||||
static NS_METHOD Unregister(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath, const char *aLoaderStr,
|
||||
const nsModuleComponentInfo *aInfo);
|
||||
|
||||
private:
|
||||
class AppendingEnumerator : public nsISimpleEnumerator
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISIMPLEENUMERATOR
|
||||
|
||||
AppendingEnumerator(nsISimpleEnumerator* aBase);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsISimpleEnumerator> mBase;
|
||||
nsCOMPtr<nsIFile> mNext;
|
||||
};
|
||||
};
|
||||
|
||||
#endif // nsMailDirProvider_h__
|
||||
57
mozilla/mailnews/base/src/nsMailDirServiceDefs.h
Normal file
57
mozilla/mailnews/base/src/nsMailDirServiceDefs.h
Normal file
@ -0,0 +1,57 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mail Directory Provider.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Scott MacGregor <mscott@mozilla.org>.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
#ifndef nsMailDirectoryServiceDefs_h___
|
||||
#define nsMailDirectoryServiceDefs_h___
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Defines property names for directories available from the mail-specific
|
||||
// nsMailDirProvider.
|
||||
//
|
||||
// System and XPCOM properties are defined in nsDirectoryServiceDefs.h.
|
||||
// General application properties are defined in nsAppDirectoryServiceDefs.h.
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Files and directories that exist on a per- basis.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define ISP_SEARCH_DIRECTORY_LIST "ISPDL"
|
||||
|
||||
#endif
|
||||
@ -51,19 +51,24 @@
|
||||
#include "nsIMsgMailSession.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
|
||||
#ifdef MOZ_XUL_APP
|
||||
#include "nsIChromeRegistry.h"
|
||||
#include "nsMailDirServiceDefs.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsIDirectoryEnumerator.h"
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kRDFCompositeDataSourceCID, NS_RDFCOMPOSITEDATASOURCE_CID);
|
||||
static NS_DEFINE_CID(kRDFXMLDataSourceCID, NS_RDFXMLDATASOURCE_CID);
|
||||
|
||||
nsMsgServiceProviderService::nsMsgServiceProviderService()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
nsMsgServiceProviderService::~nsMsgServiceProviderService()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
{}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsMsgServiceProviderService, nsIRDFDataSource)
|
||||
|
||||
@ -77,6 +82,9 @@ nsMsgServiceProviderService::Init()
|
||||
mInnerDataSource = do_CreateInstance(kRDFCompositeDataSourceCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
#ifdef MOZ_XUL_APP
|
||||
LoadISPFiles();
|
||||
#else
|
||||
nsCOMPtr<nsIMsgMailSession> mailSession = do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -110,46 +118,131 @@ nsMsgServiceProviderService::Init()
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed reading in the datasource\n");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_XUL_APP
|
||||
/**
|
||||
* Looks for ISP configuration files in <.exe>\isp and any sub directories called isp
|
||||
* located in the user's extensions directory.
|
||||
*/
|
||||
void nsMsgServiceProviderService::LoadISPFiles()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIProperties> dirSvc = do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
// get the current locale, we'll need this later on...don't bail out in the case of an error
|
||||
nsCOMPtr<nsIXULChromeRegistry> packageRegistry = do_GetService("@mozilla.org/chrome/chrome-registry;1");
|
||||
nsCAutoString localeName;
|
||||
if (packageRegistry)
|
||||
packageRegistry->GetSelectedLocale(NS_LITERAL_CSTRING("global"), localeName);
|
||||
|
||||
// First, process any isp files shipped by default in <location of exe>\isp
|
||||
nsCOMPtr<nsIFile> ispDirectory;
|
||||
rv = dirSvc->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
|
||||
NS_GET_IID(nsIFile), getter_AddRefs(ispDirectory));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
ispDirectory->AppendNative(NS_LITERAL_CSTRING("isp"));
|
||||
LoadISPFilesFromDir(ispDirectory);
|
||||
// also look in <location of exe>\isp\AB-CD
|
||||
if (!localeName.IsEmpty())
|
||||
{
|
||||
ispDirectory->AppendNative(localeName);
|
||||
LoadISPFilesFromDir(ispDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
// Now walk through the extension directories
|
||||
nsCOMPtr<nsISimpleEnumerator> ispDirectories;
|
||||
rv = dirSvc->Get(ISP_SEARCH_DIRECTORY_LIST,
|
||||
NS_GET_IID(nsISimpleEnumerator), getter_AddRefs(ispDirectories));
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
PRBool hasMore;
|
||||
while (NS_SUCCEEDED(ispDirectories->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> elem;
|
||||
ispDirectories->GetNext(getter_AddRefs(elem));
|
||||
|
||||
ispDirectory = do_QueryInterface(elem);
|
||||
if (ispDirectory)
|
||||
{
|
||||
LoadISPFilesFromDir(ispDirectory);
|
||||
|
||||
// If we have a current locale, look in isp\ab-cd in case there are locale specific isp files.
|
||||
nsCOMPtr<nsIFile> localeISPDir;
|
||||
ispDirectory->Clone(getter_AddRefs(localeISPDir));
|
||||
if (localeISPDir && !localeName.IsEmpty())
|
||||
{
|
||||
localeISPDir->AppendNative(localeName);
|
||||
LoadISPFilesFromDir(localeISPDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nsMsgServiceProviderService::LoadISPFilesFromDir(nsIFile* aDir)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
PRBool check = PR_FALSE;
|
||||
rv = aDir->Exists(&check);
|
||||
if (NS_FAILED(rv) || !check)
|
||||
return;
|
||||
|
||||
rv = aDir->IsDirectory(&check);
|
||||
if (NS_FAILED(rv) || !check)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> e;
|
||||
rv = aDir->GetDirectoryEntries(getter_AddRefs(e));
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDirectoryEnumerator> files(do_QueryInterface(e));
|
||||
if (!files)
|
||||
return;
|
||||
|
||||
// we only care about the .rdf files in this directory
|
||||
nsCOMPtr<nsIFile> file;
|
||||
while (NS_SUCCEEDED(files->GetNextFile(getter_AddRefs(file))) && file) {
|
||||
nsAutoString leafName;
|
||||
file->GetLeafName(leafName);
|
||||
if (!StringEndsWith(leafName, NS_LITERAL_STRING(".rdf")))
|
||||
continue;
|
||||
|
||||
nsCAutoString urlSpec;
|
||||
rv = NS_GetURLSpecFromFile(file, urlSpec);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
LoadDataSource(urlSpec.get());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsMsgServiceProviderService::LoadDataSource(const char *aURI)
|
||||
{
|
||||
nsresult rv;
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIRDFDataSource> ds =
|
||||
do_CreateInstance(kRDFXMLDataSourceCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
nsCOMPtr<nsIRDFDataSource> ds =
|
||||
do_CreateInstance(kRDFXMLDataSourceCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIRDFRemoteDataSource> remote =
|
||||
do_QueryInterface(ds, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = remote->Init(aURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIRDFRemoteDataSource> remote =
|
||||
do_QueryInterface(ds, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = remote->Init(aURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// for now load synchronously (async seems to be busted)
|
||||
rv = remote->Refresh(PR_TRUE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed refresh?\n");
|
||||
|
||||
#ifdef DEBUG_alecf
|
||||
PRBool loaded;
|
||||
rv = remote->GetLoaded(&loaded);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed getload\n");
|
||||
rv = mInnerDataSource->AddDataSource(ds);
|
||||
|
||||
printf("Before refresh: datasource is %s\n", loaded ? "loaded" : "not loaded");
|
||||
#endif
|
||||
|
||||
// for now load synchronously (async seems to be busted)
|
||||
rv = remote->Refresh(PR_TRUE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed refresh?\n");
|
||||
|
||||
#ifdef DEBUG_alecf
|
||||
rv = remote->GetLoaded(&loaded);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed getload\n");
|
||||
printf("After refresh: datasource is %s\n", loaded ? "loaded" : "not loaded");
|
||||
#endif
|
||||
|
||||
rv = mInnerDataSource->AddDataSource(ds);
|
||||
|
||||
return rv;
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -57,12 +57,12 @@ class nsMsgServiceProviderService : public nsIRDFDataSource
|
||||
NS_FORWARD_NSIRDFDATASOURCE(mInnerDataSource->)
|
||||
|
||||
private:
|
||||
|
||||
nsCOMPtr<nsIRDFCompositeDataSource> mInnerDataSource;
|
||||
|
||||
nsresult LoadDataSource(const char *aURL);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#ifdef MOZ_XUL_APP
|
||||
void LoadISPFilesFromDir(nsIFile* aDir);
|
||||
void LoadISPFiles();
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -104,6 +104,7 @@
|
||||
#include "nsRssIncomingServer.h"
|
||||
#include "nsRssService.h"
|
||||
#include "nsMsgTagService.h"
|
||||
#include "nsMailDirProvider.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include "nsMessengerWinIntegration.h"
|
||||
@ -338,6 +339,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgProgress)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSpamSettings)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgTagService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCidProtocolHandler)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMailDirProvider)
|
||||
#ifdef XP_WIN
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMessengerWinIntegration, Init)
|
||||
#endif
|
||||
@ -845,6 +847,14 @@ static const nsModuleComponentInfo gComponents[] = {
|
||||
NS_CIDPROTOCOLHANDLER_CONTRACTID,
|
||||
nsCidProtocolHandlerConstructor,
|
||||
},
|
||||
{
|
||||
"mail director provider",
|
||||
MAILDIRPROVIDER_CID,
|
||||
NS_MAILDIRPROVIDER_CONTRACTID,
|
||||
nsMailDirProviderConstructor,
|
||||
nsMailDirProvider::Register,
|
||||
nsMailDirProvider::Unregister
|
||||
},
|
||||
#ifdef XP_WIN
|
||||
{ "Windows OS Integration", NS_MESSENGERWININTEGRATION_CID,
|
||||
NS_MESSENGEROSINTEGRATION_CONTRACTID,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user