From 78305f0bea5f65fb18b6e185e399465806c68b2a Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Mon, 19 Aug 2002 22:34:25 +0000 Subject: add "cache-completions" here, since file completion results are blanket 2002-08-19 Chris Toshok * backend/pas/pas-backend-file.c (pas_backend_file_get_static_capabilities): add "cache-completions" here, since file completion results are blanket cached (as they're generated from a summary). * backend/pas/pas-backend-ldap.c (pas_backend_ldap_process_get_cursor): there should be no search limit on the get_cursor_request, as it's meant to match every card it can. (ldap_search_handler): parse the ldap result in the RES_SEARCH_RESULT case. we'll want more here soon, so we can notify the front end if the result was truncated due to either the size or time limit being exceeded. (pas_backend_ldap_process_get_book_view): in the case of a completion view, we hardcode (yeah yeah, i know, but really) the search limit to MIN (100, user-specified-limit). (pas_backend_ldap_search): each view has its own limit now, defaulting from the user specified one for normal searches but possibly different for completion views. use the view's limit here. svn path=/trunk/; revision=17811 --- addressbook/ChangeLog | 23 +++++++++++++++++++++++ addressbook/backend/pas/pas-backend-file.c | 2 +- addressbook/backend/pas/pas-backend-ldap.c | 19 +++++++++++++++++-- 3 files changed, 41 insertions(+), 3 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index a92016d810..0a8ddeacc9 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,26 @@ +2002-08-19 Chris Toshok + + * backend/pas/pas-backend-file.c + (pas_backend_file_get_static_capabilities): add + "cache-completions" here, since file completion results are + blanket cached (as they're generated from a summary). + + * backend/pas/pas-backend-ldap.c + (pas_backend_ldap_process_get_cursor): there should be no search + limit on the get_cursor_request, as it's meant to match every card + it can. + (ldap_search_handler): parse the ldap result in the + RES_SEARCH_RESULT case. we'll want more here soon, so we can + notify the front end if the result was truncated due to either the + size or time limit being exceeded. + (pas_backend_ldap_process_get_book_view): in the case of a + completion view, we hardcode (yeah yeah, i know, but really) the + search limit to MIN (100, user-specified-limit). + (pas_backend_ldap_search): each view has its own limit now, + defaulting from the user specified one for normal searches but + possibly different for completion views. use the view's limit + here. + 2002-08-19 Dan Winship * gui/component/select-names/e-select-names-bonobo.c diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c index c0d03d6b5d..fe14be3f07 100644 --- a/addressbook/backend/pas/pas-backend-file.c +++ b/addressbook/backend/pas/pas-backend-file.c @@ -1584,7 +1584,7 @@ pas_backend_file_remove_client (PASBackend *backend, static char * pas_backend_file_get_static_capabilities (PASBackend *backend) { - return g_strdup("local,do-initial-query"); + return g_strdup("local,do-initial-query,cache-completions"); } static gboolean diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c index 8ea22275c3..296bb8797a 100644 --- a/addressbook/backend/pas/pas-backend-ldap.c +++ b/addressbook/backend/pas/pas-backend-ldap.c @@ -140,6 +140,7 @@ struct _PASBackendLDAPBookView { PASBackendLDAPPrivate *blpriv; gchar *search; PASBackendCardSExp *card_sexp; + int limit; LDAPOp *search_op; }; @@ -1793,7 +1794,7 @@ pas_backend_ldap_process_get_cursor (PASBackend *backend, "(objectclass=*)", NULL, 0, NULL, NULL, NULL, /* timeout */ - bl->priv->ldap_limit, &get_cursor_msgid); + 0, &get_cursor_msgid); } while (pas_backend_ldap_reconnect (bl, book_view, ldap_error)); if (ldap_error == LDAP_SUCCESS) { @@ -2760,6 +2761,13 @@ ldap_search_handler (LDAPOp *op, LDAPMessage *res) } } else if (msg_type == LDAP_RES_SEARCH_RESULT) { + int ldap_error; + + ldap_parse_result (ldap, res, &ldap_error, + NULL, NULL, NULL, NULL, 0); + + g_warning ("search returned %d\n", ldap_error); + /* the entry that marks the end of our search */ if (search_op->num_pending_adds) send_pending_adds (search_op); @@ -2812,7 +2820,7 @@ pas_backend_ldap_search (PASBackendLDAP *bl, NULL, /* XXX */ NULL, /* XXX */ NULL, /* XXX timeout */ - bl->priv->ldap_limit, &search_msgid); + view->limit, &search_msgid); } while (pas_backend_ldap_reconnect (bl, view->book_view, ldap_err)); g_free (ldap_query); @@ -2876,6 +2884,13 @@ pas_backend_ldap_process_get_book_view (PASBackend *backend, view->card_sexp = pas_backend_card_sexp_new (view->search); view->blpriv = bl->priv; + if (req->op == GetCompletionView) { + view->limit = MIN (bl->priv->ldap_limit, 100); + } + else { + view->limit = bl->priv->ldap_limit; + } + bl->priv->book_views = g_list_prepend(bl->priv->book_views, view); pas_book_respond_get_book_view (book, -- cgit v1.2.3