rv = QueryStopped (getter_AddRefs (queryResult));
rv = QueryResultStatus (nsnull, getter_AddRefs (queryResult), nsIAbDirectoryQueryResult::queryResultStopped);
NS_IMETHODIMP nsAbQueryLDAPMessageListener::OnLDAPMessage(nsILDAPMessage *aMessage){    nsresult rv;    rv = Initiate();    NS_ENSURE_SUCCESS(rv, rv);    PRInt32 messageType;    rv = aMessage->GetType(&messageType);    NS_ENSURE_SUCCESS(rv, rv);    PRBool cancelOperation = PR_FALSE;    // Enter lock    {        nsAutoLock lock (mLock);        if (mFinished == PR_TRUE)            return NS_OK;        if (messageType == nsILDAPMessage::RES_SEARCH_RESULT)            mFinished = PR_TRUE;        else if (mCanceled == PR_TRUE)        {            mFinished = PR_TRUE;            cancelOperation = PR_TRUE;        }    }    // Leave lock    nsCOMPtr<nsIAbDirectoryQueryResult> queryResult;    if (cancelOperation == PR_FALSE)    {        switch (messageType)        {        case nsILDAPMessage::RES_BIND:            rv = OnLDAPMessageBind (aMessage);            NS_ENSURE_SUCCESS(rv, rv);            break;        case nsILDAPMessage::RES_SEARCH_ENTRY:            rv = OnLDAPMessageSearchEntry (aMessage, getter_AddRefs (queryResult));            NS_ENSURE_SUCCESS(rv, rv);            break;        case nsILDAPMessage::RES_SEARCH_RESULT:            rv = OnLDAPMessageSearchResult (aMessage, getter_AddRefs (queryResult));            NS_ENSURE_SUCCESS(rv, rv);        default:            break;        }    }    else    {        if (mSearchOperation)            rv = mSearchOperation->Abandon ();        rv = QueryStopped (getter_AddRefs (queryResult));    }    if (queryResult)        rv = mQueryListener->OnQueryItem (queryResult);    return rv;}