Add LDAP contains query.
authorMatch Grun <match@dimensional.com>
Sun, 2 Nov 2003 23:26:36 +0000 (23:26 +0000)
committerMatch Grun <match@dimensional.com>
Sun, 2 Nov 2003 23:26:36 +0000 (23:26 +0000)
ChangeLog.claws
configure.ac
src/addrindex.c
src/browseldap.h
src/editldap.c
src/ldapquery.c

index 9b084d758431e1799d3610cfa2ecb15ae4e49172..0822b271475387a4bfad46b3d0bb7cf29fb67928 100644 (file)
@@ -1,3 +1,12 @@
+2003-11-02 [match]     0.9.6claws65
+
+       * src/browseldap.h
+               fix if not building LDAP support.
+       * src/addrindex.c
+       * src/ldapquery.[ch]
+       * src/editldap.h
+               include support for contains query. feature req 529354.
+
 2003-11-02 [alfons]    0.9.6claws64
 
        * src/browseldap.c
index f162a4d744c2d2d615abcf92d27040d749eaebdc..cbb8e4cf5f0e4eb00cd2222d7019e8ba73520ae1 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=64
+EXTRA_VERSION=65
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
index 89a7f4c3c5b0fd17554fa6ee8ee0cfd34ead0276..6527fc2daa4de74904a5ee426a4fd5cc7b7bac89 100644 (file)
 #define ATTAG_LDAP_TIMEOUT    "timeout"
 #define ATTAG_LDAP_MAX_AGE    "max-age"
 #define ATTAG_LDAP_DYN_SEARCH "dyn-search"
+#define ATTAG_LDAP_MATCH_OPT  "match-opt"
 
 #define ELTAG_LDAP_ATTR_SRCH  "attribute"
 #define ATTAG_LDAP_ATTR_NAME  "name"
 
+/* Attribute values */
+#define ATVAL_BOOLEAN_YES         "yes"
+#define ATVAL_BOOLEAN_NO          "no"
+#define ATVAL_LDAP_MATCH_BEGIN    "begin-with"
+#define ATVAL_LDAP_MATCH_CONTAINS "contains"
+
 /* New attributes */
 #define ATTAG_LDAP_DEFAULT    "default"
 
@@ -1329,6 +1336,11 @@ static void addrindex_parse_ldap_attrlist( XMLFile *file, LdapControl *ctl ) {
 
 }
 
+/**
+ * Parse LDAP control data from XML file.
+ * \param  file Index file.
+ * \return Initialized data soruce object.
+ */
 static AddressDataSource *addrindex_parse_ldap( XMLFile *file ) {
        AddressDataSource *ds;
        LdapServer *server;
@@ -1336,10 +1348,13 @@ static AddressDataSource *addrindex_parse_ldap( XMLFile *file ) {
        GList *attr;
        gchar *serverName = NULL;
        gchar *criteria = NULL;
-       gboolean bSearch = FALSE;
-       gboolean cvtFlag = TRUE;
+       gboolean bDynSearch;
+       gint iMatch;
 
        /* printf( "addrindex_parse_ldap\n" ); */
+       /* Set up some defaults */
+       bDynSearch = FALSE;
+       iMatch = LDAPCTL_MATCH_BEGINWITH;
 
        ds = addrindex_create_datasource( ADDR_IF_LDAP );
        ctl = ldapctl_create();
@@ -1382,10 +1397,15 @@ static AddressDataSource *addrindex_parse_ldap( XMLFile *file ) {
                        ldapctl_set_max_query_age( ctl, ivalue );
                }
                else if( strcmp( name, ATTAG_LDAP_DYN_SEARCH ) == 0 ) {
-                       bSearch = FALSE;
-                       cvtFlag = FALSE;
-                       if( strcmp( value, "yes" ) == 0 ) {
-                               bSearch = TRUE;
+                       bDynSearch = FALSE;
+                       if( strcmp( value, ATVAL_BOOLEAN_YES ) == 0 ) {
+                               bDynSearch = TRUE;
+                       }
+               }
+               else if( strcmp( name, ATTAG_LDAP_MATCH_OPT ) == 0 ) {
+                       iMatch = LDAPCTL_MATCH_BEGINWITH;
+                       if( strcmp( value, ATVAL_LDAP_MATCH_CONTAINS ) == 0 ) {
+                               iMatch = LDAPCTL_MATCH_CONTAINS;
                        }
                }
                attr = g_list_next( attr );
@@ -1393,7 +1413,8 @@ static AddressDataSource *addrindex_parse_ldap( XMLFile *file ) {
 
        server = ldapsvr_create_noctl();
        ldapsvr_set_name( server, serverName );
-       ldapsvr_set_search_flag( server, bSearch );
+       ldapsvr_set_search_flag( server, bDynSearch );
+       ldapctl_set_matching_option( ctl, iMatch );
        g_free( serverName );
        ldapsvr_set_control( server, ctl );
        ds->rawDataSource = server;
@@ -1410,13 +1431,6 @@ static AddressDataSource *addrindex_parse_ldap( XMLFile *file ) {
                }
                g_free( criteria );
        }
-       /*
-        * If no search flag was found, then we are converting from old format
-        * server data to new format.
-        */
-       if( cvtFlag ) {
-               ldapsvr_set_search_flag( server, TRUE );
-       }
        /* ldapsvr_print_data( server, stdout ); */
 
        return ds;
@@ -1453,7 +1467,12 @@ static void addrindex_write_ldap( FILE *fp, AddressDataSource *ds, gint lvl ) {
        addrindex_write_attr( fp, ATTAG_LDAP_MAX_AGE, value );
 
        addrindex_write_attr( fp, ATTAG_LDAP_DYN_SEARCH,
-                       server->searchFlag ? "yes" : "no" );
+                       server->searchFlag ?
+                       ATVAL_BOOLEAN_YES : ATVAL_BOOLEAN_NO );
+
+       addrindex_write_attr( fp, ATTAG_LDAP_MATCH_OPT,
+               ( ctl->matchingOption == LDAPCTL_MATCH_CONTAINS ) ?
+               ATVAL_LDAP_MATCH_CONTAINS : ATVAL_LDAP_MATCH_BEGIN );
 
        fputs(" >\n", fp);
 
index d3121d7f21d817fd3606b3c98422d52acdff3ac3..ac05963e701ca02bed11b4d4d5bdc020c247edc9 100644 (file)
 #ifndef __BROWSE_LDAP_H__
 #define __BROWSE_LDAP_H__
 
+#ifdef USE_LDAP
+
 #include "addrindex.h"
 
 gboolean browseldap_entry( AddressDataSource *ds, const gchar *dn );
 
+#endif /* USE_LDAP */
+
 #endif /* __BROWSE_LDAP_H__ */
index 3fda5c01481bcef35cd1cf78f81dcd891cd251ff..3b2b56731540783812c11543d0d2a5c99cabbe56 100644 (file)
@@ -78,6 +78,7 @@ static struct _LDAPEdit {
        GtkWidget *entry_criteria;
        GtkWidget *spinbtn_queryage;
        GtkWidget *check_dynsearch;
+       GtkWidget *check_matchoption;
 } ldapedit;
 
 /**
@@ -371,6 +372,7 @@ static void addressbook_edit_ldap_page_basic( gint pageNum, gchar *pageLbl ) {
        GtkWidget *entry_baseDN;
        GtkWidget *check_btn;
        GtkWidget *lookdn_btn;
+       GtkTooltips *toolTip;
        gint top;
 
        vbox = gtk_vbox_new( FALSE, 8 );
@@ -399,6 +401,11 @@ static void addressbook_edit_ldap_page_basic( gint pageNum, gchar *pageLbl ) {
        gtk_table_attach(GTK_TABLE(table), entry_name, 1, 2, top, (top + 1),
                GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
 
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, entry_name, _( 
+               "A name that you wish to call the server." ),
+               NULL );
+
        /* Next row */
        ++top;
        label = gtk_label_new(_("Hostname"));
@@ -409,6 +416,15 @@ static void addressbook_edit_ldap_page_basic( gint pageNum, gchar *pageLbl ) {
        gtk_table_attach(GTK_TABLE(table), entry_server, 1, 2, top, (top + 1),
                GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
 
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, entry_server, _( 
+               "This is the hostname of the server. For example, " \
+               "\"ldap.mydomain.com\" may be appropriate for the " \
+               "\"mydomain.com\" organization. An IP address may also be " \
+               "used. You may specify \"localhost\" if running an LDAP " \
+               "server on the same computer as Sylpheed." ),
+               NULL );
+
        /* Next row */
        ++top;
        label = gtk_label_new(_("Port"));
@@ -424,9 +440,20 @@ static void addressbook_edit_ldap_page_basic( gint pageNum, gchar *pageLbl ) {
        gtk_table_attach(GTK_TABLE(table), hbox_spin, 1, 2, top, (top + 1),
                GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
 
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, spinbtn_port, _( 
+               "The port number that the server listens on. Port 389 is " \
+               "the default." ),
+               NULL );
+
        check_btn = gtk_button_new_with_label( _(" Check Server "));
        gtk_table_attach(GTK_TABLE(table), check_btn, 2, 3, top, (top + 1), GTK_FILL, 0, 3, 0);
 
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, check_btn, _( 
+               "Press this button to test the connection to the server." ),
+               NULL );
+
        /* Next row */
        ++top;
        label = gtk_label_new(_("Search Base"));
@@ -437,9 +464,25 @@ static void addressbook_edit_ldap_page_basic( gint pageNum, gchar *pageLbl ) {
        gtk_table_attach(GTK_TABLE(table), entry_baseDN, 1, 2, top, (top + 1),
                GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
 
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, entry_baseDN, _( 
+               "This specifies the name of the directory to be searched " \
+               "on the server. Examples include:\n" \
+               "  dc=sylpheed,dc=org\n" \
+               "  ou=people,dc=domainname,dc=com\n" \
+               "  o=Organization Name,c=Country\n"
+               ),
+               NULL );
+
        lookdn_btn = gtk_button_new_with_label( _(" ... "));
        gtk_table_attach(GTK_TABLE(table), lookdn_btn, 2, 3, top, (top + 1), GTK_FILL, 0, 3, 0);
 
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, lookdn_btn, _( 
+               "Press this button to lookup the name of available " \
+               "directory names on the server." ),
+               NULL );
+
        /* Signal handlers */
        gtk_signal_connect(GTK_OBJECT(check_btn), "clicked",
                           GTK_SIGNAL_FUNC(edit_ldap_server_check), NULL);
@@ -464,7 +507,9 @@ static void addressbook_edit_ldap_page_search( gint pageNum, gchar *pageLbl ) {
        GtkObject *spinbtn_queryage_adj;
        GtkWidget *spinbtn_queryage;
        GtkWidget *check_dynsearch;
+       GtkWidget *check_matchoption;
        GtkWidget *reset_btn;
+       GtkTooltips *toolTip;
        gint top;
 
        vbox = gtk_vbox_new( FALSE, 8 );
@@ -493,9 +538,22 @@ static void addressbook_edit_ldap_page_search( gint pageNum, gchar *pageLbl ) {
        gtk_table_attach(GTK_TABLE(table), entry_criteria, 1, 2, top, (top + 1),
                GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
 
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, entry_criteria, _( 
+               "A list of LDAP attribute names that should be searched " \
+               "when attempting to find a name or address." ),
+               NULL );
+
        reset_btn = gtk_button_new_with_label( _(" Defaults "));
        gtk_table_attach(GTK_TABLE(table), reset_btn, 2, 3, top, (top + 1), GTK_FILL, 0, 3, 0);
 
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, reset_btn, _( 
+               "This resets the attribute names to a default value " \
+               "that should find most names and addresses during a " \
+               "name or address search process." ),
+               NULL );
+
        /* Next row */
        ++top;
        label = gtk_label_new(_("Max Query Age (secs)"));
@@ -512,6 +570,23 @@ static void addressbook_edit_ldap_page_search( gint pageNum, gchar *pageLbl ) {
        gtk_table_attach(GTK_TABLE(table), hbox_spin, 1, 2, top, (top + 1),
                GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
 
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, spinbtn_queryage, _( 
+               "This defines the maximum period of time (in seconds) that " \
+               "an address search result is valid for address completion " \
+               "purposes. Search results are stored in a cache until this " \
+               "period of time has passed and then retired. This will " \
+               "improve the response time when attempting to search for " \
+               "the same name or address on subsequent address completion " \
+               "requests. The cache will be searched in preference to " \
+               "performing a new server search request. The default value " \
+               "of 600 seconds (10 minutes), should be sufficient for most " \
+               "servers. A larger value will reduce the search time for " \
+               "subsequent searches. This is useful for servers that have " \
+               "slow response times at the expense of more memory to cache " \
+               "results." ),
+               NULL );
+
        /* Next row */
        ++top;
        check_dynsearch = gtk_check_button_new_with_label(
@@ -519,6 +594,31 @@ static void addressbook_edit_ldap_page_search( gint pageNum, gchar *pageLbl ) {
        gtk_table_attach(GTK_TABLE(table), check_dynsearch, 1, 3, top, (top + 1),
                GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
 
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, check_dynsearch, _( 
+               "Check this option to include this server for dynamic " \
+               "searches when using address completion." ),
+               NULL );
+
+       /* Next row */
+       ++top;
+       check_matchoption = gtk_check_button_new_with_label(
+                               _("Match names 'containing' search term") );
+       gtk_table_attach(GTK_TABLE(table), check_matchoption, 1, 3, top, (top + 1),
+               GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
+
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, check_matchoption, _( 
+               "Searches for names and addresses can be performed either " \
+               "using \"begins-with\" or \"contains\" search term. Check " \
+               "this option to perform a contains search; this type of " \
+               "search usually takes longer to complete. Note that for " \
+               "performance reasons, address completion uses " \
+               "\"begins-with\" for all searches against other address " \
+               "interfaces." \
+               ),
+               NULL );
+
        /* Signal handlers */
        gtk_signal_connect(GTK_OBJECT(reset_btn), "clicked",
                           GTK_SIGNAL_FUNC(edit_ldap_search_reset), NULL);
@@ -526,9 +626,10 @@ static void addressbook_edit_ldap_page_search( gint pageNum, gchar *pageLbl ) {
        /* Done */
        gtk_widget_show_all(vbox);
 
-       ldapedit.entry_criteria   = entry_criteria;
-       ldapedit.spinbtn_queryage = spinbtn_queryage;
-       ldapedit.check_dynsearch  = check_dynsearch;
+       ldapedit.entry_criteria    = entry_criteria;
+       ldapedit.spinbtn_queryage  = spinbtn_queryage;
+       ldapedit.check_dynsearch   = check_dynsearch;
+       ldapedit.check_matchoption = check_matchoption;
 }
 
 static void addressbook_edit_ldap_page_extended( gint pageNum, gchar *pageLbl ) {
@@ -542,6 +643,7 @@ static void addressbook_edit_ldap_page_extended( gint pageNum, gchar *pageLbl )
        GtkWidget *spinbtn_timeout;
        GtkObject *spinbtn_maxentry_adj;
        GtkWidget *spinbtn_maxentry;
+       GtkTooltips *toolTip;
        gint top;
 
        vbox = gtk_vbox_new( FALSE, 8 );
@@ -570,6 +672,14 @@ static void addressbook_edit_ldap_page_extended( gint pageNum, gchar *pageLbl )
        gtk_table_attach(GTK_TABLE(table), entry_bindDN, 1, 2, top, (top + 1),
                GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
 
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, entry_bindDN, _( 
+               "The LDAP user account name to be used to connect to the " \
+               "This is usually only used for protected servers. This name " \
+               "is typically formatted as: \"cn=user,dc=sylpheed,dc=com\". " \
+               "This is usually left empty when performing a search." ),
+               NULL );
+
        /* Next row */
        ++top;
        label = gtk_label_new(_("Bind Password"));
@@ -580,6 +690,12 @@ static void addressbook_edit_ldap_page_extended( gint pageNum, gchar *pageLbl )
        gtk_table_attach(GTK_TABLE(table), entry_bindPW, 1, 2, top, (top + 1),
                GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
 
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, entry_bindPW, _( 
+               "The password to be used when connecting as the \"Bind DN\" " \
+               "user." ),
+               NULL );
+
        /* Next row */
        ++top;
        label = gtk_label_new(_("Timeout (secs)"));
@@ -595,6 +711,10 @@ static void addressbook_edit_ldap_page_extended( gint pageNum, gchar *pageLbl )
        gtk_table_attach(GTK_TABLE(table), hbox_spin, 1, 2, top, (top + 1),
                GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
 
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, spinbtn_timeout, _( 
+               "The timeout period in seconds." ), NULL );
+
        /* Next row */
        ++top;
        label = gtk_label_new(_("Maximum Entries"));
@@ -610,6 +730,12 @@ static void addressbook_edit_ldap_page_extended( gint pageNum, gchar *pageLbl )
        gtk_table_attach(GTK_TABLE(table), hbox_spin, 1, 2, top, (top + 1),
                GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
 
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, spinbtn_maxentry, _( 
+               "The maximum number of entries that should be returned be " \
+               "returned in the search results." ),
+               NULL );
+
        /* Done */
        gtk_widget_show_all(vbox);
 
@@ -748,6 +874,8 @@ static void edit_ldap_clear_fields( void ) {
                GTK_SPIN_BUTTON(ldapedit.spinbtn_queryage), LDAPCTL_DFL_QUERY_AGE );
        gtk_toggle_button_set_active(
                GTK_TOGGLE_BUTTON( ldapedit.check_dynsearch), TRUE );
+       gtk_toggle_button_set_active(
+               GTK_TOGGLE_BUTTON( ldapedit.check_matchoption), FALSE );
 }
 
 /**
@@ -795,13 +923,25 @@ static void edit_ldap_set_fields( LdapServer *server ) {
                GTK_SPIN_BUTTON(ldapedit.spinbtn_queryage), ctl->maxQueryAge );
        gtk_toggle_button_set_active(
                GTK_TOGGLE_BUTTON( ldapedit.check_dynsearch), server->searchFlag );
+       gtk_toggle_button_set_active(
+               GTK_TOGGLE_BUTTON( ldapedit.check_matchoption),
+               ( ctl->matchingOption == LDAPCTL_MATCH_CONTAINS ) );
 }
 
-AdapterDSource *addressbook_edit_ldap( AddressIndex *addrIndex, AdapterDSource *ads ) {
+/**
+ * Edit LDAP server datasource that appears addressbook.
+ * \param addrIndex Address index object.
+ * \param ads       Data source adapter.
+ * \return Update data source adapter, or <code>NULL</code> if user cancelled
+ *         edit with dialog.
+ */
+AdapterDSource *addressbook_edit_ldap(
+       AddressIndex *addrIndex, AdapterDSource *ads )
+{
        static gboolean cancelled;
        gchar *sName, *sHost, *sBase, *sBind, *sPass, *sCrit;
        gint iPort, iMaxE, iTime, iAge;
-       gboolean bSrch;
+       gboolean bSrch, bMatch;
        AddressDataSource *ds = NULL;
        LdapServer *server = NULL;
        LdapControl *ctl = NULL;
@@ -833,17 +973,30 @@ AdapterDSource *addressbook_edit_ldap( AddressIndex *addrIndex, AdapterDSource *
        gtk_widget_hide(ldapedit.window);
        if (cancelled == TRUE) return NULL;
 
-       sName = gtk_editable_get_chars( GTK_EDITABLE(ldapedit.entry_name), 0, -1 );
-       sHost = gtk_editable_get_chars( GTK_EDITABLE(ldapedit.entry_server), 0, -1 );
-       sBase = gtk_editable_get_chars( GTK_EDITABLE(ldapedit.entry_baseDN), 0, -1 );
-       sCrit = gtk_editable_get_chars( GTK_EDITABLE(ldapedit.entry_criteria), 0, -1 );
-       sBind = gtk_editable_get_chars( GTK_EDITABLE(ldapedit.entry_bindDN), 0, -1 );
-       sPass = gtk_editable_get_chars( GTK_EDITABLE(ldapedit.entry_bindPW), 0, -1 );
-       iPort = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( ldapedit.spinbtn_port ) );
-       iTime = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( ldapedit.spinbtn_timeout ) );
-       iMaxE = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( ldapedit.spinbtn_maxentry ) );
-       iAge  = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( ldapedit.spinbtn_queryage ) );
-       bSrch = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( ldapedit.check_dynsearch ) );
+       sName = gtk_editable_get_chars(
+                       GTK_EDITABLE(ldapedit.entry_name), 0, -1 );
+       sHost = gtk_editable_get_chars(
+                       GTK_EDITABLE(ldapedit.entry_server), 0, -1 );
+       sBase = gtk_editable_get_chars(
+                       GTK_EDITABLE(ldapedit.entry_baseDN), 0, -1 );
+       sCrit = gtk_editable_get_chars(
+                       GTK_EDITABLE(ldapedit.entry_criteria), 0, -1 );
+       sBind = gtk_editable_get_chars(
+                       GTK_EDITABLE(ldapedit.entry_bindDN), 0, -1 );
+       sPass = gtk_editable_get_chars(
+                       GTK_EDITABLE(ldapedit.entry_bindPW), 0, -1 );
+       iPort = gtk_spin_button_get_value_as_int(
+                       GTK_SPIN_BUTTON( ldapedit.spinbtn_port ) );
+       iTime = gtk_spin_button_get_value_as_int(
+                       GTK_SPIN_BUTTON( ldapedit.spinbtn_timeout ) );
+       iMaxE = gtk_spin_button_get_value_as_int(
+                       GTK_SPIN_BUTTON( ldapedit.spinbtn_maxentry ) );
+       iAge  = gtk_spin_button_get_value_as_int(
+                       GTK_SPIN_BUTTON( ldapedit.spinbtn_queryage ) );
+       bSrch = gtk_toggle_button_get_active(
+                       GTK_TOGGLE_BUTTON( ldapedit.check_dynsearch ) );
+       bMatch = gtk_toggle_button_get_active(
+                       GTK_TOGGLE_BUTTON( ldapedit.check_matchoption ) );
 
        fin = FALSE;
        if( *sName == '\0' ) fin = TRUE;
@@ -854,8 +1007,10 @@ AdapterDSource *addressbook_edit_ldap( AddressIndex *addrIndex, AdapterDSource *
                if( ! ads ) {
                        /* New server */
                        server = ldapsvr_create();
-                       ds = addrindex_index_add_datasource( addrIndex, ADDR_IF_LDAP, server );
-                       ads = addressbook_create_ds_adapter( ds, ADDR_LDAP, NULL );
+                       ds = addrindex_index_add_datasource(
+                               addrIndex, ADDR_IF_LDAP, server );
+                       ads = addressbook_create_ds_adapter(
+                               ds, ADDR_LDAP, NULL );
                }
                ctl = server->control;
                addressbook_ads_set_name( ads, sName );
@@ -869,6 +1024,9 @@ AdapterDSource *addressbook_edit_ldap( AddressIndex *addrIndex, AdapterDSource *
                ldapctl_set_max_entries( ctl, iMaxE );
                ldapctl_set_timeout( ctl, iTime );
                ldapctl_set_max_query_age( ctl, iAge );
+               ldapctl_set_matching_option(
+                       ctl, bMatch ?
+                       LDAPCTL_MATCH_CONTAINS : LDAPCTL_MATCH_BEGINWITH );
 
                /* Save attributes */
                editldap_parse_criteria( sCrit, ctl );
index a04b77934b2afe58963685ecba96ac263a27bc90..32a5f66f828ae692b8d2884afee4d1b22628b303 100644 (file)
@@ -710,7 +710,11 @@ static gint ldapqry_connect( LdapQuery *qry ) {
        gint rc;
 
        /* Initialize connection */
+       printf( "===ldapqry_connect===\n" );
+       ldapqry_print( qry, stdout );
        ctl = qry->control;
+       ldapctl_print( ctl, stdout );
+       printf( "======\n" );
        ldapqry_touch( qry );
        qry->startTime = qry->touchTime;
        qry->elapsedTime = -1;