Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends
nsAbLDAPDirectory Class Reference

#include <nsAbLDAPDirectory.h>

Inheritance diagram for nsAbLDAPDirectory:
Inheritance graph
[legend]
Collaboration diagram for nsAbLDAPDirectory:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS_INHERITED nsAbLDAPDirectory ()
virtual ~nsAbLDAPDirectory ()
NS_IMETHOD Init (const char *aUri)
NS_IMETHOD GetOperations (PRInt32 *aOperations)
NS_IMETHOD GetChildNodes (nsISimpleEnumerator **result)
NS_IMETHOD GetChildCards (nsIEnumerator **result)
NS_IMETHOD HasCard (nsIAbCard *cards, PRBool *hasCard)
NS_IMETHOD GetSupportsMailingLists (PRBool *aSupportsMailingsLists)
NS_IMETHOD GetIsRemote (PRBool *aIsRemote)
NS_IMETHOD GetIsSecure (PRBool *aIsRemote)
NS_IMETHOD GetSearchDuringLocalAutocomplete (PRBool *aSearchDuringLocalAutocomplete)
nsresult GetLDAPConnection (nsILDAPConnection **connection)
nsresult GetLDAPURL (nsILDAPURL **url)
nsresult CreateCard (nsILDAPURL *uri, const char *dn, nsIAbCard **card)
NS_DECL_NSIABDIRECTORYSEARCH
nsresult 
OnSearchFinished (PRInt32 result)
nsresult OnSearchFoundCard (nsIAbCard *card)
void Init (in string uri)
 This method is called by the nsIRDFService after constructing a resource object to initialize it's URI.
NS_DECL_ISUPPORTS NS_IMETHOD EqualsNode (nsIRDFNode *aNode, PRBool *aResult)
boolean EqualsNode (in nsIRDFNode aNode)
NS_IMETHOD GetValue (char **aURI)
NS_IMETHOD GetValueUTF8 (nsACString &aResult)
NS_IMETHOD GetValueConst (const char **aURI)
void GetValueConst ([shared] out string aConstValue)
 An unscriptable version used to avoid a string copy.
NS_IMETHOD EqualsString (const char *aURI, PRBool *aResult)
boolean EqualsString (in string aURI)
 Determine if the resource has the given URI.
NS_IMETHOD GetDelegate (const char *aKey, REFNSIID aIID, void **aResult)
void GetDelegate (in string aKey, in nsIIDRef aIID,[iid_is(aIID), retval] out nsQIResult aResult)
 Retrieve the "delegate" object for this resource.
NS_IMETHOD ReleaseDelegate (const char *aKey)
void ReleaseDelegate (in string aKey)
 Force a delegate to be "unbound" from the resource.
void modifyDirectory (in nsIAbDirectory directory, in nsIAbDirectoryProperties aProperties)
void deleteDirectory (in nsIAbDirectory dierctory)
void deleteCards (in nsISupportsArray cards)
boolean hasCard (in nsIAbCard cards)
boolean hasDirectory (in nsIAbDirectory dir)
nsIAbCard addCard (in nsIAbCard card)
 return value is the card that got added we need to do this, as the card we pass in might be an abstract nsIAbCard, and the caller might need the "real" card (the mdbcard) to get / set non-standard card values
void dropCard (in nsIAbCard card, in boolean needToCopyCard)
void addMailList (in nsIAbDirectory list)
void addMailListWithKey (in nsIAbDirectory list, out PRUint32 key)
void editMailListToDatabase (in string uri, in nsIAbCard listCard)
 Edits an existing mailing list (specified as listCard) into the directory specified by the uri XXX javadoc me.
void copyMailList (in nsIAbDirectory srcList)
void createNewDirectory (in nsIAbDirectoryProperties aProperties)
void createDirectoryByURI (in wstring displayName, in string uri, in boolean migrating)
wstring getValueForCard (in nsIAbCard card, in string name)
void setValueForCard (in nsIAbCard card, in string name, in wstring value)
void setLdapUrl (const char *aldapUrl)
long doQuery (in nsIAbDirectoryQueryArguments arguments, in nsIAbDirectoryQueryResultListener listener, in long resultLimit, in long timeOut)
 Initiates a query on a directory and sub-directories for properties on cards.
void stopQuery (in long contextID)
 Stops an existing query operation if query operation is asynchronous.
void startSearch ()
 Starts a search on the directory.
void stopSearch ()
 Stops a search on the directory.

Public Attributes

readonly attribute string Value
 The single-byte string value of the resource.
readonly attribute AUTF8String ValueUTF8
 The UTF-8 URI of the resource.
const long opRead = 0x1
const long opWrite = 0x2
const long opSearch = 0x4
readonly attribute long operations
attribute wstring dirName
attribute unsigned long lastModifiedDate
attribute PRBool isMailList
readonly attribute
nsIAbDirectoryProperties 
directoryProperties
readonly attribute
nsISimpleEnumerator 
childNodes
readonly attribute nsIEnumerator childCards
readonly attribute boolean isRemote
 directory is local (example, mork based) or remote (example, LDAP)
readonly attribute boolean isSecure
 directory is secure (as in LDAP over SSL)
readonly attribute boolean searchDuringLocalAutocomplete
 directory should be searched when doing local autocomplete
readonly attribute boolean supportsMailingLists
attribute nsISupportsArray addressLists
attribute wstring listNickName
attribute wstring description
attribute ACString dirPrefId
attribute nsIMutableArray searchServerControls
 If set, these arrays of nsILDAPControls are passed through to the nsILDAPOperation that searchExt is called on.
attribute nsIMutableArray searchClientControls

Protected Member Functions

nsresult Initiate ()
nsresult InitiateConnection ()
nsresult GetAttributeName (PRUnichar **aName, nsString &value)
nsresult SetAttributeName (const PRUnichar *aName, nsString &arrtibute)
nsresult getLdapReturnAttributes (nsIAbDirectoryQueryArguments *arguments, nsCString &returnAttributes)

Protected Attributes

PRPackedBool mInitialized
PRPackedBool mInitializedConnection
PRPackedBool mPerformingQuery
PRInt32 mContext
PRInt32 mMaxHits
nsCOMPtr< nsILDAPURLmURL
nsCOMPtr< nsILDAPConnectionmConnection
nsCOMPtr< nsIAbBooleanExpressionmExpression
nsSupportsHashtable mCache
PRLockmLock
nsCOMPtr< nsIMutableArraymSearchServerControls
nsCOMPtr< nsIMutableArraymSearchClientControls
PRBool mIsValidURI
PRBool mIsQueryURI
nsCString mPath
nsCString mQueryString
nsCString mURINoQuery
nsCString mURI
DelegateEntrymDelegates
nsString m_DirName
PRUint32 m_LastModifiedDate
nsString m_ListName
nsString m_ListNickName
nsString m_Description
PRBool m_IsMailList
nsCString m_DirPrefId
nsCOMPtr< nsISupportsArraym_AddressList
nsXPIDLCString mLogin
nsCOMPtr< nsILDAPURLmDirectoryUrl
PRUint32 mProtocolVersion

Static Protected Attributes

static nsIRDFServicegRDFService = nsnull
static nsrefcnt gRDFServiceRefCnt = 0

Friends

class nsAbLDAPDirectoryQuery
class nsAbQueryLDAPMessageListener

Detailed Description

Definition at line 51 of file nsAbLDAPDirectory.h.


Constructor & Destructor Documentation

Definition at line 74 of file nsAbLDAPDirectory.cpp.

Here is the call graph for this function:


Member Function Documentation

return value is the card that got added we need to do this, as the card we pass in might be an abstract nsIAbCard, and the caller might need the "real" card (the mdbcard) to get / set non-standard card values

nsresult nsAbLDAPDirectory::CreateCard ( nsILDAPURL uri,
const char *  dn,
nsIAbCard **  card 
) [virtual]

Implements nsAbLDAPDirectoryQuery.

Definition at line 329 of file nsAbLDAPDirectory.cpp.

Here is the call graph for this function:

void nsIAbDirectory::createDirectoryByURI ( in wstring  displayName,
in string  uri,
in boolean  migrating 
) [inherited]
long nsIAbDirectoryQuery::doQuery ( in nsIAbDirectoryQueryArguments  arguments,
in nsIAbDirectoryQueryResultListener  listener,
in long  resultLimit,
in long  timeOut 
) [inherited]

Initiates a query on a directory and sub-directories for properties on cards.

Parameters:
argumentsThe properties and values to match Value could of type nsIAbDirectoryQueryMatchItem for matches other than ?contains?
listenerThe listener which will obtain individual query results
resultLimitLimits the results returned to a specifed maximum value
Returns:
Unique number representing the context ID of the query
void nsIAbDirectory::dropCard ( in nsIAbCard  card,
in boolean  needToCopyCard 
) [inherited]
void nsIAbDirectory::editMailListToDatabase ( in string  uri,
in nsIAbCard  listCard 
) [inherited]

Edits an existing mailing list (specified as listCard) into the directory specified by the uri XXX javadoc me.

boolean nsIRDFNode::EqualsNode ( in nsIRDFNode  aNode) [inherited]
NS_IMETHODIMP nsRDFResource::EqualsNode ( nsIRDFNode aNode,
PRBool aResult 
) [inherited]

Definition at line 84 of file nsRDFResource.cpp.

{
    NS_PRECONDITION(aNode != nsnull, "null ptr");
    if (! aNode)
        return NS_ERROR_NULL_POINTER;

    nsresult rv;
    nsIRDFResource* resource;
    rv = aNode->QueryInterface(NS_GET_IID(nsIRDFResource), (void**)&resource);
    if (NS_SUCCEEDED(rv)) {
        *aResult = (NS_STATIC_CAST(nsIRDFResource*, this) == resource);
        NS_RELEASE(resource);
        return NS_OK;
    }
    else if (rv == NS_NOINTERFACE) {
        *aResult = PR_FALSE;
        return NS_OK;
    }
    else {
        return rv;
    }
}
NS_IMETHODIMP nsRDFResource::EqualsString ( const char *  aURI,
PRBool aResult 
) [inherited]

Definition at line 156 of file nsRDFResource.cpp.

{
    NS_PRECONDITION(aURI != nsnull, "null ptr");
    if (! aURI)
        return NS_ERROR_NULL_POINTER;

    NS_PRECONDITION(aResult, "null ptr");

    *aResult = mURI.Equals(aURI);
    return NS_OK;
}

Determine if the resource has the given URI.

nsresult nsAbDirProperty::GetAttributeName ( PRUnichar **  aName,
nsString value 
) [protected, inherited]

Definition at line 135 of file nsAbDirProperty.cpp.

{
       if (aName)
       {
              *aName = ToNewUnicode(value);
              if (!(*aName)) 
                     return NS_ERROR_OUT_OF_MEMORY;
              else
                     return NS_OK;
       }
       else
              return NS_ERROR_NULL_POINTER;

}

Here is the call graph for this function:

Definition at line 220 of file nsAbLDAPDirectory.cpp.

{
    nsresult rv;
    
    // when offline, we need to get the child cards for the local, replicated mdb directory 
    PRBool offline;
    nsCOMPtr <nsIIOService> ioService = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv,rv);
    rv = ioService->GetOffline(&offline);
    NS_ENSURE_SUCCESS(rv,rv);
    
    if (offline) {
      nsCOMPtr <nsIRDFService> rdfService = do_GetService("@mozilla.org/rdf/rdf-service;1",&rv);
      NS_ENSURE_SUCCESS(rv, rv);

      nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
      NS_ENSURE_SUCCESS(rv, rv);

      // use mURINoQuery to get a prefName
      nsCAutoString prefName;
      prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) + NS_LITERAL_CSTRING(".filename");

      nsXPIDLCString fileName;
      rv = prefs->GetCharPref(prefName.get(), getter_Copies(fileName));
      NS_ENSURE_SUCCESS(rv,rv);
      
      // if there is no fileName, bail out now.
      if (fileName.IsEmpty())
        return NS_OK;

      // perform the same query, but on the local directory
      nsCAutoString localDirectoryURI;
      localDirectoryURI = NS_LITERAL_CSTRING("moz-abmdbdirectory://") + fileName;
      if (mIsQueryURI)
        localDirectoryURI = localDirectoryURI + NS_LITERAL_CSTRING("?") + mQueryString;
      
      nsCOMPtr <nsIRDFResource> resource;
      rv = rdfService->GetResource(localDirectoryURI, getter_AddRefs(resource));
      NS_ENSURE_SUCCESS(rv, rv);
      
      nsCOMPtr <nsIAbDirectory> directory = do_QueryInterface(resource, &rv);
      NS_ENSURE_SUCCESS(rv, rv);

      rv = directory->GetChildCards(result);
    }
    else {
      // Start the search
      rv = StartSearch();
      NS_ENSURE_SUCCESS(rv, rv);
      
      nsCOMPtr<nsISupportsArray> array;
      NS_NewISupportsArray(getter_AddRefs(array));
      if (!array)
        return NS_ERROR_OUT_OF_MEMORY;
      
      rv = array->Enumerate(result);
    }

    NS_ENSURE_SUCCESS(rv,rv);
    return rv;
}

Here is the call graph for this function:

Definition at line 214 of file nsAbLDAPDirectory.cpp.

{
    nsCOMArray<nsIAbDirectory> children;
    return NS_NewArrayEnumerator(aResult, children);
}

Here is the call graph for this function:

NS_IMETHODIMP nsRDFResource::GetDelegate ( const char *  aKey,
REFNSIID  aIID,
void **  aResult 
) [inherited]

Definition at line 169 of file nsRDFResource.cpp.

{
    NS_PRECONDITION(aKey != nsnull, "null ptr");
    if (! aKey)
        return NS_ERROR_NULL_POINTER;

    nsresult rv;
    *aResult = nsnull;

    DelegateEntry* entry = mDelegates;
    while (entry) {
        if (entry->mKey.Equals(aKey)) {
            rv = entry->mDelegate->QueryInterface(aIID, aResult);
            return rv;
        }

        entry = entry->mNext;
    }

    // Construct a ContractID of the form "@mozilla.org/rdf/delegate/[key]/[scheme];1
    nsCAutoString contractID(NS_RDF_DELEGATEFACTORY_CONTRACTID_PREFIX);
    contractID.Append(aKey);
    contractID.Append("&scheme=");

    PRInt32 i = mURI.FindChar(':');
    contractID += StringHead(mURI, i);

    nsCOMPtr<nsIRDFDelegateFactory> delegateFactory =
             do_CreateInstance(contractID.get(), &rv);
    if (NS_FAILED(rv)) return rv;

    rv = delegateFactory->CreateDelegate(this, aKey, aIID, aResult);
    if (NS_FAILED(rv)) return rv;

    // Okay, we've successfully created a delegate. Let's remember it.
    entry = new DelegateEntry;
    if (! entry) {
        NS_RELEASE(*NS_REINTERPRET_CAST(nsISupports**, aResult));
        return NS_ERROR_OUT_OF_MEMORY;
    }
    
    entry->mKey      = aKey;
    entry->mDelegate = do_QueryInterface(*NS_REINTERPRET_CAST(nsISupports**, aResult), &rv);
    if (NS_FAILED(rv)) {
        NS_ERROR("nsRDFResource::GetDelegate(): can't QI to nsISupports!");

        delete entry;
        NS_RELEASE(*NS_REINTERPRET_CAST(nsISupports**, aResult));
        return NS_ERROR_FAILURE;
    }

    entry->mNext     = mDelegates;

    mDelegates = entry;

    return NS_OK;
}

Here is the call graph for this function:

void nsIRDFResource::GetDelegate ( in string  aKey,
in nsIIDRef  aIID,
[iid_is(aIID), retval] out nsQIResult  aResult 
) [inherited]

Retrieve the "delegate" object for this resource.

A resource may have several delegate objects, each of whose lifetimes is bound to the life of the resource object.

This method will return the delegate for the given key after QueryInterface()-ing it to the requested IID.

If no delegate exists for the specified key, this method will attempt to create one using the component manager. Specifically, it will combine aKey with the resource's URI scheme to produce a ContractID as follows:

component:/rdf/delegate-factory/[key]/[scheme]

This ContractID will be used to locate a factory using the FindFactory() method of nsIComponentManager. If the nsIFactory exists, it will be used to create a "delegate factory"; that is, an object that supports nsIRDFDelegateFactory. The delegate factory will be used to construct the delegate object.

Here is the caller graph for this function:

Definition at line 491 of file nsAbLDAPDirectory.cpp.

{
  NS_ENSURE_ARG_POINTER(aIsRemote);
  *aIsRemote = PR_TRUE;
  return NS_OK;
}

Definition at line 498 of file nsAbLDAPDirectory.cpp.

{
  NS_ENSURE_ARG_POINTER(aIsSecure);

  nsresult rv;
  nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
  NS_ENSURE_SUCCESS(rv, rv);
  
  // use mURINoQuery to get a prefName
  nsCAutoString prefName;
  prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) + NS_LITERAL_CSTRING(".uri");
  
  nsXPIDLCString URI;
  rv = prefBranch->GetCharPref(prefName.get(), getter_Copies(URI));
  NS_ENSURE_SUCCESS(rv,rv);
  
  // to determine if this is a secure directory, check if the uri is ldaps:// or not
  *aIsSecure = (strncmp(URI.get(), "ldaps:", 6) == 0);
  return NS_OK;
}

Here is the call graph for this function:

Implements nsAbLDAPDirectoryQuery.

Definition at line 307 of file nsAbLDAPDirectory.cpp.

{
    nsresult rv;

    rv = InitiateConnection ();
    NS_ENSURE_SUCCESS(rv, rv);

    NS_IF_ADDREF(*connection = mConnection);
    return rv;
}

Here is the call graph for this function:

nsresult nsAbLDAPDirectoryQuery::getLdapReturnAttributes ( nsIAbDirectoryQueryArguments arguments,
nsCString returnAttributes 
) [protected, inherited]

Definition at line 880 of file nsAbLDAPDirectoryQuery.cpp.

{
    nsresult rv;

    CharPtrArrayGuard properties;
    rv = arguments->GetReturnProperties(properties.GetSizeAddr(),
                                        properties.GetArrayAddr());
    NS_ENSURE_SUCCESS(rv, rv);

    // figure out how we map attribute names to addressbook fields for this
    // query
    nsCOMPtr<nsISupports> iSupportsMap;
    rv = arguments->GetTypeSpecificArg(getter_AddRefs(iSupportsMap));
    NS_ENSURE_SUCCESS(rv, rv);

    nsCOMPtr<nsIAbLDAPAttributeMap> map = do_QueryInterface(iSupportsMap, &rv);
    NS_ENSURE_SUCCESS(rv, rv);

    if (!strcmp(properties[0], "card:nsIAbCard")) {
        // Meta property
        // require all attributes
        //
        rv = map->GetAllCardAttributes(returnAttributes);
        NS_ASSERTION(NS_SUCCEEDED(rv), "GetAllSupportedAttributes failed");
        return rv;
    }

    PRBool needComma = PR_FALSE;
    for (PRUint32 i = 0; i < properties.GetSize(); i++)
    {
        nsCAutoString attrs;

        // get all the attributes for this property
        rv = map->GetAttributeList(nsDependentCString(properties[i]), attrs);

        // if there weren't any attrs, just keep going
        if (NS_FAILED(rv) || attrs.IsEmpty()) {
            continue;
        }

        // add a comma, if necessary
        if (needComma) {
            returnAttributes.Append(PRUnichar (','));
        }

        returnAttributes.Append(attrs);

        // since we've added attrs, we definitely need a comma next time
        // we're here
        needComma = PR_TRUE;
    }

    return rv;
}

Here is the call graph for this function:

Implements nsAbLDAPDirectoryQuery.

Definition at line 318 of file nsAbLDAPDirectory.cpp.

{
    nsresult rv;

    rv = InitiateConnection ();
    NS_ENSURE_SUCCESS(rv, rv);

    NS_IF_ADDREF(*url = mURL);
    return rv;
}

Here is the call graph for this function:

Definition at line 208 of file nsAbLDAPDirectory.cpp.

{
    *aOperations = nsIAbDirectory::opSearch;
    return NS_OK;
}

Definition at line 519 of file nsAbLDAPDirectory.cpp.

{
  NS_ENSURE_ARG_POINTER(aSearchDuringLocalAutocomplete);

  // always skip LDAP directories when doing local autocomplete.
  // we do the LDAP autocompleting
  // in nsLDAPAutoCompleteSession
  *aSearchDuringLocalAutocomplete = PR_FALSE;
  return NS_OK;
}

Definition at line 484 of file nsAbLDAPDirectory.cpp.

{
  NS_ENSURE_ARG_POINTER(aSupportsMailingsLists);
  *aSupportsMailingsLists = PR_FALSE;
  return NS_OK;
}
NS_IMETHODIMP nsRDFResource::GetValue ( char **  aURI) [inherited]

Definition at line 129 of file nsRDFResource.cpp.

{
    NS_ASSERTION(aURI, "Null out param.");
    
    *aURI = ToNewCString(mURI);

    if (!*aURI)
        return NS_ERROR_OUT_OF_MEMORY;

    return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsRDFResource::GetValueConst ( const char **  aURI) [inherited]

Definition at line 149 of file nsRDFResource.cpp.

{
    *aURI = mURI.get();
    return NS_OK;
}

Here is the call graph for this function:

void nsIRDFResource::GetValueConst ( [shared] out string  aConstValue) [inherited]

An unscriptable version used to avoid a string copy.

Meant for use as a performance optimization. The string is encoded in UTF-8.

wstring nsIAbDirectory::getValueForCard ( in nsIAbCard  card,
in string  name 
) [inherited]
NS_IMETHODIMP nsRDFResource::GetValueUTF8 ( nsACString &  aResult) [inherited]

Definition at line 142 of file nsRDFResource.cpp.

{
    aResult = mURI;
    return NS_OK;
}

Definition at line 282 of file nsAbLDAPDirectory.cpp.

{
    nsresult rv;

    rv = Initiate ();
    NS_ENSURE_SUCCESS(rv, rv);

    nsVoidKey key (NS_STATIC_CAST(void* ,card));

    // Enter lock
    nsAutoLock lock (mLock);

    *hasCard = mCache.Exists (&key);
    if (!*hasCard && mPerformingQuery)
            return NS_ERROR_NOT_AVAILABLE;

    return NS_OK;
}

Here is the call graph for this function:

boolean nsIAbDirectory::hasCard ( in nsIAbCard  cards) [inherited]

Here is the caller graph for this function:

Reimplemented from nsAbDirectoryRDFResource.

Definition at line 82 of file nsAbLDAPDirectory.cpp.

Here is the call graph for this function:

void nsIRDFResource::Init ( in string  uri) [inherited]

This method is called by the nsIRDFService after constructing a resource object to initialize it's URI.

You would not normally call this method directly

Reimplemented from nsAbLDAPDirectoryQuery.

Definition at line 88 of file nsAbLDAPDirectory.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 114 of file nsAbLDAPDirectory.cpp.

{
    if (mInitializedConnection)
        return NS_OK;

    nsresult rv;

    mURL = do_CreateInstance(NS_LDAPURL_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv);

    nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
    NS_ENSURE_SUCCESS(rv, rv);

    // use mURINoQuery to get a prefName
    nsCAutoString prefName;
    prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) + NS_LITERAL_CSTRING(".uri");

    // turn moz-abldapdirectory://ldap_2.servers.nscpphonebook into -> "ldap_2.servers.nscpphonebook.uri"
    nsXPIDLCString URI;
    rv = prefs->GetCharPref(prefName.get(), getter_Copies(URI));
    if (NS_FAILED(rv))
    {
        /*
         * A recent change in Mozilla now means that the LDAP Address Book
         * RDF Resource URI is based on the unique preference name value i.e.  
         * [moz-abldapdirectory://prefName]
         * Prior to this valid change it was based on the actual uri i.e. 
         * [moz-abldapdirectory://host:port/basedn]
         * Basing the resource on the prefName allows these attributes to 
         * change. 
         *
         * But the uri value was also the means by which third-party
         * products could integrate with Mozilla's LDAP Address Books
         * without necessarily having an entry in the preferences file
         * or more importantly needing to be able to change the
         * preferences entries. Thus to set the URI Spec now, it is
         * only necessary to read the uri pref entry, while in the
         * case where it is not a preference, we need to replace the
         * "moz-abldapdirectory".
         */
        nsCAutoString tempLDAPURL(mURINoQuery);
        tempLDAPURL.ReplaceSubstring("moz-abldapdirectory:", "ldap:");
        rv = mURL->SetSpec(tempLDAPURL);
    }
    else
    {
        rv = mURL->SetSpec(URI);
    }
    NS_ENSURE_SUCCESS(rv,rv);

    // get the login information, if there is any 
    //
    rv = prefs->GetCharPref(
        PromiseFlatCString(
            Substring(mURINoQuery, kLDAPDirectoryRootLen,
                      mURINoQuery.Length() - kLDAPDirectoryRootLen)
            + NS_LITERAL_CSTRING(".auth.dn")).get(),
        getter_Copies(mLogin));
    if (NS_FAILED(rv)) {
        mLogin.Truncate();  // zero out mLogin
    }

    // get the protocol version, if there is any.  using a string pref
    // here instead of an int, as protocol versions sometimes have names like
    // "4bis".
    //
    nsXPIDLCString protocolVersion;
    rv = prefs->GetCharPref(
        PromiseFlatCString(
            Substring(mURINoQuery, kLDAPDirectoryRootLen,
                      mURINoQuery.Length() - kLDAPDirectoryRootLen)
            + NS_LITERAL_CSTRING(".protocolVersion")).get(),
        getter_Copies(protocolVersion));

    if (NS_SUCCEEDED(rv) && protocolVersion.Equals("2")) {
        mProtocolVersion = nsILDAPConnection::VERSION2;
    }
    // otherwise we leave mProtocolVersion as the default (see the initializers
    // for the nsAbLDAPDirectoryQuery class).

    mConnection = do_CreateInstance(NS_LDAPCONNECTION_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv);

    mInitializedConnection = PR_TRUE;
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIAbDirectory::modifyDirectory ( in nsIAbDirectory  directory,
in nsIAbDirectoryProperties  aProperties 
) [inherited]

Implements nsAbDirSearchListenerContext.

Definition at line 449 of file nsAbLDAPDirectory.cpp.

{
    nsresult rv;

    rv = Initiate ();
    NS_ENSURE_SUCCESS(rv, rv);

    nsAutoLock lock (mLock);
    mPerformingQuery = PR_FALSE;

    return NS_OK;
}

Here is the call graph for this function:

Implements nsAbDirSearchListenerContext.

Definition at line 462 of file nsAbLDAPDirectory.cpp.

{
    nsresult rv;

    rv = Initiate ();
    NS_ENSURE_SUCCESS(rv, rv);

    nsVoidKey key (NS_STATIC_CAST(void* ,card));
    // Enter lock
    {
        nsAutoLock lock (mLock);
        mCache.Put (&key, card);
    }
    // Exit lock

    nsCOMPtr<nsIAddrBookSession> abSession = do_GetService(NS_ADDRBOOKSESSION_CONTRACTID, &rv);
    if(NS_SUCCEEDED(rv))
        abSession->NotifyDirectoryItemAdded(this, card);

    return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsRDFResource::ReleaseDelegate ( const char *  aKey) [inherited]

Definition at line 228 of file nsRDFResource.cpp.

{
    NS_PRECONDITION(aKey != nsnull, "null ptr");
    if (! aKey)
        return NS_ERROR_NULL_POINTER;

    DelegateEntry* entry = mDelegates;
    DelegateEntry** link = &mDelegates;

    while (entry) {
        if (entry->mKey.Equals(aKey)) {
            *link = entry->mNext;
            delete entry;
            return NS_OK;
        }

        link = &(entry->mNext);
        entry = entry->mNext;
    }

    NS_WARNING("nsRDFResource::ReleaseDelegate() no delegate found");
    return NS_OK;
}

Force a delegate to be "unbound" from the resource.

Normally, a delegate object's lifetime will be identical to that of the resource to which it is bound; this method allows a delegate to unlink itself from an RDF resource prematurely.

nsresult nsAbDirProperty::SetAttributeName ( const PRUnichar aName,
nsString arrtibute 
) [protected, inherited]

Definition at line 150 of file nsAbDirProperty.cpp.

{
       if (aName)
              arrtibute = aName;
       return NS_OK;
}
void nsAbLDAPDirectoryQuery::setLdapUrl ( const char *  aldapUrl) [inherited]
void nsIAbDirectory::setValueForCard ( in nsIAbCard  card,
in string  name,
in wstring  value 
) [inherited]

Starts a search on the directory.

If a search is already being performed it is stopped.

The results from a search, cards, will returned by informing the address book session that a new card has been added to the directory.

The nsIAbDirectoryQuery implementation of the directory component (or a proxy) may be used as an implementation for this specialization of query.

This method is semantically equivalent to the nsIAbDirectory.getChildCards method when there is search criteria defined in the directory uri.

void nsIAbDirectoryQuery::stopQuery ( in long  contextID) [inherited]

Stops an existing query operation if query operation is asynchronous.

The nsIAbDirectoryQueryResultListener will be notified when query has stopped

It is implementation specific if notification synchronous or asynchronous

Parameters:
contextIDThe unique number returned from the doQuery methods

Stops a search on the directory.


Friends And Related Function Documentation

friend class nsAbLDAPDirectoryQuery [friend]

Definition at line 96 of file nsAbLDAPDirectory.h.

friend class nsAbQueryLDAPMessageListener [friend]

Reimplemented from nsAbLDAPDirectoryQuery.

Definition at line 97 of file nsAbLDAPDirectory.h.


Member Data Documentation

Definition at line 163 of file nsIAbDirectory.idl.

Definition at line 103 of file nsIAbDirectory.idl.

Definition at line 98 of file nsIAbDirectory.idl.

Definition at line 177 of file nsIAbDirectory.idl.

Definition at line 95 of file nsIAbDirectory.idl.

attribute wstring nsIAbDirectory::dirName [inherited]

Definition at line 85 of file nsIAbDirectory.idl.

attribute ACString nsIAbDirectory::dirPrefId [inherited]

Definition at line 208 of file nsIAbDirectory.idl.

nsIRDFService * nsRDFResource::gRDFService = nsnull [static, protected, inherited]

Definition at line 75 of file nsRDFResource.h.

nsrefcnt nsRDFResource::gRDFServiceRefCnt = 0 [static, protected, inherited]

Definition at line 76 of file nsRDFResource.h.

Definition at line 92 of file nsIAbDirectory.idl.

directory is local (example, mork based) or remote (example, LDAP)

Definition at line 142 of file nsIAbDirectory.idl.

directory is secure (as in LDAP over SSL)

Definition at line 147 of file nsIAbDirectory.idl.

Definition at line 88 of file nsIAbDirectory.idl.

Definition at line 176 of file nsIAbDirectory.idl.

Definition at line 84 of file nsAbDirProperty.h.

nsString nsAbDirProperty::m_Description [protected, inherited]

Definition at line 79 of file nsAbDirProperty.h.

nsString nsAbDirProperty::m_DirName [protected, inherited]

Definition at line 74 of file nsAbDirProperty.h.

nsCString nsAbDirProperty::m_DirPrefId [protected, inherited]

Definition at line 81 of file nsAbDirProperty.h.

PRBool nsAbDirProperty::m_IsMailList [protected, inherited]

Definition at line 80 of file nsAbDirProperty.h.

Definition at line 75 of file nsAbDirProperty.h.

nsString nsAbDirProperty::m_ListName [protected, inherited]

Definition at line 77 of file nsAbDirProperty.h.

nsString nsAbDirProperty::m_ListNickName [protected, inherited]

Definition at line 78 of file nsAbDirProperty.h.

nsSupportsHashtable nsAbLDAPDirectory::mCache [protected]

Definition at line 111 of file nsAbLDAPDirectory.h.

Definition at line 108 of file nsAbLDAPDirectory.h.

Definition at line 105 of file nsAbLDAPDirectory.h.

DelegateEntry* nsRDFResource::mDelegates [protected, inherited]

Definition at line 87 of file nsRDFResource.h.

Definition at line 75 of file nsAbLDAPDirectoryQuery.h.

Definition at line 110 of file nsAbLDAPDirectory.h.

Reimplemented from nsAbLDAPDirectoryQuery.

Definition at line 102 of file nsAbLDAPDirectory.h.

Definition at line 103 of file nsAbLDAPDirectory.h.

Definition at line 59 of file nsAbDirectoryRDFResource.h.

Definition at line 58 of file nsAbDirectoryRDFResource.h.

Reimplemented from nsAbLDAPDirectoryQuery.

Definition at line 113 of file nsAbLDAPDirectory.h.

Definition at line 74 of file nsAbLDAPDirectoryQuery.h.

Definition at line 106 of file nsAbLDAPDirectory.h.

Definition at line 60 of file nsAbDirectoryRDFResource.h.

Definition at line 104 of file nsAbLDAPDirectory.h.

Definition at line 76 of file nsAbLDAPDirectoryQuery.h.

Definition at line 61 of file nsAbDirectoryRDFResource.h.

Definition at line 116 of file nsAbLDAPDirectory.h.

Definition at line 115 of file nsAbLDAPDirectory.h.

nsCString nsRDFResource::mURI [protected, inherited]

Definition at line 79 of file nsRDFResource.h.

Definition at line 62 of file nsAbDirectoryRDFResource.h.

Definition at line 107 of file nsAbLDAPDirectory.h.

Definition at line 82 of file nsIAbDirectory.idl.

const long nsIAbDirectory::opRead = 0x1 [inherited]

Definition at line 72 of file nsIAbDirectory.idl.

const long nsIAbDirectory::opSearch = 0x4 [inherited]

Definition at line 79 of file nsIAbDirectory.idl.

const long nsIAbDirectory::opWrite = 0x2 [inherited]

Definition at line 75 of file nsIAbDirectory.idl.

Definition at line 55 of file nsIAbLDAPDirectory.idl.

directory should be searched when doing local autocomplete

Definition at line 152 of file nsIAbDirectory.idl.

If set, these arrays of nsILDAPControls are passed through to the nsILDAPOperation that searchExt is called on.

Definition at line 54 of file nsIAbLDAPDirectory.idl.

Definition at line 155 of file nsIAbDirectory.idl.

readonly attribute string nsIRDFResource::Value [inherited]

The single-byte string value of the resource.

Note:
THIS IS OBSOLETE. C++ should use GetValueConst and script should use .valueUTF8

Definition at line 53 of file nsIRDFResource.idl.

readonly attribute AUTF8String nsIRDFResource::ValueUTF8 [inherited]

The UTF-8 URI of the resource.

Definition at line 58 of file nsIRDFResource.idl.


The documentation for this class was generated from the following files: