Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
No build reason found for images:x86_64
home:jberkman
evolution-exchange-2.6
fix-gal-issues.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-gal-issues.diff of Package evolution-exchange-2.6
--- addressbook/e-book-backend-gal.c.old 2007-03-28 14:02:53.000000000 +0530 +++ addressbook/e-book-backend-gal.c 2007-04-02 11:39:04.000000000 +0530 @@ -277,6 +277,29 @@ gal_connect (EBookBackendGAL *bl) } static gboolean +ldap_reconnect (EBookBackendGAL *bl, EDataBookView *book_view, LDAP **ldap, int status){ + + if (!ldap || !*ldap) + return FALSE; + + if (status == LDAP_SERVER_DOWN) { + + if (book_view) + book_view_notify_status (book_view, _("Reconnecting to LDAP server...")); + + ldap_unbind (*ldap); + *ldap = e2k_global_catalog_get_ldap (bl->priv->gc, NULL); + if (book_view) + book_view_notify_status (book_view, ""); + + if (*ldap) + return TRUE; + } + + return FALSE; +} + +static gboolean gal_reconnect (EBookBackendGAL *bl, EDataBookView *book_view, int ldap_status) { if (!bl->priv->ldap) { @@ -978,8 +1001,11 @@ func_contains(ESExp *f, int argc, ESExpR if (strlen(str) == 0) { r = e_sexp_result_new(f, ESEXP_RES_BOOL); r->value.bool = FALSE; - } else - r = e_sexp_result_new(f, ESEXP_RES_UNDEFINED); + } else { + r = e_sexp_result_new(f, ESEXP_RES_STRING); + r->value.string = g_strdup_printf ("(mailNickname=%s)", str); + } + return r; } @@ -1198,7 +1224,6 @@ member_populate (EContact *contact, char EVCardAttribute *attr; member_info = g_strsplit (values [i], ";", -1); - attr = e_vcard_attribute_new (NULL, EVC_EMAIL); e_vcard_attribute_add_param_with_value (attr, e_vcard_attribute_param_new (EVC_X_DEST_EMAIL), member_info [0]); e_vcard_attribute_add_param_with_value (attr, e_vcard_attribute_param_new (EVC_X_DEST_CONTACT_UID), member_info [1]); @@ -1233,7 +1258,7 @@ get_time_stamp (char *serv_time_str) result_str = g_strdup_printf ("%s-%s-%sT%s:%s:%s.%sZ", year, month, date, hour, minute, second, zone); - printf ("rev time : %s\n", result_str); + d(printf ("rev time : %s\n", result_str)); g_free (year); g_free (month); @@ -1274,17 +1299,34 @@ static EContact * build_contact_from_entry (EBookBackendGAL *bl, LDAPMessage *e, GList **existing_objectclasses) { LDAP *ldap = bl->priv->ldap; + LDAP *subldap = NULL; EContact *contact = e_contact_new (); char *dn; char *attr; - BerElement *ber = NULL; - + BerElement *ber = NULL, *tber = NULL;; + gboolean is_group = FALSE; + dn = ldap_get_dn(ldap, e); e_contact_set (contact, E_CONTACT_UID, dn); ldap_memfree (dn); g_mutex_lock (bl->priv->ldap_lock); + attr = ldap_first_attribute (ldap, e, &tber); + while (attr) { + if (!strcmp(attr, "member")) { + is_group = TRUE; + ldap_memfree (attr); + break; + } + ldap_memfree (attr); + attr = ldap_next_attribute (ldap, e, tber); + } + if (tber) + ber_free (tber, 0); + g_mutex_unlock (bl->priv->ldap_lock); + + g_mutex_lock (bl->priv->ldap_lock); attr = ldap_first_attribute (ldap, e, &ber); g_mutex_unlock (bl->priv->ldap_lock); @@ -1325,7 +1367,7 @@ build_contact_from_entry (EBookBackendGA g_mutex_unlock (bl->priv->ldap_lock); if (values) { - if (info->prop_type & PROP_TYPE_STRING) { + if (info->prop_type & PROP_TYPE_STRING && !(is_group && (info->field_id == E_CONTACT_EMAIL_1))) { d(printf ("value = %s\n", values[0])); /* if it's a normal property just set the string */ if (values[0]) @@ -1343,6 +1385,9 @@ build_contact_from_entry (EBookBackendGA LDAPMessage *result; char **email_values, **cn_values, **member_info; + if (!subldap) { + subldap = e2k_global_catalog_get_ldap (bl->priv->gc, NULL); + } grpattrs[0] = "cn"; grpattrs[1] = "mail"; grpattrs[2] = NULL; @@ -1361,12 +1406,12 @@ build_contact_from_entry (EBookBackendGA for (i=0; values[i]; i++) { /* get the email id for the given dn */ /* set base to DN and scope to base */ - printf("value (dn) = %s \n", values [i]); + d(printf("value (dn) = %s \n", values [i])); do { - if ((ldap_error = ldap_search_ext_s (bl->priv->ldap, + if ((ldap_error = ldap_search_ext_s (subldap, values[i], LDAP_SCOPE_BASE, - NULL, + "(objectclass=User)", grpattrs, 0, NULL, NULL, @@ -1378,14 +1423,14 @@ build_contact_from_entry (EBookBackendGA email_values = ldap_get_values (ldap, result, "mail"); if (email_values) { - printf ("email = %s \n", email_values [0]); + d(printf ("email = %s \n", email_values [0])); *(member_info+i) = g_strdup_printf ("%s;%s;", email_values[0], values[i]); ldap_value_free (email_values); } if (cn_values) { - printf ("cn = %s \n", cn_values[0]); + d(printf ("cn = %s \n", cn_values[0])); *(member_info+i) = g_strconcat (* (member_info +i), cn_values[0], NULL); @@ -1393,7 +1438,7 @@ build_contact_from_entry (EBookBackendGA } } } - while (gal_reconnect (bl, book_view, ldap_error)); + while (ldap_reconnect (bl, book_view, &subldap, ldap_error)); if (ldap_error != LDAP_SUCCESS) { book_view_notify_status (book_view, @@ -1425,6 +1470,9 @@ build_contact_from_entry (EBookBackendGA if (ber) ber_free (ber, 0); + if (subldap) + ldap_unbind (subldap); + return contact; } @@ -2294,15 +2342,15 @@ load_source (EBookBackend *backend, bl->priv->file_db = NULL; - if (bl->priv->mode == GNOME_Evolution_Addressbook_MODE_LOCAL) { + if (bl->priv->mode == GNOME_Evolution_Addressbook_MODE_LOCAL && !bl->priv->marked_for_offline) { /* Offline */ - e_book_backend_set_is_loaded (backend, TRUE); + e_book_backend_set_is_loaded (backend, FALSE); e_book_backend_set_is_writable (backend, FALSE); e_book_backend_notify_writable (backend, FALSE); e_book_backend_notify_connection_status (backend, FALSE); - return GNOME_Evolution_Addressbook_Success; + return GNOME_Evolution_Addressbook_RepositoryOffline; } @@ -2416,7 +2464,11 @@ load_source (EBookBackend *backend, e_book_backend_set_is_writable (E_BOOK_BACKEND(backend), FALSE); e_book_backend_set_is_loaded (E_BOOK_BACKEND (backend), TRUE); e_book_backend_notify_writable (backend, FALSE); - e_book_backend_notify_connection_status (E_BOOK_BACKEND (backend), TRUE); + + if (bl->priv->mode == GNOME_Evolution_Addressbook_MODE_LOCAL) + e_book_backend_notify_connection_status (E_BOOK_BACKEND (backend), FALSE); + else + e_book_backend_notify_connection_status (E_BOOK_BACKEND (backend), TRUE); return GNOME_Evolution_Addressbook_Success;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor