Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | Friends
nsAbLDAPDirectoryQuery Class Reference

#include <nsAbLDAPDirectoryQuery.h>

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIABDIRECTORYQUERY 
nsAbLDAPDirectoryQuery ()
virtual ~nsAbLDAPDirectoryQuery ()
void setLdapUrl (const char *aldapUrl)
virtual nsresult GetLDAPConnection (nsILDAPConnection **connection)=0
virtual nsresult GetLDAPURL (nsILDAPURL **url)=0
virtual nsresult CreateCard (nsILDAPURL *url, const char *dn, nsIAbCard **card)=0
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.

Protected Member Functions

nsresult getLdapReturnAttributes (nsIAbDirectoryQueryArguments *arguments, nsCString &returnAttributes)
nsresult Initiate ()

Protected Attributes

nsXPIDLCString mLogin
nsCOMPtr< nsILDAPURLmDirectoryUrl
PRUint32 mProtocolVersion

Private Attributes

nsCOMPtr< nsILDAPMessageListenermListener
PRBool mInitialized
PRLockmLock

Friends

class nsAbQueryLDAPMessageListener

Detailed Description

Definition at line 51 of file nsAbLDAPDirectoryQuery.h.


Constructor & Destructor Documentation

Definition at line 658 of file nsAbLDAPDirectoryQuery.cpp.

Here is the call graph for this function:


Member Function Documentation

virtual nsresult nsAbLDAPDirectoryQuery::CreateCard ( nsILDAPURL url,
const char *  dn,
nsIAbCard **  card 
) [pure virtual]

Implemented in nsAbLDAPDirectory.

Here is the caller graph for this function:

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
virtual nsresult nsAbLDAPDirectoryQuery::GetLDAPConnection ( nsILDAPConnection **  connection) [pure virtual]

Implemented in nsAbLDAPDirectory.

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:

virtual nsresult nsAbLDAPDirectoryQuery::GetLDAPURL ( nsILDAPURL **  url) [pure virtual]

Implemented in nsAbLDAPDirectory.

Reimplemented in nsAbLDAPDirectory.

Definition at line 671 of file nsAbLDAPDirectoryQuery.cpp.

{
    if (mInitialized)
        return NS_OK;

    mLock = PR_NewLock ();
    if(!mLock)
    {
        return NS_ERROR_OUT_OF_MEMORY;
    }

    mInitialized = PR_TRUE;

    return NS_OK;
}

Here is the call graph for this function:

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

Friends And Related Function Documentation

friend class nsAbQueryLDAPMessageListener [friend]

Reimplemented in nsAbLDAPDirectory.

Definition at line 72 of file nsAbLDAPDirectoryQuery.h.


Member Data Documentation

Definition at line 75 of file nsAbLDAPDirectoryQuery.h.

Reimplemented in nsAbLDAPDirectory.

Definition at line 80 of file nsAbLDAPDirectoryQuery.h.

Definition at line 79 of file nsAbLDAPDirectoryQuery.h.

Reimplemented in nsAbLDAPDirectory.

Definition at line 82 of file nsAbLDAPDirectoryQuery.h.

Definition at line 74 of file nsAbLDAPDirectoryQuery.h.

Definition at line 76 of file nsAbLDAPDirectoryQuery.h.


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