зеркало из https://github.com/mozilla/gecko-dev.git
Bug 263042 part 2 - move the LDAP parts of XPFE autocomplete to mailnews/addrbook, which is the only consumer, r=dmose
This commit is contained in:
Родитель
ba983bef9e
Коммит
b551df41b1
|
@ -87,6 +87,7 @@
|
|||
#include "nsAbLDAPReplicationData.h"
|
||||
#include "nsAbLDAPChangeLogQuery.h"
|
||||
#include "nsAbLDAPChangeLogData.h"
|
||||
#include "nsLDAPAutoCompleteSession.h"
|
||||
#endif
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAddressBook)
|
||||
|
@ -126,6 +127,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDAPReplicationQuery)
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDAPProcessReplicationData)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDAPChangeLogQuery)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDAPProcessChangeLogData)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLDAPAutoCompleteSession)
|
||||
#endif
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbDirectoryQueryProxy)
|
||||
|
@ -315,6 +317,11 @@ static const nsModuleComponentInfo components[] =
|
|||
NS_ABLDAPAUTOCOMPFORMATTER_CONTRACTID,
|
||||
nsAbLDAPAutoCompFormatterConstructor },
|
||||
|
||||
{ "LDAP Autocomplete Session",
|
||||
NS_LDAPAUTOCOMPLETESESSION_CID,
|
||||
"@mozilla.org/autocompleteSession;1?type=ldap",
|
||||
nsLDAPAutoCompleteSessionConstructor },
|
||||
|
||||
#endif
|
||||
|
||||
{ "The directory query proxy interface",
|
||||
|
|
|
@ -73,6 +73,8 @@ XPIDLSRCS = \
|
|||
ifdef MOZ_LDAP_XPCOM
|
||||
XPIDLSRCS += \
|
||||
nsILDAPPrefsService.idl \
|
||||
nsILDAPAutoCompleteSession.idl \
|
||||
nsILDAPAutoCompFormatter.idl \
|
||||
nsIAbLDAPAutoCompFormatter.idl \
|
||||
nsIAbLDAPReplicationService.idl \
|
||||
nsIAbLDAPReplicationQuery.idl \
|
||||
|
|
|
@ -146,6 +146,7 @@ CPPSRCS += nsAbLDAPDirectory.cpp \
|
|||
nsAbLDAPReplicationData.cpp \
|
||||
nsAbLDAPChangeLogQuery.cpp \
|
||||
nsAbLDAPChangeLogData.cpp \
|
||||
nsLDAPAutoCompleteSession.cpp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
|
|
@ -212,12 +212,12 @@ nsAbLDAPAutoCompFormatter::FormatException(PRInt32 aState,
|
|||
}
|
||||
|
||||
rv = stringBundleSvc->CreateBundle(
|
||||
"chrome://global/locale/ldapAutoCompErrs.properties",
|
||||
"chrome://mailnews/locale/addressbook/ldapAutoCompErrs.properties",
|
||||
getter_AddRefs(ldapACBundle));
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("nsAbLDAPAutoCompleteFormatter::FormatException():"
|
||||
" error creating string bundle"
|
||||
" chrome://global/locale/ldapAutoCompErrs.properties");
|
||||
" chrome://mailnews/locale/addressbook/ldapAutoCompErrs.properties");
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ nsAbLDAPAutoCompFormatter::FormatException(PRInt32 aState,
|
|||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("nsAbLDAPAutoCompleteFormatter::FormatException():"
|
||||
" error getting general error from bundle"
|
||||
" chrome://global/locale/ldapAutoCompErrs.properties");
|
||||
" chrome://mailnews/locale/addressbook/ldapAutoCompErrs.properties");
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -158,6 +158,7 @@
|
|||
#include "nsAbLDAPReplicationData.h"
|
||||
#include "nsAbLDAPChangeLogQuery.h"
|
||||
#include "nsAbLDAPChangeLogData.h"
|
||||
#include "nsLDAPAutoCompleteSession.h"
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -381,6 +382,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDAPReplicationQuery)
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDAPProcessReplicationData)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDAPChangeLogQuery)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbLDAPProcessChangeLogData)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLDAPAutoCompleteSession)
|
||||
#endif
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbDirectoryQueryProxy)
|
||||
|
@ -923,6 +925,10 @@ static const nsModuleComponentInfo gComponents[] = {
|
|||
NS_ABLDAPSACDIRFACTORY_CONTRACTID, nsAbLDAPDirFactoryConstructor },
|
||||
{ "Address book LDAP autocomplete formatter", NS_ABLDAPAUTOCOMPFORMATTER_CID,
|
||||
NS_ABLDAPAUTOCOMPFORMATTER_CONTRACTID,nsAbLDAPAutoCompFormatterConstructor },
|
||||
{ "LDAP Autocomplete Session",
|
||||
NS_LDAPAUTOCOMPLETESESSION_CID,
|
||||
"@mozilla.org/autocompleteSession;1?type=ldap",
|
||||
nsLDAPAutoCompleteSessionConstructor },
|
||||
#endif
|
||||
{ "The directory query proxy interface", NS_ABDIRECTORYQUERYPROXY_CID,
|
||||
NS_ABDIRECTORYQUERYPROXY_CONTRACTID, nsAbDirectoryQueryProxyConstructor},
|
||||
|
|
|
@ -192,6 +192,7 @@ messenger.jar:
|
|||
|
||||
en-US.jar:
|
||||
* locale/en-US/messenger/contents.rdf (base/resources/locale/en-US/contents.rdf)
|
||||
locale/en-US/messenger/addressbook/ldapAutoCompErrs.properties (addrbook/resources/locale/en-US/ldapAutoCompErrs.properties)
|
||||
locale/en-US/messenger/addressbook/abAddressBookNameDialog.dtd (addrbook/resources/locale/en-US/abAddressBookNameDialog.dtd)
|
||||
locale/en-US/messenger/addressbook/abCardOverlay.dtd (addrbook/resources/locale/en-US/abCardOverlay.dtd)
|
||||
locale/en-US/messenger/addressbook/abCardViewOverlay.dtd (addrbook/resources/locale/en-US/abCardViewOverlay.dtd)
|
||||
|
|
|
@ -51,13 +51,5 @@ XPIDLSRCS = \
|
|||
nsIAutoCompleteSession.idl \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_LDAP_XPCOM
|
||||
REQUIRES += mozldap necko
|
||||
XPIDLSRCS += \
|
||||
nsILDAPAutoCompleteSession.idl \
|
||||
nsILDAPAutoCompFormatter.idl \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Dan Mosedale <dmose@netscape.com> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 "nsISupports.idl"
|
||||
|
||||
interface nsIAutoCompleteItem;
|
||||
interface nsILDAPMessage;
|
||||
|
||||
/**
|
||||
* An interface to allow different users of nsILDAPAutoCompleteSession to
|
||||
* format each nsILDAPMessage into an nsIAutoCompleteItem as it sees fit.
|
||||
*/
|
||||
[scriptable, uuid(cbec617c-22d2-4286-8308-0ef8bf57c0ce)]
|
||||
interface nsILDAPAutoCompFormatter : nsISupports {
|
||||
|
||||
/**
|
||||
* Returns an nsIAutoCompleteItem generated from the data in
|
||||
* the given nsILDAPMessage.
|
||||
*
|
||||
* @param aMessage message to be formatted
|
||||
* @return resulting nsIAutoCompleteItem
|
||||
*/
|
||||
nsIAutoCompleteItem format(in nsILDAPMessage aMessage);
|
||||
|
||||
/**
|
||||
* Gets a list of all the LDAP attributes that should be requested
|
||||
* from the LDAP server when a lookup is done. This avoids
|
||||
* wasting server time, bandwidth, and client time processing
|
||||
* unused attributes.
|
||||
*
|
||||
* Note that this is only required to be called by the
|
||||
* nsILDAPAutoCompleteSession implementation when the
|
||||
* nsILDAPAutoCompleteSession::formatter IDL attribute is set. .
|
||||
* So if for some reason, the LDAP attributes to be returned by
|
||||
* searches has to change (eg because the user changed a
|
||||
* preference), the nsILDAPAutoCompleteSession::formatter IDL
|
||||
* attribute should be re-set to the same object to force a new
|
||||
* getAttributes() call.
|
||||
*
|
||||
* @param aCount number of attributes in the array
|
||||
* @param aAttrs list of LDAP attributes to request
|
||||
*/
|
||||
void getAttributes(out unsigned long aCount,
|
||||
[retval, array, size_is(aCount)] out string aAttrs);
|
||||
|
||||
/**
|
||||
* This method formats an error condition into an nsIAutoCompleteItem
|
||||
* for display to the user. Specifically, the state that the session
|
||||
* was in when the error occured (aState) is formatted into a general
|
||||
* error message which is put in the value attribute of the item,
|
||||
* and the specific error (aErrorCode) is formatted into another message
|
||||
* which is put in an nsISupportsString in the param attribute of the
|
||||
* item.
|
||||
*
|
||||
* @param aState state of autocomplete session when error occurred
|
||||
* @param aErrorCode specific error encountered
|
||||
*
|
||||
* @return newly generated item
|
||||
*/
|
||||
nsIAutoCompleteItem formatException(in long aState,
|
||||
in nsresult aErrorCode);
|
||||
|
||||
/**
|
||||
* Possible states that can be passed in aState to formatException
|
||||
*/
|
||||
const long STATE_UNBOUND = 0;
|
||||
const long STATE_INITIALIZING = 1;
|
||||
const long STATE_BINDING = 2;
|
||||
const long STATE_BOUND = 3;
|
||||
const long STATE_SEARCHING = 4;
|
||||
|
||||
};
|
|
@ -1,149 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Dan Mosedale <dmose@netscape.com> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 "nsIAutoCompleteSession.idl"
|
||||
|
||||
// forward decls
|
||||
//
|
||||
interface nsILDAPURL;
|
||||
interface nsILDAPAutoCompFormatter;
|
||||
interface nsIAuthPrompt;
|
||||
interface nsIMutableArray;
|
||||
|
||||
/**
|
||||
* Extends nsIAutoCompleteSession to have various LDAP-specific parameters.
|
||||
* and output format.
|
||||
*/
|
||||
[scriptable, uuid(e7f26534-f96c-4c87-803c-30cdf0bc2973)]
|
||||
interface nsILDAPAutoCompleteSession : nsIAutoCompleteSession {
|
||||
|
||||
/**
|
||||
* A template used to construct the RFC 1960 LDAP search filter to use
|
||||
* while autocompleting.
|
||||
*
|
||||
* The authoritative documentation for the format in use can be found at
|
||||
* at <http://docs.iplanet.com/docs/manuals/dirsdk/csdk41/html/filter.htm>.
|
||||
* The Linux/OpenLDAP man page for ldapfilter.conf(5) does a pretty decent
|
||||
* job as well, however.
|
||||
*
|
||||
* As of this writing, the "@mozilla.org/autocompleteSession;1?type=ldap"
|
||||
* contractid happens to use a default value of
|
||||
* (|(cn=%v1*%v2-*)(mail=%v1*%v2-*)(sn=%v1*%v2-*))
|
||||
*
|
||||
* @exception NS_ERROR_NULL_POINTER NULL pointer passed to getter
|
||||
* @exception NS_ERROR_OUT_OF_MEMORY Getter couldn't allocate string
|
||||
*/
|
||||
attribute AUTF8String filterTemplate;
|
||||
|
||||
/**
|
||||
* At most this many nsIAutoCompleteItems will be returned. This
|
||||
* is useful for keeping bandwidth usage over slow-speed
|
||||
* connections as well as ensuring that the number of choices
|
||||
* offered in the UI is manageble.
|
||||
*
|
||||
* 1-65535 are interpreted literally
|
||||
* 0 means "unlimited"
|
||||
* -1 uses the default limit for the LDAP connection in use
|
||||
*
|
||||
* @exception NS_ERROR_NULL_POINTER NULL pointer passed to getter
|
||||
* @exception NS_ERROR_ILLEGAL_VALUE Out-of-range value passed to setter
|
||||
*/
|
||||
attribute long maxHits;
|
||||
|
||||
/**
|
||||
* Strings shorter than this will return |nsIAutoCompleteStatus::ignored|
|
||||
* rather than triggering a search. This allows browsers to be
|
||||
* configured to not search on substrings so short that they
|
||||
* aren't indexed by the LDAP server (such searches can use
|
||||
* significantly more server resources and return a very large
|
||||
* number of entries). cjkMinStringLength is used for CJK
|
||||
* languages, and minStringLength for everything else. As of this
|
||||
* writing, the "@mozilla.org/autocompleteSession;1?type=ldap"
|
||||
* contractid uses defaults of two and zero, respectively. This
|
||||
* avoids most unindexed searches with at least one widely-deployed
|
||||
* webserver, but allows CJK languages, where a single glyph can be an
|
||||
* an entire name to still get results.
|
||||
*
|
||||
* @exception NS_ERROR_NULL_POINTER NULL pointer passed to getter
|
||||
*/
|
||||
attribute unsigned long minStringLength;
|
||||
attribute unsigned long cjkMinStringLength;
|
||||
|
||||
/**
|
||||
* LDAP server to complete against, in ldap: URL format.
|
||||
* May change to an nsILDAPServer once that infrastructure lands.
|
||||
*
|
||||
* @exception NS_ERROR_NULL_POINTER NULL pointer passed to getter
|
||||
*/
|
||||
attribute nsILDAPURL serverURL;
|
||||
|
||||
/**
|
||||
* Callback used to format an individual LDAP message into an
|
||||
* nsIAutoCompleteItem.
|
||||
*/
|
||||
attribute nsILDAPAutoCompFormatter formatter;
|
||||
|
||||
/**
|
||||
* "Login as..." this ID. Currently, this must be specified as a DN.
|
||||
* In the future, we may support userid and/or email address as well.
|
||||
* If unset, bind anonymously.
|
||||
*/
|
||||
attribute AUTF8String login;
|
||||
|
||||
/**
|
||||
* If set, use this object to get a password for logging in to the server.
|
||||
*/
|
||||
attribute nsIAuthPrompt authPrompter;
|
||||
|
||||
/**
|
||||
* What version of the LDAP protocol should be used? Allowed version
|
||||
* number constants are defined in nsILDAPConnection.idl.
|
||||
*
|
||||
* @exception NS_ERROR_ILLEGAL_VALUE illegal version num passed to setter
|
||||
* @exception NS_ERROR_NULL_POINTER null pointer passed to getter
|
||||
*/
|
||||
attribute unsigned long version;
|
||||
|
||||
/**
|
||||
* If set, these arrays of nsILDAPControls are passed through to the
|
||||
* nsILDAPOperation that searchExt is called on.
|
||||
*/
|
||||
attribute nsIMutableArray searchServerControls;
|
||||
attribute nsIMutableArray searchClientControls;
|
||||
};
|
|
@ -1,59 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- ***** 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.org code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Netscape Communications Corp.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2001
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either of 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 ***** -->
|
||||
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<!-- list all the locales being supplied -->
|
||||
<RDF:Seq about="urn:mozilla:locale:root">
|
||||
<RDF:li resource="urn:mozilla:locale:en-US"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- locale information -->
|
||||
<RDF:Description about="urn:mozilla:locale:en-US">
|
||||
<chrome:packages>
|
||||
<RDF:Seq about="urn:mozilla:locale:en-US:packages">
|
||||
<RDF:li resource="urn:mozilla:locale:en-US:mozldap"/>
|
||||
</RDF:Seq>
|
||||
</chrome:packages>
|
||||
</RDF:Description>
|
||||
|
||||
<!-- Version Information. State that we work only with major version of this
|
||||
package. -->
|
||||
<RDF:Description about="urn:mozilla:locale:en-US:mozldap"
|
||||
#expand chrome:localeVersion="__MOZILLA_LOCALE_VERSION__"/>
|
||||
</RDF:RDF>
|
|
@ -1,145 +0,0 @@
|
|||
# ***** 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 the mozilla.org autocomplete code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Dan Mosedale <dmose@netscape.com>
|
||||
# Robin Foster-Clark <robinf@netscape.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of 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 *****
|
||||
|
||||
# These are error strings for problems that happen while in the
|
||||
# various states declared in nsILDAPAutoCompFormatter.idl. Note that
|
||||
# the number that indexes each error state is the same as the number
|
||||
# corresponding to that state in nsILDAPAutoCompFormatter.idl.
|
||||
|
||||
## @name ERR_STATE_UNBOUND
|
||||
## @loc none
|
||||
0=LDAP initialization problem
|
||||
|
||||
## @name ERR_STATE_INITIALIZING
|
||||
## @loc none
|
||||
1=LDAP server connection failed
|
||||
|
||||
## @name ERR_STATE_BINDING
|
||||
## @loc none
|
||||
2=LDAP server connection failed
|
||||
|
||||
## @name ERR_STATE_BOUND
|
||||
## @loc none
|
||||
3=LDAP server communications problem
|
||||
|
||||
## @name ERR_STATE_SEARCHING
|
||||
## @loc none
|
||||
4=LDAP server search problem
|
||||
|
||||
|
||||
# The format of the alert dialog itself
|
||||
#
|
||||
## @name ALERT_FORMAT
|
||||
## @loc None of %1$S, %2$S, %3$S, and %4$S should be localized. %1$S is the
|
||||
## ERROR_CODE string below, %2$S is the error code itself, %3$S is an
|
||||
## LDAP SDK error message from chrome://mozldap/locale/ldap.properties,
|
||||
## and %4$S is a hint relating to that specific error, found in this file.
|
||||
alertFormat=%1$S %2$S: %3$S\n\n %4$S
|
||||
|
||||
# This string is used in ALERT_FORMAT
|
||||
#
|
||||
## @name ERROR_CODE
|
||||
## @loc none
|
||||
errCode=Error code
|
||||
|
||||
|
||||
## The following errors are for error codes other than LDAP-specific ones.
|
||||
## Someday mozilla will actually have a system for mapping nsresults to
|
||||
## error strings that's actually widely used, unlike nsIErrorService. But
|
||||
## until it does, these strings live here...
|
||||
|
||||
## @name HOST_NOT_FOUND
|
||||
## @loc none
|
||||
5000=Host not found
|
||||
|
||||
## @name GENERIC_ERROR
|
||||
## @loc none
|
||||
9999=Unknown error
|
||||
|
||||
|
||||
# Hints to for the user, associated with specific error codes (ie error code
|
||||
# + 10000)
|
||||
|
||||
|
||||
## @name TIMELIMIT_EXCEEDED_HINT
|
||||
## @loc none
|
||||
10003=Please try again later, or else contact your System Administrator.
|
||||
|
||||
## @name STRONGAUTH_REQUIRED_HINT
|
||||
## @loc none
|
||||
10008=Strong authentication is not currently supported.
|
||||
|
||||
## @name INVALID_SYNTAX_HINT
|
||||
## @loc none
|
||||
10021=Verify that the search filter is correct, and then try again, or else contact your System Administrator. To verify that the search filter is correct, from the Edit menu, choose Preferences, then choose Mail & Newsgroups, and then choose Addressing. Click Edit Directories, and select the LDAP server being used. Click Edit, and then click Advanced to display the Search Filter.
|
||||
|
||||
## @name NO_SUCH_OBJECT_HINT
|
||||
## @loc none
|
||||
10032=Verify that the Base DN is correct, and then try again, or else contact your System Administrator. To verify that the Base DN is correct, from the Edit menu, choose Preferences, then choose Mail & Newsgroups, and then choose Addressing. Click Edit Directories, and select the LDAP server being used. Click Edit to display the Base DN.
|
||||
|
||||
## @name BUSY_HINT
|
||||
## @loc none
|
||||
10051=Please try again later.
|
||||
|
||||
## @name SERVER_DOWN_HINT
|
||||
## @loc none
|
||||
10081=Verify that the Hostname and Port Number are correct, and then try again, or else contact your System Administrator. To verify that the Hostname and Port Number are correct, from the Edit menu, choose Preferences, then choose Mail & Newsgroups, and then choose Addressing. Click Edit Directories, and select the LDAP server being used. Click Edit to display the Hostname. Click Advanced to display the Port Number.
|
||||
|
||||
## @name TIMEOUT_HINT
|
||||
## @loc none
|
||||
10085=Please try again later.
|
||||
|
||||
## @name FILTER_ERROR_HINT
|
||||
## @loc none
|
||||
10087=Verify that the search filter is correct, and then try again, or else contact your System Administrator. To verify that the search filter is correct, from the Edit menu, choose Preferences, then choose Mail & Newsgroups, and then choose Addressing. Click Edit Directories, and select the LDAP server being used. Click Edit, and then click Advanced to display the Search Filter.
|
||||
|
||||
## @name NO_MEMORY_HINT
|
||||
## @loc none
|
||||
10090=Please close some other windows and/or applications and try again.
|
||||
|
||||
## @name CONNECT_ERROR_HINT
|
||||
## @loc none
|
||||
10091=Verify that the Hostname and Port Number are correct, and then try again, or else contact your System Administrator. To verify that the Hostname and Port Number are correct, from the Edit menu, choose Preferences, then choose Mail & Newsgroups, and then choose Addressing. Click Edit Directories, and select the LDAP server being used. Click Edit to display the Hostname. Click Advanced to display the Port Number.
|
||||
|
||||
## @name HOST_NOT_FOUND_HINT
|
||||
## @loc none
|
||||
15000=Verify that the Hostname is correct, and then try again, or else contact your System Administrator. To verify that the Hostname is correct, from the Edit menu, choose Preferences, then choose Mail & Newsgroups, and then choose Addressing. Click Edit Directories, and select the LDAP server being used. Click Edit to display the Hostname.
|
||||
|
||||
## @name GENERIC_HINT
|
||||
## @loc none
|
||||
19999=Please contact your System Administrator.
|
|
@ -58,12 +58,6 @@ REQUIRES = xpcom \
|
|||
|
||||
CPPSRCS = nsAutoComplete.cpp
|
||||
|
||||
ifdef MOZ_LDAP_XPCOM
|
||||
REQUIRES += mozldap necko
|
||||
CPPSRCS += nsLDAPAutoCompleteSession.cpp
|
||||
DEFINES += -DMOZ_LDAP_XPCOM
|
||||
endif
|
||||
|
||||
EXTRA_DSO_LDOPTS += \
|
||||
$(MOZ_UNICHARUTIL_LIBS) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
|
|
|
@ -42,10 +42,6 @@
|
|||
#include "nsReadableUtils.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
|
||||
#if defined(MOZ_LDAP_XPCOM)
|
||||
#include "nsLDAPAutoCompleteSession.h"
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* nsAutoCompleteItem
|
||||
******************************************************************************/
|
||||
|
@ -184,19 +180,7 @@ NS_IMETHODIMP nsAutoCompleteResults::SetDefaultItemIndex(PRInt32 aDefaultItemInd
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteItem)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteResults)
|
||||
|
||||
#if defined(MOZ_LDAP_XPCOM)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLDAPAutoCompleteSession)
|
||||
#endif
|
||||
|
||||
static const nsModuleComponentInfo components[] = {
|
||||
#if defined(MOZ_LDAP_XPCOM)
|
||||
{
|
||||
"LDAP Autocomplete Session",
|
||||
NS_LDAPAUTOCOMPLETESESSION_CID,
|
||||
"@mozilla.org/autocompleteSession;1?type=ldap",
|
||||
nsLDAPAutoCompleteSessionConstructor
|
||||
},
|
||||
#endif
|
||||
{
|
||||
"AutoComplete Search Results",
|
||||
NS_AUTOCOMPLETERESULTS_CID,
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,138 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Dan Mosedale <dmose@netscape.com> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 "nsCOMPtr.h"
|
||||
#include "nsIAutoCompleteSession.h"
|
||||
#include "nsILDAPConnection.h"
|
||||
#include "nsILDAPOperation.h"
|
||||
#include "nsILDAPMessageListener.h"
|
||||
#include "nsILDAPAutoCompleteSession.h"
|
||||
#include "nsILDAPAutoCompFormatter.h"
|
||||
#include "nsILDAPURL.h"
|
||||
#include "nsString.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsIAuthPrompt.h"
|
||||
#include "nsIArray.h"
|
||||
|
||||
// 964665d0-1dd1-11b2-aeae-897834fb00b9
|
||||
//
|
||||
#define NS_LDAPAUTOCOMPLETESESSION_CID \
|
||||
{ 0x964665d0, 0x1dd1, 0x11b2, \
|
||||
{ 0xae, 0xae, 0x89, 0x78, 0x34, 0xfb, 0x00, 0xb9 }}
|
||||
|
||||
class nsLDAPAutoCompleteSession : public nsILDAPMessageListener,
|
||||
public nsILDAPAutoCompleteSession
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIAUTOCOMPLETESESSION
|
||||
NS_DECL_NSILDAPMESSAGELISTENER
|
||||
NS_DECL_NSILDAPAUTOCOMPLETESESSION
|
||||
|
||||
nsLDAPAutoCompleteSession();
|
||||
virtual ~nsLDAPAutoCompleteSession();
|
||||
|
||||
protected:
|
||||
enum SessionState {
|
||||
UNBOUND = nsILDAPAutoCompFormatter::STATE_UNBOUND,
|
||||
INITIALIZING = nsILDAPAutoCompFormatter::STATE_INITIALIZING,
|
||||
BINDING = nsILDAPAutoCompFormatter::STATE_BINDING,
|
||||
BOUND = nsILDAPAutoCompFormatter::STATE_BOUND,
|
||||
SEARCHING = nsILDAPAutoCompFormatter::STATE_SEARCHING
|
||||
} mState;
|
||||
PRUint32 mEntriesReturned; // # of entries returned?
|
||||
nsCOMPtr<nsILDAPConnection> mConnection; // connection used for search
|
||||
nsCOMPtr<nsILDAPOperation> mOperation; // current ldap op
|
||||
nsCOMPtr<nsIAutoCompleteListener> mListener; // callback
|
||||
nsCOMPtr<nsIAutoCompleteResults> mResults; // being built up
|
||||
nsCOMPtr<nsISupportsArray> mResultsArray; // cached, to avoid re-gets
|
||||
nsString mSearchString; // autocomplete this string
|
||||
nsCString mFilterTemplate; // search filter template
|
||||
nsCOMPtr<nsILDAPURL> mServerURL; // URL for the directory to search
|
||||
PRInt32 mMaxHits; // return at most this many entries
|
||||
PRUint32 mMinStringLength; // strings < this size are ignored
|
||||
PRUint32 mCjkMinStringLength; // ignore CJK strings < this size
|
||||
char **mSearchAttrs; // outputFormat search attrs for SearchExt call
|
||||
PRUint32 mSearchAttrsSize; // size of above array
|
||||
nsCOMPtr<nsIAuthPrompt> mAuthPrompter; // used to prompt for the password
|
||||
PRUint32 mVersion; // version of LDAP to use
|
||||
|
||||
// XXX hack until nsUTF8String exists
|
||||
#define nsUTF8String nsCString
|
||||
nsUTF8String mLogin; // authenticate as this user
|
||||
|
||||
// used to format the ldap message into an nsIAutoCompleteItem
|
||||
//
|
||||
nsCOMPtr<nsILDAPAutoCompFormatter> mFormatter;
|
||||
|
||||
// stopgap until nsLDAPService works
|
||||
nsresult InitConnection();
|
||||
|
||||
// check that we bound ok and start then call StartLDAPSearch
|
||||
nsresult OnLDAPBind(nsILDAPMessage *aMessage);
|
||||
|
||||
// add to the results set
|
||||
nsresult OnLDAPSearchEntry(nsILDAPMessage *aMessage);
|
||||
|
||||
// all done; call OnAutoComplete
|
||||
nsresult OnLDAPSearchResult(nsILDAPMessage *aMessage);
|
||||
|
||||
// kick off a search
|
||||
nsresult StartLDAPSearch();
|
||||
|
||||
// check if the LDAP message received is current
|
||||
nsresult IsMessageCurrent(nsILDAPMessage *aMessage, PRBool *aIsCurrent);
|
||||
|
||||
// finish a search by calling mListener->OnAutoComplete, resetting state,
|
||||
// and freeing resources. if aACStatus ==
|
||||
// nsIAutoCompleteStatus::failureItems, then the formatter is called with
|
||||
// aResult and aEndState to create an autocomplete item with the error
|
||||
// info in it. See nsILDAPAutoCompFormatter.idl for more info on this.
|
||||
void FinishAutoCompleteLookup(AutoCompleteStatus aACStatus,
|
||||
const nsresult aResult,
|
||||
enum SessionState aEndState);
|
||||
|
||||
// create and initialize the results array
|
||||
nsresult CreateResultsArray(void);
|
||||
|
||||
nsCOMPtr<nsIMutableArray> mSearchServerControls;
|
||||
nsCOMPtr<nsIMutableArray> mSearchClientControls;
|
||||
};
|
||||
|
|
@ -186,7 +186,6 @@ en-US.jar:
|
|||
locale/en-US/global/console.properties (console/resources/locale/en-US/console.properties)
|
||||
locale/en-US/global/finddialog.dtd (find/resources/locale/en-US/finddialog.dtd)
|
||||
locale/en-US/global/finddialog.properties (find/resources/locale/en-US/finddialog.properties)
|
||||
locale/en-US/global/ldapAutoCompErrs.properties (autocomplete/resources/locale/en-US/ldapAutoCompErrs.properties)
|
||||
* locale/en-US/cookie/contents.rdf (cookie/locale/en-US/contents.rdf)
|
||||
locale/en-US/cookie/cookieAcceptDialog.properties (/toolkit/locales/en-US/chrome/cookie/cookieAcceptDialog.properties)
|
||||
locale/en-US/cookie/cookieAcceptDialog.dtd (/toolkit/locales/en-US/chrome/cookie/cookieAcceptDialog.dtd)
|
||||
|
|
Загрузка…
Ссылка в новой задаче