aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2001-10-30 10:32:50 +0800
committerChris Toshok <toshok@src.gnome.org>2001-10-30 10:32:50 +0800
commit9ff66262c07b74c4d9fcd2ef1a37daf720401e6a (patch)
tree911ee1001f412fea7c84d1061dbbb6478591772a /addressbook/backend
parentb3e9e54480b8bbf1523b6b7c180ffd3c1e4de0e3 (diff)
downloadgsoc2013-evolution-9ff66262c07b74c4d9fcd2ef1a37daf720401e6a.tar.gz
gsoc2013-evolution-9ff66262c07b74c4d9fcd2ef1a37daf720401e6a.tar.zst
gsoc2013-evolution-9ff66262c07b74c4d9fcd2ef1a37daf720401e6a.zip
overload this function for modifying objectclasses too, so we can make
2001-10-29 Chris Toshok <toshok@ximian.com> * backend/pas/pas-backend-ldap.c (add_objectclass_mod): overload this function for modifying objectclasses too, so we can make sure evolutionPerson shows up in the objectclasses of an entry if it shows up in the schema for the server. (create_card_handler): add @replace = FALSE in the call to add_objectclass_mod. (modify_card_handler): call add_objectclass_mod with @replace = TRUE. (anniversary_compare): fix typo - return "equal", not "TRUE". (birthday_compare): same. svn path=/trunk/; revision=14402
Diffstat (limited to 'addressbook/backend')
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index 61144471e9..83e2b85971 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -750,12 +750,12 @@ build_mods_from_ecards (PASBackendLDAP *bl, ECardSimple *current, ECardSimple *n
}
static void
-add_objectclass_mod (PASBackendLDAP *bl, GPtrArray *mod_array)
+add_objectclass_mod (PASBackendLDAP *bl, GPtrArray *mod_array, gboolean modify)
{
LDAPMod *objectclass_mod;
objectclass_mod = g_new (LDAPMod, 1);
- objectclass_mod->mod_op = LDAP_MOD_ADD;
+ objectclass_mod->mod_op = modify ? LDAP_MOD_REPLACE : LDAP_MOD_ADD;
objectclass_mod->mod_type = g_strdup ("objectClass");
objectclass_mod->mod_values = g_new (char*, bl->priv->evolutionPersonSupported ? 6 : 5);
objectclass_mod->mod_values[0] = g_strdup (TOP);
@@ -824,7 +824,7 @@ create_card_handler (PASBackend *backend, LDAPOp *op)
g_ptr_array_remove (mod_array, NULL);
/* add our objectclass(es) */
- add_objectclass_mod (bl, mod_array);
+ add_objectclass_mod (bl, mod_array, FALSE);
/* then put the NULL back */
g_ptr_array_add (mod_array, NULL);
@@ -1088,6 +1088,17 @@ modify_card_handler (PASBackend *backend, LDAPOp *op)
/* build our mods */
mod_array = build_mods_from_ecards (bl, current_card, new_card, &need_new_dn);
if (mod_array->len > 0) {
+
+ /* remove the NULL at the end */
+ g_ptr_array_remove (mod_array, NULL);
+
+ /* add our objectclass(es), making sure
+ evolutionPerson is there if it's supported */
+ add_objectclass_mod (bl, mod_array, TRUE);
+
+ /* then put the NULL back */
+ g_ptr_array_add (mod_array, NULL);
+
ldap_mods = (LDAPMod**)mod_array->pdata;
/* actually perform the ldap modify */
@@ -1636,7 +1647,7 @@ anniversary_compare (ECardSimple *ecard1, ECardSimple *ecard2)
g_free (date1);
g_free (date2);
- return TRUE;
+ return equal;
}
static void
@@ -1703,7 +1714,7 @@ birthday_compare (ECardSimple *ecard1, ECardSimple *ecard2)
g_free (date1);
g_free (date2);
- return TRUE;
+ return equal;
}
#define IS_RFC2254_CHAR(c) ((c) == '*' || (c) =='\\' || (c) == '(' || (c) == ')' || (c) == '\0')