View | Details | Raw Unified | Return to issue 8148
Collapse All | Expand All

(-)MQuery.cxx (+36 lines)
Lines 423-428 Link Here
423
        OSL_TRACE("Not using a Query Proxy, Query i/f supported by directory\n");
423
        OSL_TRACE("Not using a Query Proxy, Query i/f supported by directory\n");
424
#endif /* DEBUG */
424
#endif /* DEBUG */
425
425
426
    /*
427
    // The problem here is that an LDAP Address Book may exist as 
428
    // a Mozilla Address Book. So we need to limit the number of
429
    // records returned by the Server:
430
    // 1. Determine if this is an LDAP Address Book 
431
    // 2. Determine if the limit is already set by us.
432
    // 3. Use the mozilla preferences to see if this value is set.
433
    // 4. Use value or else default to 100.
434
    */
435
    PRBool isWriteable;
436
    rv = directory->GetOperations (&isWriteable);
437
    NS_ENSURE_SUCCESS(rv, rv);
438
    if (!(isWriteable & nsIAbDirectory::opWrite))
439
    {
440
        if(m_nMaxNrOfReturns == -1)
441
        {
442
            // Determine if the limit maxHits has been set in the mozilla preferences
443
            // if set, then use the value otherwise default to 100
444
            nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv); 
445
            NS_ENSURE_SUCCESS(rv, rv);
446
447
            // create the ldap maxHits entry in the preferences file.
448
            nsCAutoString prefName(NS_LITERAL_CSTRING("ldap_2.servers."));
449
            const char *pAddressBook = MTypeConverter::ouStringToCCharStringAscii(m_aAddressbook);
450
            prefName.Append(pAddressBook);
451
            prefName.Append(NS_LITERAL_CSTRING(".maxHits"));
452
453
           PRInt32 maxHits;
454
           rv = prefs->GetIntPref(prefName.get(), &maxHits);
455
           if (NS_FAILED(rv))
456
               m_nMaxNrOfReturns = 100;
457
           else
458
               m_nMaxNrOfReturns = maxHits;
459
        }
460
    }
461
426
    nsCOMPtr< nsIAbBooleanExpression > queryExpression = do_CreateInstance( kBooleanExpressionCID , &rv);
462
    nsCOMPtr< nsIAbBooleanExpression > queryExpression = do_CreateInstance( kBooleanExpressionCID , &rv);
427
    NS_ENSURE_SUCCESS( rv, rv );
463
    NS_ENSURE_SUCCESS( rv, rv );
428
    rv = generateExpression( this, &m_aExpr, queryExpression );
464
    rv = generateExpression( this, &m_aExpr, queryExpression );

Return to issue 8148