aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend
diff options
context:
space:
mode:
authorChris Toshok <toshok@src.gnome.org>2000-04-12 13:34:59 +0800
committerChris Toshok <toshok@src.gnome.org>2000-04-12 13:34:59 +0800
commitdd437a8dff10d4c9a1ce40d39ce1071ae5867ae3 (patch)
tree4933c8ab8df87cc0e610fd542c03a78378137792 /addressbook/backend
parent969fb39532b112c2464dac3052e3650b6a72d1b2 (diff)
downloadgsoc2013-evolution-dd437a8dff10d4c9a1ce40d39ce1071ae5867ae3.tar.gz
gsoc2013-evolution-dd437a8dff10d4c9a1ce40d39ce1071ae5867ae3.tar.zst
gsoc2013-evolution-dd437a8dff10d4c9a1ce40d39ce1071ae5867ae3.zip
delay the setting of the ldap variable until we've ensured we were
* addressbook/backend/pas/pas-backend-ldap.c (pas_backend_ldap_build_all_cards_list): delay the setting of the ldap variable until we've ensured we were connected. Also, set the search limit to LDAP_MAX_SEARCH_RESPONSES (we'll eventually want a user setting here i assume.) (pas_backend_ldap_search): same here, and also send back lists of CARDS_PER_VIEW_NOTIFICATION length in each pas_book_view_notify_add call. also, don't call ber_free if there was a decoding error, since the ldap library frees it for us. svn path=/trunk/; revision=2406
Diffstat (limited to 'addressbook/backend')
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index c80fbd388b..61396d257d 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -20,6 +20,9 @@
#include <e-sexp.h>
#include <e-card.h>
+#define LDAP_MAX_SEARCH_RESPONSES 500
+#define CARDS_PER_VIEW_NOTIFICATION 10
+
static PASBackendClass *pas_backend_ldap_parent_class;
typedef struct _PASBackendLDAPCursorPrivate PASBackendLDAPCursorPrivate;
typedef struct _PASBackendLDAPBookView PASBackendLDAPBookView;
@@ -180,17 +183,22 @@ pas_backend_ldap_build_all_cards_list(PASBackend *backend,
PASBackendLDAPCursorPrivate *cursor_data)
{
PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
- LDAP *ldap = bl->priv->ldap;
+ LDAP *ldap;
int ldap_error;
LDAPMessage *res, *e;
+ pas_backend_ldap_ensure_connected(bl);
+
+ ldap = bl->priv->ldap;
+
+ ldap->ld_sizelimit = LDAP_MAX_SEARCH_RESPONSES;
if (ldap_search_s (ldap,
NULL,
LDAP_SCOPE_ONELEVEL,
"(objectclass=*)",
NULL, 0, &res) == -1) {
- ldap_perror (ldap, "ldap_search");
+ g_warning ("ldap error '%s' in pas_backend_ldap_build_all_cards_list\n", ldap_err2string(ldap_error));
}
cursor_data->elements = NULL;
@@ -563,18 +571,22 @@ pas_backend_ldap_search (PASBackendLDAP *bl,
GList *cards = NULL;
if (ldap_query != NULL) {
- LDAP *ldap = bl->priv->ldap;
+ LDAP *ldap;
int ldap_error;
LDAPMessage *res, *e;
pas_backend_ldap_ensure_connected(bl);
+ ldap = bl->priv->ldap;
+
+ ldap->ld_sizelimit = LDAP_MAX_SEARCH_RESPONSES;
+
if ((ldap_error = ldap_search_s (ldap,
NULL,
LDAP_SCOPE_ONELEVEL,
ldap_query,
NULL, 0, &res)) != LDAP_SUCCESS) {
- ldap_perror (ldap, "ldap_search");
+ g_warning ("ldap error '%s' in pas_backend_ldap_search\n", ldap_err2string(ldap_error));
}
e = ldap_first_entry(ldap, res);
@@ -584,7 +596,8 @@ pas_backend_ldap_search (PASBackendLDAP *bl,
char *dn = ldap_get_dn(ldap, e);
char *attr, *prop;
BerElement *ber = NULL;
-
+ int card_count = 0;
+
e_card_set_id (card, dn);
/* XXX needs a bit of work here */
@@ -602,28 +615,35 @@ pas_backend_ldap_search (PASBackendLDAP *bl,
}
}
- if (ber)
+ if (ldap->ld_errno != LDAP_DECODING_ERROR && ber)
ber_free (ber, 0);
cards = g_list_append(cards, e_card_get_vcard(card));
+ card_count ++;
+ if (card_count == CARDS_PER_VIEW_NOTIFICATION) {
+ card_count = 0;
+ pas_book_view_notify_add (view->book_view, cards);
+
+ g_list_foreach (cards, (GFunc)g_free, NULL);
+ g_list_free (cards);
+ cards = NULL;
+ }
gtk_object_unref (GTK_OBJECT(card));
e = ldap_next_entry(ldap, e);
}
- ldap_msgfree(res);
-
+ /* send any straglers */
if (cards) {
pas_book_view_notify_add (view->book_view, cards);
- /*
- ** It's fine to do this now since the data has been handed off.
- */
g_list_foreach (cards, (GFunc)g_free, NULL);
g_list_free (cards);
+ cards = NULL;
}
+ ldap_msgfree(res);
}
}
901a065ffbd94be2475d10cf37b4e2cc45c7'>- rename py-dosage to just dosage (it's application, not library;rm2013-01-288-161/+208 * Convert to optionsNGrene2013-01-281-12/+12 * - Update to version 0.8.2bar2013-01-272-14/+13 * Convert Makefile headers to the new format in my ports.olgeni2013-01-261-5/+0 * - add new port: deskutils/clipitjgh2013-01-255-0/+110 * Update plasma-applet-cwp to 1.6.12.dbn2013-01-242-3/+3 * Bump PORTREVISION after DESKTOP_ENTRIES updatemakc2013-01-238-6/+8 * Reset rflynn@acsalaska.net: mailbox is full.linimon2013-01-231-6/+2 * - Update DESKTOP_ENTRIES:makc2013-01-231-1/+1 * - Revert to 1.0.1 due to annoying bugs in newer versions.madpilot2013-01-223-4/+4 * Update to new upstream Beta 8 version.mandree2013-01-213-6/+7 * - Update to 1.1.2madpilot2013-01-184-24/+8 * - Update to 0.9.11madpilot2013-01-174-4/+21 * - Update to my new FreeBSD addressdbn2013-01-171-1/+1 * Fix a spelling error in the build-time output.mi2013-01-161-1/+1 * - Update to 0.8.3.avilla2013-01-153-23/+20 * - Update to 0.1.27olivierd2013-01-157-6/+145 * Upgrade to 1.03.thierry2013-01-153-5/+4 * - Upgrade to 1.4.1.kuriyama2013-01-142-3/+3 * - Update to 6.5.9wen2013-01-123-3/+5 * Switch to the new OPTIONS format.romain2013-01-111-2/+3 * Update to 1.12.2.romain2013-01-112-3/+3 * Update Horde Groupware to 5.0.3:mm2013-01-118-12/+12 * - Fix build with Clang.avilla2013-01-091-0/+418 * - Update DESKTOP_ENTRIES:makc2013-01-072-12/+8 * - trim historical headerjgh2013-01-031-7/+5 * - Update to 3.1.2culot2013-01-022-3/+3 * - update to 1.6.5jgh2013-01-023-5/+9 * Fix MimeTypes -> MimeType in .desktop file,mandree2013-01-022-1/+2 * Remove the created by me and update those header at the same time. I nevermezz2013-01-014-20/+0 * Remove the created by me and update those header at the same time. I nevermezz2013-01-011-5/+0 * Bump PORTREVISION for libexo-related portsolivierd2012-12-311-1/+1 * - update WWWrm2012-12-302-8/+4 * - Deprecate QT3, KDE3 and unmaintained ports depending on them. QT 3.3.8beat2012-12-3016-0/+48 * -Update devel/libical to 0.48.mezz2012-12-304-5/+6 * Add a missing runtime dependency, py-dbus. Bump the PORTREVISION.mezz2012-12-291-2/+3 * size_t is now defined in sasl.h.ume2012-12-262-23/+0 * - Update to 2.2.4wen2012-12-223-9/+32 * DeforaOS desktop todo listbapt2012-12-195-0/+36 * Chare libexttextcat bumpbapt2012-12-191-1/+2 * Chase icu, graphite2 and libexttextcat bumpbapt2012-12-191-0/+1 * Horde port fixes:mm2012-12-184-10/+10 * Fix index after horde4 -> horde renamingbapt2012-12-181-4/+4 * Rename horde4-* apps to horde-*mm2012-12-1812-0/+0 * - Update to 0.9.10bdrewery2012-12-183-4/+5 * Fixup plist and USE_QT4 to be more accurate.wxs2012-12-172-8/+7 * 2012-05-10 deskutils/doodle: BROKEN for more than 6 monthjadawin2012-12-178-108/+0 * Rename package names for horde3 ports to horde3-*mm2012-12-165-2/+5 * - updated header with creationjgh2012-12-161-3/+5 * - tighten COMMENTjgh2012-12-161-4/+6 * - Update to 1.6.2madpilot2012-12-152-3/+3 * - Update to 0.1.26olivierd2012-12-153-19/+18 * Bump PORTREVISION for libexo-related portsolivierd2012-12-151-1/+1 * - Chase graphics/ImageMagick updatebdrewery2012-12-141-0/+1 * Update horde4 packages and applications to horde5mm2012-12-128-24/+30 * Fix build with latest cyrus-sasl2.ume2012-12-121-0/+10 * Rename old horde applications to horde3- prefixmm2012-12-1225-13/+13 * Fix build with latest cyrus-sasl2 port.ume2012-12-111-0/+13 * - update libvirt to 1.0.0, and bump others for shlib changejgh2012-12-111-7/+3 * Update PCRE to 8.32mm2012-12-113-5/+5 * Decommissioning java 1.5 (EOLed since October 2009) + removing outdated jdk16bapt2012-12-111-6/+2 * Update cyrus-sasl2 to 2.1.26.ume2012-12-104-4/+6 * Decommissioning java 1.5 (EOLed since October 2009):bapt2012-12-104-19/+7 * - Update to 3.1.1culot2012-12-093-24/+6 * - Fix build on FreeBSD 7.x [1]pawel2012-12-092-7/+8 * Remove ASPELL description and use the default.wxs2012-12-051-2/+1 * Update to 1.18.1.wxs2012-12-053-24/+36 * - Update to 0.19culot2012-12-042-9/+7 * - update to 0.9.8 [1]rm2012-12-044-8/+10 * - retire deskutils/abacusdinoex2012-12-0425-1082/+0 * - Update to version 2.1sperber2012-12-013-54/+21 * - New MASTER_SITES pathfluffy2012-11-301-1/+2 * Upgrade to 1.02.thierry2012-11-303-8/+5 * - Update to 1.6.9bdrewery2012-11-302-3/+3 * - Update to version 2.26pawel2012-11-293-16/+27 * 2012-11-26 emulators/gcube: No more public distfilesbapt2012-11-286-118/+0 * - Update to 0.9.7 [1]bdrewery2012-11-263-5/+12 * Update to new upstream Beta 7.mandree2012-11-243-64/+56 * - Update to version 0.9.6pawel2012-11-243-510/+536 * Fix build with clang.kevlo2012-11-232-0/+34 * - update to 1.6.1rm2012-11-202-3/+3 * horde4 update:mm2012-11-198-12/+12 * - Add missing dependencylwhsu2012-11-131-1/+3 * - Update WWW to new sitelwhsu2012-11-121-1/+1 * - update to 1.21rm2012-11-122-13/+8 * - Upgrade to 1.4.0.kuriyama2012-11-113-11/+5 * - Update to 2.1lwhsu2012-11-113-44/+5 * - update to 0.3rm2012-11-094-36/+138 * - Update to 5.18.2jhale2012-11-084-29/+66 * - Update to 1.3.12cs2012-11-042-7/+4 * Restore 'Created by' header information. This has been removed during theehaupt2012-11-042-0/+2 * - update to 1.6.0rm2012-11-023-27/+23 * - Add LICENSEpawel2012-11-021-18/+36 * Update to 1.3.20kevlo2012-10-293-16/+44 * Deprecate a bunch of ports that are either abandonware and/or for which no morebapt2012-10-261-4/+4 * remove expired port:rene2012-10-265-54/+0 * 2012-10-20 deskutils/superkaramba-lwp: No more public_distfilesbapt2012-10-265-66/+0 * - Update to 1.8.004.20121024wen2012-10-252-5/+5 * - Update to 1.8.004.20120822wen2012-10-252-33/+33 * - Update to 1.6.6jhale2012-10-242-3/+3 * - Update to 6.5.6wen2012-10-223-7/+3 * - drop maintainershipdinoex2012-10-211-10/+10 * Convert to OptionsNGeadler2012-10-201-1/+3 * Update to new upstream beta6 version.mandree2012-10-193-44/+73 * - Update MASTER_SITE_SUBDIRwen2012-10-161-1/+1 * - drop icon-theme.cache from plistsjgh2012-10-144-13/+4 * - cleanup commentsdinoex2012-10-1320-100/+0 * - Update to 1.6.5jhale2012-10-112-3/+3 * - Update to 6.5.5wen2012-10-093-11/+88 * Update to 1.3.19kevlo2012-10-093-9/+7 * Update to 0.5.romain2012-10-095-49/+24 * Correct logic from OptionsNG conversion.eadler2012-10-071-1/+1 * Convert to OptionsNGeadler2012-10-071-15/+10 * Trim the headers in the ports I maintain.eadler2012-10-06